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

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

Issue 6894020: Adds async interface method to PersistentPrefStore. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 2010->2011 Created 9 years, 7 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
« no previous file with comments | « chrome/browser/prefs/pref_notifier_impl_unittest.cc ('k') | chrome/browser/prefs/pref_service.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/prefs/pref_service.h
diff --git a/chrome/browser/prefs/pref_service.h b/chrome/browser/prefs/pref_service.h
index 3990d5a96e1d9294cac89ca434e67daf41fcc58b..0a98c4cab7434ede36b0e3e26159019329ce9789 100644
--- a/chrome/browser/prefs/pref_service.h
+++ b/chrome/browser/prefs/pref_service.h
@@ -36,13 +36,7 @@ class ScopedUserPrefUpdateBase;
class PrefService;
-class PrefServiceDelegate {
- public:
- virtual void OnPrefsLoaded(PrefService* prefs, bool success) = 0;
-};
-
-class PrefService : public base::NonThreadSafe,
- public JsonPrefStore::Delegate {
+class PrefService : public base::NonThreadSafe {
public:
// Enum used when registering preferences to determine if it should be synced
// or not. This is only used for profile prefs, not local state prefs.
@@ -129,26 +123,21 @@ class PrefService : public base::NonThreadSafe,
DISALLOW_COPY_AND_ASSIGN(Preference);
};
- // JsonPrefStore::Delegate implementaion.
- virtual void OnPrefsRead(PersistentPrefStore::PrefReadError error,
- bool no_dir);
-
// Factory method that creates a new instance of a PrefService with the
// applicable PrefStores. The |pref_filename| points to the user preference
// file. The |profile| is the one to which these preferences apply; it may be
// NULL if we're dealing with the local state. This is the usual way to create
// a new PrefService. |extension_pref_store| is used as the source for
// extension-controlled preferences and may be NULL. The PrefService takes
- // ownership of |extension_pref_store|.
+ // ownership of |extension_pref_store|. If |async| is true, asynchronous
+ // version is used. Notifies using PREF_INITIALIZATION_COMPLETED in the end.
+ // Details is set to the created PrefService or NULL if creation has failed.
+ // Note, it is guaranteed that in asynchronous version initialization happens
+ // after this function returned.
static PrefService* CreatePrefService(const FilePath& pref_filename,
PrefStore* extension_pref_store,
- Profile* profile);
-
- // Same as above, but with async initialization.
- static PrefService* CreatePrefServiceAsync(const FilePath& pref_filename,
- PrefStore* extension_pref_store,
- Profile* profile,
- PrefServiceDelegate* delegate);
+ Profile* profile,
+ bool async);
// Creates an incognito copy of the pref service that shares most pref stores
// but uses a fresh non-persistent overlay for the user pref store and an
@@ -316,7 +305,7 @@ class PrefService : public base::NonThreadSafe,
PrefStore* recommended_platform_prefs,
PrefStore* recommended_cloud_prefs,
DefaultPrefStore* default_store,
- PrefServiceDelegate* delegate);
+ bool async);
// The PrefNotifier handles registering and notifying preference observers.
// It is created and owned by this PrefService. Subclasses may access it for
@@ -376,7 +365,7 @@ class PrefService : public base::NonThreadSafe,
// Load preferences from storage, attempting to diagnose and handle errors.
// This should only be called from the constructor.
- void InitFromStorage();
+ void InitFromStorage(bool async);
// Used to set the value of dictionary or list values in the user pref store.
// This will create a dictionary or list if one does not exist in the user
@@ -400,10 +389,6 @@ class PrefService : public base::NonThreadSafe,
// of registered preferences are.
mutable PreferenceSet prefs_;
- // Holds delegator to be called after initialization, if async version
- // is used.
- PrefServiceDelegate* delegate_;
-
// The model associator that maintains the links with the sync db.
scoped_ptr<PrefModelAssociator> pref_sync_associator_;
« no previous file with comments | « chrome/browser/prefs/pref_notifier_impl_unittest.cc ('k') | chrome/browser/prefs/pref_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698