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

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

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: always call OnInit.. 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_service.cc
diff --git a/chrome/browser/prefs/pref_service.cc b/chrome/browser/prefs/pref_service.cc
index 9071f24898abe56a4e2f85186565ff74c218e880..beb4841d8619659b1e9fd1072420cdfed3d9d030 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -194,9 +194,15 @@ PrefService::~PrefService() {
default_store_ = NULL;
}
-void PrefService::OnPrefsRead(PersistentPrefStore::PrefReadError error,
- bool no_dir) {
- if (no_dir) {
+void PrefService::OnInitializationCompleted() {
Mattias Nissler (ping if slow) 2011/04/26 09:04:26 If we use the PREF_INITIALIZATION_COMPLETED notifi
altimofeev 2011/04/27 10:32:08 I have leaved "PrefStore::Observer" here, because
Mattias Nissler (ping if slow) 2011/04/27 12:16:30 Yes, PrefNotifier already has OnInitializationComp
+ // This is the only message PrefService is waiting for, so remove us from the
+ // observers list.
+ user_pref_store_->RemoveObserver(this);
+
+ PersistentPrefStore::PrefReadError error;
+ bool is_fatal;
+ user_pref_store_->GetErrors(&error, &is_fatal);
Bernhard Bauer 2011/04/25 15:54:10 Could you pass these values directly to OnInitiali
altimofeev 2011/04/27 10:32:08 The problem is that "OnInitializationCompleted" is
Bernhard Bauer 2011/04/27 10:52:16 I think passing (PREF_READ_ERROR_NONE, false) at t
Mattias Nissler (ping if slow) 2011/04/27 12:16:30 I think passing the parameters makes sense. At the
+ if (is_fatal) {
// Bad news. When profile is created, the process that creates the directory
// is explicitly started. So if directory is missing it probably means that
// Chromium hasn't sufficient privileges.
@@ -228,13 +234,11 @@ void PrefService::OnPrefsRead(PersistentPrefStore::PrefReadError error,
}
void PrefService::InitFromStorage() {
+ user_pref_store_->AddObserver(this);
if (!delegate_) {
- const PersistentPrefStore::PrefReadError error =
- user_pref_store_->ReadPrefs();
- OnPrefsRead(error, false);
+ user_pref_store_->ReadPrefs();
} else {
- // todo(altimofeev): move this method to PersistentPrefStore interface.
- (static_cast<JsonPrefStore*>(user_pref_store_.get()))->ReadPrefs(this);
+ user_pref_store_.get()->ReadPrefsAsync();
}
}

Powered by Google App Engine
This is Rietveld 408576698