Replace Get* methods returning unique_ptr with reference alternative
Existing code created temporarily objects and returned them to the
client. It was not efficient and error-prone as client code could
retrieve pointers to internal objects without keeping unique_ptr alive.
Change-Id: I9e17c8d9f66dfc9f52ce9ffc9a31992b16b00461
Reviewed-on: https://weave-review.googlesource.com/1672
Reviewed-by: Alex Vakulenko <avakulenko@google.com>
diff --git a/src/device_manager.h b/src/device_manager.h
index ccf8778..6c3df05 100644
--- a/src/device_manager.h
+++ b/src/device_manager.h
@@ -52,12 +52,11 @@
ErrorPtr* error) override;
bool SetStateProperties(const base::DictionaryValue& dict,
ErrorPtr* error) override;
- std::unique_ptr<base::Value> GetStateProperty(
- const std::string& name) const override;
+ const base::Value* GetStateProperty(const std::string& name) const override;
bool SetStateProperty(const std::string& name,
const base::Value& value,
ErrorPtr* error) override;
- std::unique_ptr<base::DictionaryValue> GetState() const override;
+ const base::DictionaryValue& GetState() const override;
void Register(const std::string& ticket_id,
const DoneCallback& callback) override;
GcdState GetGcdState() const override;