aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Vakulenko <avakulenko@google.com>2016-04-08 08:59:38 -0700
committerAlex Vakulenko <avakulenko@google.com>2016-04-08 09:58:49 -0700
commit1333c63f8e0f69d7c426087502b729fa250144f7 (patch)
tree93e8b1d57efd3074ec4251c1c4cee3fb4d2c3d07
parent8e19eba94887ce18acab864f9e213781b1d30d4f (diff)
downloadweaved-1333c63f8e0f69d7c426087502b729fa250144f7.tar.gz
weaved: Remove release/aquire semantic from scoped_ptr/unique_ptrandroid-n-preview-2
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
-rw-r--r--common/binder_utils.cc11
1 files changed, 4 insertions, 7 deletions
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 @@ android::binder::Status ParseDictionary(
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();
}