diff options
author | Tim Kilbourn <tkilbourn@google.com> | 2015-04-29 13:50:17 -0700 |
---|---|---|
committer | Tim Kilbourn <tkilbourn@google.com> | 2015-04-29 15:33:25 -0700 |
commit | c929d2509530b0262681c8e6619609f44bfceea4 (patch) | |
tree | 8aba768574fd551bde298b6304b16597fe3597c0 /modules/input/evdev/EvdevModule.cpp | |
parent | eedee7b8b5339d38ecd203b5b4849f496e352a35 (diff) |
Clarify usage of smart pointers
- Members should be smart (shared or unique)
- Prefer function args to be bare, unless the arg is intended to be
stored by the callee
- Function args that are smart should be const refs to avoid an extra
copy
Change-Id: I8052fa432bcffbabff9d67a8d568640cac64d4ad
Diffstat (limited to 'modules/input/evdev/EvdevModule.cpp')
-rw-r--r-- | modules/input/evdev/EvdevModule.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/modules/input/evdev/EvdevModule.cpp b/modules/input/evdev/EvdevModule.cpp index e9c82227..f6df2196 100644 --- a/modules/input/evdev/EvdevModule.cpp +++ b/modules/input/evdev/EvdevModule.cpp @@ -47,16 +47,16 @@ private: InputHost mInputHost; std::shared_ptr<InputDeviceManager> mDeviceManager; - std::shared_ptr<InputHub> mInputHub; + std::unique_ptr<InputHub> mInputHub; std::thread mPollThread; }; -static std::shared_ptr<EvdevModule> gEvdevModule; +static std::unique_ptr<EvdevModule> gEvdevModule; EvdevModule::EvdevModule(InputHost inputHost) : mInputHost(inputHost), mDeviceManager(std::make_shared<InputDeviceManager>()), - mInputHub(std::make_shared<InputHub>(mDeviceManager)) {} + mInputHub(std::make_unique<InputHub>(mDeviceManager)) {} void EvdevModule::init() { ALOGV("%s", __func__); @@ -98,7 +98,7 @@ static void input_init(const input_module_t* module, input_host_t* host, input_host_callbacks_t cb) { LOG_ALWAYS_FATAL_IF(strcmp(module->common.id, INPUT_HARDWARE_MODULE_ID) != 0); InputHost inputHost = {host, cb}; - gEvdevModule = std::make_shared<EvdevModule>(inputHost); + gEvdevModule = std::make_unique<EvdevModule>(inputHost); gEvdevModule->init(); } |