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

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

Issue 2474653003: PreferencesManager (Closed)
Patch Set: WmShell Owns PrefObserverStore Created 4 years, 1 month 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
« ash/common/wm_shell.h ('K') | « components/prefs/value_map_pref_store.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5a5f9cb1671cee05034994489f8af7ea0ab80bf0..9e55e897852bc1dd3d196607516e78bbd99c08ee 100644
--- a/services/preferences/public/cpp/pref_observer_store.cc
+++ b/services/preferences/public/cpp/pref_observer_store.cc
@@ -72,7 +72,9 @@ void PrefObserverStore::SetValueSilently(const std::string& key,
ValueMapPrefStore::SetValueSilently(key, std::move(value), flags);
}
-PrefObserverStore::~PrefObserverStore() {}
+PrefObserverStore::~PrefObserverStore() {
+ ClearObservers();
+}
void PrefObserverStore::SetValueOnPreferenceManager(const std::string& key,
const base::Value& value) {
@@ -91,7 +93,12 @@ void PrefObserverStore::OnPreferencesChanged(
if (keys_.find(it.key()) == keys_.end())
continue;
// We deliberately call the parent to avoid notifying the server again.
- ValueMapPrefStore::SetValue(it.key(), it.value().CreateDeepCopy(), 0);
+ if (!initialized_) {
+ ValueMapPrefStore::SetValueSilently(it.key(), it.value().CreateDeepCopy(),
+ 0);
+ } else {
+ ValueMapPrefStore::SetValue(it.key(), it.value().CreateDeepCopy(), 0);
+ }
}
if (!initialized_) {
« ash/common/wm_shell.h ('K') | « components/prefs/value_map_pref_store.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698