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

Side by Side 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: 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/prefs/pref_service.h" 5 #include "chrome/browser/prefs/pref_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
206 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 20); 206 UMA_HISTOGRAM_ENUMERATION("PrefService.ReadError", error, 20);
207 } 207 }
208 208
209 bool PrefService::ReloadPersistentPrefs() { 209 bool PrefService::ReloadPersistentPrefs() {
210 return user_pref_store_->ReadPrefs() == 210 return user_pref_store_->ReadPrefs() ==
211 PersistentPrefStore::PREF_READ_ERROR_NONE; 211 PersistentPrefStore::PREF_READ_ERROR_NONE;
212 } 212 }
213 213
214 bool PrefService::SavePersistentPrefs() { 214 bool PrefService::SavePersistentPrefs() {
215 DCHECK(CalledOnValidThread()); 215 DCHECK(CalledOnValidThread());
216
217 return user_pref_store_->WritePrefs(); 216 return user_pref_store_->WritePrefs();
218 } 217 }
219 218
220 void PrefService::ScheduleSavePersistentPrefs() { 219 void PrefService::ScheduleSavePersistentPrefs() {
221 DCHECK(CalledOnValidThread()); 220 DCHECK(CalledOnValidThread());
221 user_pref_store_->ScheduleWritePrefs();
222 }
222 223
223 user_pref_store_->ScheduleWritePrefs(); 224 void PrefService::CommitPendingWrite() {
225 DCHECK(CalledOnValidThread());
226 user_pref_store_->CommitPendingWrite();
224 } 227 }
225 228
226 void PrefService::RegisterBooleanPref(const char* path, 229 void PrefService::RegisterBooleanPref(const char* path,
227 bool default_value) { 230 bool default_value) {
228 RegisterPreference(path, Value::CreateBooleanValue(default_value)); 231 RegisterPreference(path, Value::CreateBooleanValue(default_value));
229 } 232 }
230 233
231 void PrefService::RegisterIntegerPref(const char* path, int default_value) { 234 void PrefService::RegisterIntegerPref(const char* path, int default_value) {
232 RegisterPreference(path, Value::CreateIntegerValue(default_value)); 235 RegisterPreference(path, Value::CreateIntegerValue(default_value));
233 } 236 }
(...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after
689 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str()); 692 return pref_value_store()->PrefValueFromDefaultStore(name_.c_str());
690 } 693 }
691 694
692 bool PrefService::Preference::IsUserModifiable() const { 695 bool PrefService::Preference::IsUserModifiable() const {
693 return pref_value_store()->PrefValueUserModifiable(name_.c_str()); 696 return pref_value_store()->PrefValueUserModifiable(name_.c_str());
694 } 697 }
695 698
696 bool PrefService::Preference::IsExtensionModifiable() const { 699 bool PrefService::Preference::IsExtensionModifiable() const {
697 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str()); 700 return pref_value_store()->PrefValueExtensionModifiable(name_.c_str());
698 } 701 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698