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

Unified Diff: services/preferences/persistent_pref_store_impl.h

Issue 2767743003: Pref service: Merge connectors and send a PrefRegistry in Connect(). (Closed)
Patch Set: Created 3 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: services/preferences/persistent_pref_store_impl.h
diff --git a/services/preferences/persistent_pref_store_impl.h b/services/preferences/persistent_pref_store_impl.h
index 9b7aeff89adabb1b802046749d659e40e400ae0c..40b2371417b422beecab288742ea0a34b457f81b 100644
--- a/services/preferences/persistent_pref_store_impl.h
+++ b/services/preferences/persistent_pref_store_impl.h
@@ -20,17 +20,24 @@ class Value;
namespace prefs {
-class PersistentPrefStoreImpl : public mojom::PersistentPrefStoreConnector,
- public PrefStore::Observer {
+class PersistentPrefStoreImpl : public PrefStore::Observer {
public:
+ using ConnectCallback =
+ base::Callback<void(mojom::PersistentPrefStoreConfigurationPtr)>;
+
+ // If |initialized()| is false after construction, |on_initialized| will be
+ // called when it becomes true.
PersistentPrefStoreImpl(
scoped_refptr<PersistentPrefStore> backing_pref_store,
- mojom::TrackedPreferenceValidationDelegatePtr validation_delegate);
+ mojom::TrackedPreferenceValidationDelegatePtr validation_delegate,
+ base::Closure on_initialized);
~PersistentPrefStoreImpl() override;
- // mojom::PersistentPrefStoreConnector override:
- void Connect(const ConnectCallback& callback) override;
+ mojom::PersistentPrefStoreConnectionPtr Connect(
+ mojom::PrefRegistryPtr pref_registry);
+
+ bool initialized() { return !initializing_; }
private:
class Connection;
@@ -47,18 +54,17 @@ class PersistentPrefStoreImpl : public mojom::PersistentPrefStoreConnector,
void OnPrefValueChanged(const std::string& key) override;
void OnInitializationCompleted(bool succeeded) override;
- void CallConnectCallback(
- const mojom::PersistentPrefStoreConnector::ConnectCallback& callback);
void OnConnectionError(Connection* connection);
scoped_refptr<PersistentPrefStore> backing_pref_store_;
mojom::TrackedPreferenceValidationDelegatePtr validation_delegate_;
bool initializing_ = false;
- std::vector<ConnectCallback> pending_connect_callbacks_;
std::unordered_map<Connection*, std::unique_ptr<Connection>> connections_;
+ base::Closure on_initialized_;
+
DISALLOW_COPY_AND_ASSIGN(PersistentPrefStoreImpl);
};
« no previous file with comments | « services/preferences/persistent_pref_store_factory.cc ('k') | services/preferences/persistent_pref_store_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698