summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Greg Kaiser <gkaiser@google.com> 2021-02-23 08:07:55 -0800
committer Greg Kaiser <gkaiser@google.com> 2021-02-23 08:09:16 -0800
commit7d3bb35c99a6aed98eef635cc35cd8595f50e688 (patch)
tree266d980b4d9d712216142af772ef3afe30a98697
parent7dc57eff26cb36da4e7e92e74217855d40a9d56a (diff)
LightInputMapper: Use const reference for some args
We switch a couple of function arguments to const reference instead of by-copy. Bug: 161633625 Test: TreeHugger Change-Id: I37a80c1ac1e7907315951ed3b65653eec4bde2b5
-rw-r--r--services/inputflinger/reader/mapper/LightInputMapper.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/services/inputflinger/reader/mapper/LightInputMapper.h b/services/inputflinger/reader/mapper/LightInputMapper.h
index 9254720385..43141b87c0 100644
--- a/services/inputflinger/reader/mapper/LightInputMapper.h
+++ b/services/inputflinger/reader/mapper/LightInputMapper.h
@@ -44,7 +44,7 @@ public:
private:
struct Light {
- explicit Light(InputDeviceContext& context, std::string name, int32_t id,
+ explicit Light(InputDeviceContext& context, const std::string& name, int32_t id,
InputDeviceLightType type)
: context(context), name(name), id(id), type(type) {}
virtual ~Light() {}
@@ -65,7 +65,7 @@ private:
};
struct SingleLight : public Light {
- explicit SingleLight(InputDeviceContext& context, std::string name, int32_t id,
+ explicit SingleLight(InputDeviceContext& context, const std::string& name, int32_t id,
int32_t rawId)
: Light(context, name, id, InputDeviceLightType::SINGLE), rawId(rawId) {}
int32_t rawId;
@@ -77,7 +77,7 @@ private:
struct RgbLight : public Light {
explicit RgbLight(InputDeviceContext& context, int32_t id,
- std::unordered_map<LightColor, int32_t> rawRgbIds,
+ const std::unordered_map<LightColor, int32_t>& rawRgbIds,
std::optional<int32_t> rawGlobalId)
: Light(context, "RGB", id, InputDeviceLightType::RGB),
rawRgbIds(rawRgbIds),
@@ -98,7 +98,7 @@ private:
};
struct MultiColorLight : public Light {
- explicit MultiColorLight(InputDeviceContext& context, std::string name, int32_t id,
+ explicit MultiColorLight(InputDeviceContext& context, const std::string& name, int32_t id,
int32_t rawId)
: Light(context, name, id, InputDeviceLightType::MULTI_COLOR), rawId(rawId) {}
int32_t rawId;
@@ -109,8 +109,8 @@ private:
};
struct PlayerIdLight : public Light {
- explicit PlayerIdLight(InputDeviceContext& context, std::string name, int32_t id,
- std::unordered_map<int32_t, int32_t> rawLightIds)
+ explicit PlayerIdLight(InputDeviceContext& context, const std::string& name, int32_t id,
+ const std::unordered_map<int32_t, int32_t>& rawLightIds)
: Light(context, name, id, InputDeviceLightType::PLAYER_ID),
rawLightIds(rawLightIds) {}
// Map from player Id to raw light Id
@@ -132,4 +132,4 @@ private:
} // namespace android
-#endif // _UI_INPUTREADER_LIGHT_INPUT_MAPPER_H \ No newline at end of file
+#endif // _UI_INPUTREADER_LIGHT_INPUT_MAPPER_H