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

Side by Side Diff: services/preferences/public/cpp/pref_store_manager_impl.h

Issue 2706383002: DO NOT SUBMIT: Show silent service manager failure (Closed)
Patch Set: Created 3 years, 10 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_MANAGER_IMPL_H_
6 #define SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_MANAGER_IMPL_H_
7
8 #include "base/compiler_specific.h"
9 #include "base/macros.h"
10 #include "base/memory/ref_counted.h"
11 #include "components/prefs/pref_value_store.h"
12 #include "mojo/public/cpp/bindings/binding_set.h"
13 #include "services/preferences/public/interfaces/preferences.mojom.h"
14 #include "services/service_manager/public/cpp/interface_factory.h"
15 #include "services/service_manager/public/cpp/service.h"
16
17 namespace prefs {
18
19 // This class mediates the connection of clients who wants to read preferences
20 // and the pref stores that store those preferences. Pref stores use the
21 // |PrefStoreRegistry| interface to register themselves with the manager and
22 // clients use the |PrefStoreConnector| interface to connect to these stores.
23 class PrefStoreManagerImpl
24 : public NON_EXPORTED_BASE(mojom::PrefStoreRegistry),
25 public NON_EXPORTED_BASE(mojom::PrefStoreConnector),
26 public NON_EXPORTED_BASE(
27 service_manager::InterfaceFactory<mojom::PrefStoreConnector>),
28 public NON_EXPORTED_BASE(
29 service_manager::InterfaceFactory<mojom::PrefStoreRegistry>),
30 public NON_EXPORTED_BASE(service_manager::Service) {
31 public:
32 PrefStoreManagerImpl();
33 ~PrefStoreManagerImpl() override;
34
35 private:
36 // mojom::PrefStoreRegistry:
37 void Register(mojom::PrefStorePtr pref_store_ptr,
38 PrefValueStore::PrefStoreType) override;
39
40 // mojom::PrefStoreConnector:
41 void Connect(const ConnectCallback& callback) override;
42
43 // service_manager::InterfaceFactory<PrefStoreConnector>:
44 void Create(const service_manager::Identity& remote_identity,
45 prefs::mojom::PrefStoreConnectorRequest request) override;
46
47 // service_manager::InterfaceFactory<PrefStoreRegistry>:
48 void Create(const service_manager::Identity& remote_identity,
49 prefs::mojom::PrefStoreRegistryRequest request) override;
50
51 // service_manager::Service:
52 void OnStart() override;
53 bool OnConnect(const service_manager::ServiceInfo& remote_info,
54 service_manager::InterfaceRegistry* registry) override;
55
56 // Have all the expected PrefStores connected?
57 bool AllConnected() const;
58
59 using PrefStorePtrs =
60 std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStorePtr>;
61
62 class ConnectionBarrier;
63
64 // Registered pref stores.
65 PrefStorePtrs pref_store_ptrs_;
66
67 mojo::BindingSet<mojom::PrefStoreConnector> connector_bindings_;
68 mojo::BindingSet<mojom::PrefStoreRegistry> registry_bindings_;
69
70 // We hold on to the connection request callbacks until all expected
71 // PrefStores have registered.
72 std::vector<ConnectCallback> pending_callbacks_;
73
74 DISALLOW_COPY_AND_ASSIGN(PrefStoreManagerImpl);
75 };
76
77 } // namespace prefs
78
79 #endif // SERVICES_PREFERENCES_PUBLIC_CPP_PREF_STORE_MANAGER_IMPL_H_
OLDNEW
« no previous file with comments | « services/preferences/public/cpp/pref_store_impl.cc ('k') | services/preferences/public/cpp/pref_store_manager_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698