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

Unified Diff: chrome/common/json_pref_store.cc

Issue 6713032: Provide lazy CommitPendingWrites in addition to eager SavePersistentPrefs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rename less confusing 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/common/json_pref_store.cc
diff --git a/chrome/common/json_pref_store.cc b/chrome/common/json_pref_store.cc
index b6e76c9670bd84fce931fd3bdb929ed565f4c132..c7ce0810b7804ed9626d22b5c486f0d71346fa23 100644
--- a/chrome/common/json_pref_store.cc
+++ b/chrome/common/json_pref_store.cc
@@ -26,8 +26,7 @@ JsonPrefStore::JsonPrefStore(const FilePath& filename,
}
JsonPrefStore::~JsonPrefStore() {
- if (writer_.HasPendingWrite() && !read_only_)
- writer_.DoScheduledWrite();
+ CommitPendingWrites();
}
PrefStore::ReadResult JsonPrefStore::GetValue(const std::string& key,
@@ -159,6 +158,11 @@ void JsonPrefStore::ScheduleWritePrefs() {
writer_.ScheduleWrite(this);
}
+void JsonPrefStore::CommitPendingWrites() {
+ if (writer_.HasPendingWrite() && !read_only_)
+ writer_.DoScheduledWrite();
+}
+
void JsonPrefStore::ReportValueChanged(const std::string& key) {
FOR_EACH_OBSERVER(PrefStore::Observer, observers_, OnPrefValueChanged(key));
}

Powered by Google App Engine
This is Rietveld 408576698