OLD | NEW |
1 // Copyright 2017 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "services/preferences/pref_store_manager_impl.h" | 5 #include "services/preferences/pref_store_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/threading/sequenced_worker_pool.h" | 12 #include "base/threading/sequenced_worker_pool.h" |
13 #include "components/prefs/default_pref_store.h" | 13 #include "components/prefs/default_pref_store.h" |
14 #include "components/prefs/pref_value_store.h" | 14 #include "components/prefs/pref_value_store.h" |
15 #include "mojo/public/cpp/bindings/interface_request.h" | 15 #include "mojo/public/cpp/bindings/interface_request.h" |
16 #include "services/preferences/persistent_pref_store_factory.h" | 16 #include "services/preferences/persistent_pref_store_factory.h" |
17 #include "services/preferences/persistent_pref_store_impl.h" | 17 #include "services/preferences/persistent_pref_store_impl.h" |
18 #include "services/preferences/public/cpp/pref_store_impl.h" | 18 #include "services/preferences/public/cpp/pref_store_impl.h" |
19 #include "services/service_manager/public/cpp/service_info.h" | 19 #include "services/service_manager/public/cpp/bind_source_info.h" |
20 | 20 |
21 namespace prefs { | 21 namespace prefs { |
22 namespace { | 22 namespace { |
23 | 23 |
24 using ConnectCallback = mojom::PrefStoreConnector::ConnectCallback; | 24 using ConnectCallback = mojom::PrefStoreConnector::ConnectCallback; |
25 using PrefStorePtrs = | 25 using PrefStorePtrs = |
26 std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStore*>; | 26 std::unordered_map<PrefValueStore::PrefStoreType, mojom::PrefStore*>; |
27 | 27 |
28 // Used to make sure all pref stores have been registered before replying to any | 28 // Used to make sure all pref stores have been registered before replying to any |
29 // Connect calls. | 29 // Connect calls. |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 base::Bind(&PrefStoreManagerImpl::OnPersistentPrefStoreReady, | 205 base::Bind(&PrefStoreManagerImpl::OnPersistentPrefStoreReady, |
206 base::Unretained(this))); | 206 base::Unretained(this))); |
207 DCHECK(persistent_pref_store_); | 207 DCHECK(persistent_pref_store_); |
208 if (AllConnected()) | 208 if (AllConnected()) |
209 ProcessPendingConnects(); | 209 ProcessPendingConnects(); |
210 } | 210 } |
211 | 211 |
212 void PrefStoreManagerImpl::OnStart() {} | 212 void PrefStoreManagerImpl::OnStart() {} |
213 | 213 |
214 void PrefStoreManagerImpl::OnBindInterface( | 214 void PrefStoreManagerImpl::OnBindInterface( |
215 const service_manager::ServiceInfo& source_info, | 215 const service_manager::BindSourceInfo& source_info, |
216 const std::string& interface_name, | 216 const std::string& interface_name, |
217 mojo::ScopedMessagePipeHandle interface_pipe) { | 217 mojo::ScopedMessagePipeHandle interface_pipe) { |
218 registry_.BindInterface(source_info.identity, interface_name, | 218 registry_.BindInterface(source_info.identity, interface_name, |
219 std::move(interface_pipe)); | 219 std::move(interface_pipe)); |
220 } | 220 } |
221 | 221 |
222 void PrefStoreManagerImpl::OnPrefStoreDisconnect( | 222 void PrefStoreManagerImpl::OnPrefStoreDisconnect( |
223 PrefValueStore::PrefStoreType type) { | 223 PrefValueStore::PrefStoreType type) { |
224 DVLOG(1) << "Deregistering pref store: " << type; | 224 DVLOG(1) << "Deregistering pref store: " << type; |
225 pref_store_ptrs_.erase(type); | 225 pref_store_ptrs_.erase(type); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 } | 271 } |
272 | 272 |
273 void PrefStoreManagerImpl::OnPersistentPrefStoreReady() { | 273 void PrefStoreManagerImpl::OnPersistentPrefStoreReady() { |
274 DVLOG(1) << "PersistentPrefStore ready"; | 274 DVLOG(1) << "PersistentPrefStore ready"; |
275 if (AllConnected()) { | 275 if (AllConnected()) { |
276 ProcessPendingConnects(); | 276 ProcessPendingConnects(); |
277 } | 277 } |
278 } | 278 } |
279 | 279 |
280 } // namespace prefs | 280 } // namespace prefs |
OLD | NEW |