Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(55)

Unified Diff: ui/app_list/search/dictionary_data_store.cc

Issue 1394993004: Make ValueDeserializer::Deserialize return scoped_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix and add todo about not failed trybot Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « rlz/chromeos/lib/rlz_value_store_chromeos.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/app_list/search/dictionary_data_store.cc
diff --git a/ui/app_list/search/dictionary_data_store.cc b/ui/app_list/search/dictionary_data_store.cc
index 45f53ca6edb58101530b4cc03cf1e5416218c06c..443d9734d896cf2f39dcd316504d64225eb67f69 100644
--- a/ui/app_list/search/dictionary_data_store.cc
+++ b/ui/app_list/search/dictionary_data_store.cc
@@ -67,16 +67,16 @@ scoped_ptr<base::DictionaryValue> DictionaryDataStore::LoadOnBlockingPool() {
int error_code = JSONFileValueDeserializer::JSON_NO_ERROR;
std::string error_message;
JSONFileValueDeserializer deserializer(data_file_);
- base::Value* value = deserializer.Deserialize(&error_code, &error_message);
- base::DictionaryValue* dict_value = NULL;
- if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || !value ||
- !value->GetAsDictionary(&dict_value) || !dict_value) {
+ scoped_ptr<base::DictionaryValue> dict_value = base::DictionaryValue::From(
+ deserializer.Deserialize(&error_code, &error_message));
+ if (error_code != JSONFileValueDeserializer::JSON_NO_ERROR || !dict_value) {
return nullptr;
}
- base::DictionaryValue* return_dict = dict_value->DeepCopy();
- cached_dict_.reset(dict_value);
- return make_scoped_ptr(return_dict);
+ scoped_ptr<base::DictionaryValue> return_dict =
+ make_scoped_ptr(dict_value.get()->DeepCopy());
+ cached_dict_ = dict_value.Pass();
+ return return_dict;
}
bool DictionaryDataStore::SerializeData(std::string* data) {
« no previous file with comments | « rlz/chromeos/lib/rlz_value_store_chromeos.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698