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

Side by Side 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, 1 month 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // This provides a way to access the application's current preferences. 5 // This provides a way to access the application's current preferences.
6 6
7 // Chromium settings and storage represent user-selected preferences and 7 // Chromium settings and storage represent user-selected preferences and
8 // information and MUST not be extracted, overwritten or modified except 8 // information and MUST not be extracted, overwritten or modified except
9 // through Chromium defined APIs. 9 // through Chromium defined APIs.
10 10
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 PrefSyncStatus sync_status) OVERRIDE; 176 PrefSyncStatus sync_status) OVERRIDE;
177 virtual void RegisterIntegerPref(const char* path, 177 virtual void RegisterIntegerPref(const char* path,
178 int default_value, 178 int default_value,
179 PrefSyncStatus sync_status) OVERRIDE; 179 PrefSyncStatus sync_status) OVERRIDE;
180 virtual void RegisterDoublePref(const char* path, 180 virtual void RegisterDoublePref(const char* path,
181 double default_value, 181 double default_value,
182 PrefSyncStatus sync_status) OVERRIDE; 182 PrefSyncStatus sync_status) OVERRIDE;
183 virtual void RegisterStringPref(const char* path, 183 virtual void RegisterStringPref(const char* path,
184 const std::string& default_value, 184 const std::string& default_value,
185 PrefSyncStatus sync_status) OVERRIDE; 185 PrefSyncStatus sync_status) OVERRIDE;
186 virtual void RegisterStringPrefIfNew(const char* path,
187 const std::string& default_value,
188 PrefSyncStatus sync_status) OVERRIDE;
186 virtual void RegisterFilePathPref(const char* path, 189 virtual void RegisterFilePathPref(const char* path,
187 const FilePath& default_value, 190 const FilePath& default_value,
188 PrefSyncStatus sync_status) OVERRIDE; 191 PrefSyncStatus sync_status) OVERRIDE;
189 virtual void RegisterListPref(const char* path, 192 virtual void RegisterListPref(const char* path,
190 PrefSyncStatus sync_status) OVERRIDE; 193 PrefSyncStatus sync_status) OVERRIDE;
191 virtual void RegisterDictionaryPref(const char* path, 194 virtual void RegisterDictionaryPref(const char* path,
192 PrefSyncStatus sync_status) OVERRIDE; 195 PrefSyncStatus sync_status) OVERRIDE;
193 virtual void RegisterListPref(const char* path, 196 virtual void RegisterListPref(const char* path,
194 base::ListValue* default_value, 197 base::ListValue* default_value,
195 PrefSyncStatus sync_status) OVERRIDE; 198 PrefSyncStatus sync_status) OVERRIDE;
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 content::NotificationObserver* obs) OVERRIDE; 306 content::NotificationObserver* obs) OVERRIDE;
304 virtual void RemovePrefObserver(const char* path, 307 virtual void RemovePrefObserver(const char* path,
305 content::NotificationObserver* obs) OVERRIDE; 308 content::NotificationObserver* obs) OVERRIDE;
306 309
307 // Sends notification of a changed preference. This needs to be called by 310 // Sends notification of a changed preference. This needs to be called by
308 // a ScopedUserPrefUpdate if a DictionaryValue or ListValue is changed. 311 // a ScopedUserPrefUpdate if a DictionaryValue or ListValue is changed.
309 void ReportUserPrefChanged(const std::string& key); 312 void ReportUserPrefChanged(const std::string& key);
310 313
311 // Registers a new preference at |path|. The |default_value| must not be 314 // Registers a new preference at |path|. The |default_value| must not be
312 // NULL as it determines the preference value's type. 315 // NULL as it determines the preference value's type.
316 // This will only be called once we have checked that the preference is new.
317 // RegisterNewPreference must not be called twice for the same path.
318 // This method takes ownership of |default_value|.
319 void RegisterNewPreference(const char* path,
320 Value* default_value,
321 PrefSyncStatus sync_status);
322
323 // Registers a new preference at |path|. The |default_value| must not be
324 // NULL as it determines the preference value's type.
313 // RegisterPreference must not be called twice for the same path. 325 // RegisterPreference must not be called twice for the same path.
314 // This method takes ownership of |default_value|. 326 // This method takes ownership of |default_value|.
315 void RegisterPreference(const char* path, 327 void RegisterPreference(const char* path,
316 base::Value* default_value, 328 base::Value* default_value,
317 PrefSyncStatus sync_status); 329 PrefSyncStatus sync_status);
318 330
331 // Registers a preference at |path|. The |default_value| must not be
332 // NULL as it determines the preference value's type.
333 // This does nothing if the preference is already registered.
334 // This method takes ownership of |default_value|.
335 // Introduced to improve performance by avoiding the need for a check before
336 // calling RegisterPreference.
337 void RegisterPreferenceIfNew(const char* path,
338 base::Value* default_value,
339 PrefSyncStatus sync_status);
340
319 // Sets the value for this pref path in the user pref store and informs the 341 // Sets the value for this pref path in the user pref store and informs the
320 // PrefNotifier of the change. 342 // PrefNotifier of the change.
321 void SetUserPrefValue(const char* path, base::Value* new_value); 343 void SetUserPrefValue(const char* path, base::Value* new_value);
322 344
323 // Load preferences from storage, attempting to diagnose and handle errors. 345 // Load preferences from storage, attempting to diagnose and handle errors.
324 // This should only be called from the constructor. 346 // This should only be called from the constructor.
325 void InitFromStorage(bool async); 347 void InitFromStorage(bool async);
326 348
327 // Used to set the value of dictionary or list values in the user pref store. 349 // Used to set the value of dictionary or list values in the user pref store.
328 // This will create a dictionary or list if one does not exist in the user 350 // This will create a dictionary or list if one does not exist in the user
(...skipping 25 matching lines...) Expand all
354 // CreatePrefServiceWithPerTabPrefStore() have been called to create a 376 // CreatePrefServiceWithPerTabPrefStore() have been called to create a
355 // "forked" PrefService. 377 // "forked" PrefService.
356 bool pref_service_forked_; 378 bool pref_service_forked_;
357 379
358 ObserverList<PrefServiceObserver> observer_list_; 380 ObserverList<PrefServiceObserver> observer_list_;
359 381
360 DISALLOW_COPY_AND_ASSIGN(PrefService); 382 DISALLOW_COPY_AND_ASSIGN(PrefService);
361 }; 383 };
362 384
363 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_ 385 #endif // CHROME_BROWSER_PREFS_PREF_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698