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

Unified Diff: chrome/browser/prefs/pref_notifier_impl.cc

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use Notifications. Created 9 years, 8 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
Index: chrome/browser/prefs/pref_notifier_impl.cc
diff --git a/chrome/browser/prefs/pref_notifier_impl.cc b/chrome/browser/prefs/pref_notifier_impl.cc
index d5ad24c94338f2748ed19ca59291095f808a608b..a18b9d19b6a02e72922ac1cbb406370103de46db 100644
--- a/chrome/browser/prefs/pref_notifier_impl.cc
+++ b/chrome/browser/prefs/pref_notifier_impl.cc
@@ -75,14 +75,38 @@ void PrefNotifierImpl::OnPreferenceChanged(const std::string& path) {
}
void PrefNotifierImpl::OnInitializationCompleted() {
- DCHECK(CalledOnValidThread());
+ pref_notifier_ready_ = true;
+ NotifyInitializationCompleted();
+}
+
+void PrefNotifierImpl::OnPersistentPrefsRead(bool success) {
Mattias Nissler (ping if slow) 2011/04/27 12:16:30 We should really get this trigger through OnInitia
altimofeev 2011/05/04 13:46:14 Done.
+ if (!success) {
+ NotifyInitializationFailed();
+ return;
+ }
+ persistent_prefs_ready_ = true;
+ NotifyInitializationCompleted();
+}
+
+void PrefNotifierImpl::NotifyInitializationCompleted() {
+ if (!pref_notifier_ready_ || !persistent_prefs_ready_)
+ return;
+ DCHECK(CalledOnValidThread());
NotificationService::current()->Notify(
NotificationType::PREF_INITIALIZATION_COMPLETED,
Source<PrefService>(pref_service_),
NotificationService::NoDetails());
}
+void PrefNotifierImpl::NotifyInitializationFailed() {
Mattias Nissler (ping if slow) 2011/04/27 12:16:30 We shouldn't have a second notification, but rathe
altimofeev 2011/05/04 13:46:14 Done.
+ DCHECK(CalledOnValidThread());
+ NotificationService::current()->Notify(
+ NotificationType::PREF_INITIALIZATION_FAILED,
+ Source<PrefService>(pref_service_),
+ NotificationService::NoDetails());
+}
+
void PrefNotifierImpl::FireObservers(const std::string& path) {
DCHECK(CalledOnValidThread());

Powered by Google App Engine
This is Rietveld 408576698