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

Unified Diff: services/preferences/public/cpp/pref_observer_store.cc

Issue 2577563002: Add struct traits for base::Value. (Closed)
Patch Set: rebase Created 4 years 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
Index: services/preferences/public/cpp/pref_observer_store.cc
diff --git a/services/preferences/public/cpp/pref_observer_store.cc b/services/preferences/public/cpp/pref_observer_store.cc
index 7bf6f7f2f158c330bae8d220c85a11a06744800e..fac38338cc1e52b0333777d099af287ebae289d9 100644
--- a/services/preferences/public/cpp/pref_observer_store.cc
+++ b/services/preferences/public/cpp/pref_observer_store.cc
@@ -78,14 +78,14 @@ void PrefObserverStore::SetValueOnPreferenceManager(const std::string& key,
if (keys_.find(key) == keys_.end())
return;
- base::DictionaryValue prefs;
- prefs.Set(key, value.CreateDeepCopy());
- prefs_manager_ptr_->SetPreferences(prefs);
+ auto prefs = base::MakeUnique<base::DictionaryValue>();
+ prefs->Set(key, value.CreateDeepCopy());
+ prefs_manager_ptr_->SetPreferences(std::move(prefs));
}
void PrefObserverStore::OnPreferencesChanged(
- const base::DictionaryValue& preferences) {
- for (base::DictionaryValue::Iterator it(preferences); !it.IsAtEnd();
+ std::unique_ptr<base::DictionaryValue> preferences) {
+ for (base::DictionaryValue::Iterator it(*preferences); !it.IsAtEnd();
it.Advance()) {
if (keys_.find(it.key()) == keys_.end())
continue;

Powered by Google App Engine
This is Rietveld 408576698