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

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

Issue 11307005: Improve performance of registering font preferences (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Removed redundant enum, left over from earlier version of code. Created 8 years, 2 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.h
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index 94dc0f077caa1b6be042674be5d5472864f12f6b..e3237711e4e946cd9762865919a4e3aae700c466 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -183,6 +183,9 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
virtual void RegisterStringPref(const char* path,
const std::string& default_value,
PrefSyncStatus sync_status) OVERRIDE;
+ virtual void RegisterStringPrefIfNew(const char* path,
+ const std::string& default_value,
+ PrefSyncStatus sync_status) OVERRIDE;
virtual void RegisterFilePathPref(const char* path,
const FilePath& default_value,
PrefSyncStatus sync_status) OVERRIDE;
@@ -310,12 +313,31 @@ class PrefService : public PrefServiceBase, public base::NonThreadSafe {
// Registers a new preference at |path|. The |default_value| must not be
// NULL as it determines the preference value's type.
+ // This will only be called once we have checked that the preference is new.
+ // RegisterNewPreference must not be called twice for the same path.
+ // This method takes ownership of |default_value|.
+ void RegisterNewPreference(const char* path,
+ Value* default_value,
+ PrefSyncStatus sync_status);
+
+ // Registers a new preference at |path|. The |default_value| must not be
+ // NULL as it determines the preference value's type.
// RegisterPreference must not be called twice for the same path.
// This method takes ownership of |default_value|.
void RegisterPreference(const char* path,
base::Value* default_value,
PrefSyncStatus sync_status);
+ // Registers a preference at |path|. The |default_value| must not be
+ // NULL as it determines the preference value's type.
+ // This does nothing if the preference is already registered.
+ // This method takes ownership of |default_value|.
+ // Introduced to improve performance by avoiding the need for a check before
+ // calling RegisterPreference.
+ void RegisterPreferenceIfNew(const char* path,
+ base::Value* default_value,
+ PrefSyncStatus sync_status);
+
// Sets the value for this pref path in the user pref store and informs the
// PrefNotifier of the change.
void SetUserPrefValue(const char* path, base::Value* new_value);

Powered by Google App Engine
This is Rietveld 408576698