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

Unified Diff: services/preferences/pref_store_manager_impl.h

Issue 2791903003: Pref service: have Mash and Chrome connect to the right pref stores (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/pref_store_manager_impl.h
diff --git a/services/preferences/pref_store_manager_impl.h b/services/preferences/pref_store_manager_impl.h
index 2a7822023e137ab06790d10394012658ba06e38e..487a88511992d69ff6e6b591a962c98493f79854 100644
--- a/services/preferences/pref_store_manager_impl.h
+++ b/services/preferences/pref_store_manager_impl.h
@@ -50,16 +50,30 @@ class PrefStoreManagerImpl
~PrefStoreManagerImpl() override;
private:
- using PrefStorePtrs =
- std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStorePtr>;
+ struct PendingConnect {
Sam McNally 2017/04/03 10:09:31 Could this be defined in the .cc file?
tibell 2017/04/04 04:05:59 Done.
+ PendingConnect(
+ mojom::PrefRegistryPtr pref_registry_in,
+ std::vector<PrefValueStore::PrefStoreType> already_connected_types_in,
+ const ConnectCallback& callback_in);
+ PendingConnect(PendingConnect&& other);
+ ~PendingConnect();
+
+ mojom::PrefRegistryPtr pref_registry;
+ // Pref stores the caller already is connected to (and hence we won't
+ // connect to these).
+ std::vector<PrefValueStore::PrefStoreType> already_connected_types;
+ ConnectCallback callback;
+ };
// mojom::PrefStoreRegistry:
void Register(PrefValueStore::PrefStoreType type,
mojom::PrefStorePtr pref_store_ptr) override;
// mojom::PrefStoreConnector:
- void Connect(mojom::PrefRegistryPtr pref_registry,
- const ConnectCallback& callback) override;
+ void Connect(
+ mojom::PrefRegistryPtr pref_registry,
+ const std::vector<PrefValueStore::PrefStoreType>& already_connected_types,
+ const ConnectCallback& callback) override;
// service_manager::InterfaceFactory<PrefStoreConnector>:
void Create(const service_manager::Identity& remote_identity,
@@ -89,8 +103,10 @@ class PrefStoreManagerImpl
void ProcessPendingConnects();
- void ConnectImpl(mojom::PrefRegistryPtr pref_registry,
- const ConnectCallback& callback);
+ void ConnectImpl(
+ mojom::PrefRegistryPtr pref_registry,
+ const std::vector<PrefValueStore::PrefStoreType>& already_connected_types,
+ const ConnectCallback& callback);
void OnPersistentPrefStoreReady();
@@ -98,12 +114,12 @@ class PrefStoreManagerImpl
std::set<PrefValueStore::PrefStoreType> expected_pref_stores_;
// Registered pref stores.
- PrefStorePtrs pref_store_ptrs_;
+ std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStorePtr>
+ pref_store_ptrs_;
// We hold on to the connection request callbacks until all expected
// PrefStores have registered.
- std::vector<std::pair<ConnectCallback, mojom::PrefRegistryPtr>>
- pending_connects_;
+ std::vector<PendingConnect> pending_connects_;
mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_;
mojo::BindingSet<mojom::PrefStoreRegistry> registry_bindings_;

Powered by Google App Engine
This is Rietveld 408576698