weaved: Remove release/aquire semantic from scoped_ptr/unique_ptr
Now that scoped_ptr is just a type alias to unique_ptr, there is no
longer a need to convert between the two by using .release() and
constructing the other with a raw pointer.
BUG: None
TEST: Built for dragonboard, all unit tests pass (except for update_engine,
but those tests failed before these changes too).
Change-Id: Ifcda9520231cf4770d65d84c80cee481eb95285c
diff --git a/common/binder_utils.cc b/common/binder_utils.cc
index 641019a..44f1c59 100644
--- a/common/binder_utils.cc
+++ b/common/binder_utils.cc
@@ -48,17 +48,14 @@
std::unique_ptr<base::DictionaryValue>* dict) {
int error = 0;
std::string message;
- std::unique_ptr<base::Value> value{
+ auto value =
base::JSONReader::ReadAndReturnError(ToString(json), base::JSON_PARSE_RFC,
- &error, &message)
- .release()};
- base::DictionaryValue* dict_value = nullptr;
- if (!value || !value->GetAsDictionary(&dict_value)) {
+ &error, &message);
+ *dict = base::DictionaryValue::From(std::move(value));
+ if (!*dict) {
return android::binder::Status::fromServiceSpecificError(
error, android::String8{message.c_str()});
}
- dict->reset(dict_value);
- value.release(); // |dict| now owns the object.
return android::binder::Status::ok();
}