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

Unified Diff: services/preferences/persistent_pref_store_impl.h

Issue 2771723002: Pref service: Merge PrefStoreConnector interfaces. (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..b57e67be7ef3a4308833ccb5687ca41f39d96d8f 100644
--- a/services/preferences/persistent_pref_store_impl.h
+++ b/services/preferences/persistent_pref_store_impl.h
@@ -20,17 +20,20 @@ class Value;
namespace prefs {
-class PersistentPrefStoreImpl : public mojom::PersistentPrefStoreConnector,
- public PrefStore::Observer {
+class PersistentPrefStoreImpl : public PrefStore::Observer {
public:
+ // 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::OnceClosure on_initialized);
~PersistentPrefStoreImpl() override;
- // mojom::PersistentPrefStoreConnector override:
- void Connect(const ConnectCallback& callback) override;
+ mojom::PersistentPrefStoreConnectionPtr CreateConnection();
+
+ bool initialized() { return !initializing_; }
private:
class Connection;
@@ -47,18 +50,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::OnceClosure 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