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

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

Issue 6713032: Provide lazy CommitPendingWrites in addition to eager SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: for test Created 9 years, 9 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 373a86f55381230ba1761978065a277cb6b56416..0dcf2980ace3b903d49069eae1a60b8f97b1e99b 100644
--- a/chrome/browser/prefs/pref_service.cc
+++ b/chrome/browser/prefs/pref_service.cc
@@ -28,6 +28,7 @@
#include "chrome/common/json_pref_store.h"
#include "content/browser/browser_thread.h"
#include "content/common/notification_service.h"
+#include "content/common/notification_source.h"
#include "grit/chromium_strings.h"
#include "grit/generated_resources.h"
#include "ui/base/l10n/l10n_util.h"
@@ -139,6 +140,7 @@ PrefService::PrefService(PrefStore* managed_platform_prefs,
DefaultPrefStore* default_store)
: user_pref_store_(user_prefs),
default_store_(default_store) {
+ user_pref_store_->SetNotificationSource(Source<PrefService>(this));
pref_notifier_.reset(new PrefNotifierImpl(this));
pref_value_store_.reset(
new PrefValueStore(managed_platform_prefs,
@@ -213,16 +215,19 @@ bool PrefService::ReloadPersistentPrefs() {
bool PrefService::SavePersistentPrefs() {
DCHECK(CalledOnValidThread());
-
return user_pref_store_->WritePrefs();
}
void PrefService::ScheduleSavePersistentPrefs() {
DCHECK(CalledOnValidThread());
-
user_pref_store_->ScheduleWritePrefs();
}
+void PrefService::CommitPendingWrite() {
+ DCHECK(CalledOnValidThread());
+ user_pref_store_->CommitPendingWrite();
+}
+
void PrefService::RegisterBooleanPref(const char* path,
bool default_value) {
RegisterPreference(path, Value::CreateBooleanValue(default_value));

Powered by Google App Engine
This is Rietveld 408576698