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..19d608efc8131d3d89f0b6f13f2da8e205599881 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) { |
@@ -86,16 +88,15 @@ void PrefObserverStore::SetValueOnPreferenceManager(const std::string& key, |
void PrefObserverStore::OnPreferencesChanged( |
const base::DictionaryValue& preferences) { |
+ if (!initialized_) { |
+ initialized_ = true; |
+ NotifyInitializationCompleted(); |
+ } |
+ |
for (base::DictionaryValue::Iterator it(preferences); !it.IsAtEnd(); |
it.Advance()) { |
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_) { |
- initialized_ = true; |
- NotifyInitializationCompleted(); |
- } |
} |