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

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: removed notification + rebase 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..d20d05b7404614fb27052b5100d84e6d5262695d 100644
--- a/chrome/common/json_pref_store.cc
+++ b/chrome/common/json_pref_store.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -26,8 +26,7 @@ JsonPrefStore::JsonPrefStore(const FilePath& filename,
}
JsonPrefStore::~JsonPrefStore() {
- if (writer_.HasPendingWrite() && !read_only_)
- writer_.DoScheduledWrite();
+ CommitPendingWrite();
}
PrefStore::ReadResult JsonPrefStore::GetValue(const std::string& key,
@@ -159,6 +158,11 @@ void JsonPrefStore::ScheduleWritePrefs() {
writer_.ScheduleWrite(this);
}
+void JsonPrefStore::CommitPendingWrite() {
+ 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