| 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/public/cpp/pref_store_manager_impl.h" | 5 #include "services/preferences/pref_store_manager_impl.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
| 10 #include "base/threading/sequenced_worker_pool.h" | 10 #include "base/threading/sequenced_worker_pool.h" |
| 11 #include "components/prefs/pref_value_store.h" | 11 #include "components/prefs/pref_value_store.h" |
| 12 #include "mojo/public/cpp/bindings/interface_request.h" | 12 #include "mojo/public/cpp/bindings/interface_request.h" |
| 13 #include "services/preferences/persistent_pref_store_factory.h" | 13 #include "services/preferences/persistent_pref_store_factory.h" |
| 14 #include "services/preferences/persistent_pref_store_impl.h" | 14 #include "services/preferences/persistent_pref_store_impl.h" |
| 15 #include "services/service_manager/public/cpp/interface_registry.h" | 15 #include "services/service_manager/public/cpp/interface_registry.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 if (connections_.size() == expected_connections_) { | 81 if (connections_.size() == expected_connections_) { |
| 82 // After this method exits |this| will get destroyed so it's safe to move | 82 // After this method exits |this| will get destroyed so it's safe to move |
| 83 // out the map. | 83 // out the map. |
| 84 callback_.Run(std::move(connections_)); | 84 callback_.Run(std::move(connections_)); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 | 87 |
| 88 } // namespace | 88 } // namespace |
| 89 | 89 |
| 90 PrefStoreManagerImpl::PrefStoreManagerImpl( | 90 PrefStoreManagerImpl::PrefStoreManagerImpl( |
| 91 PrefStoreTypes expected_pref_stores, | 91 std::set<PrefValueStore::PrefStoreType> expected_pref_stores, |
| 92 scoped_refptr<base::SequencedWorkerPool> worker_pool) | 92 scoped_refptr<base::SequencedWorkerPool> worker_pool) |
| 93 : expected_pref_stores_(std::move(expected_pref_stores)), | 93 : expected_pref_stores_(std::move(expected_pref_stores)), |
| 94 init_binding_(this), | 94 init_binding_(this), |
| 95 worker_pool_(std::move(worker_pool)) {} | 95 worker_pool_(std::move(worker_pool)) {} |
| 96 | 96 |
| 97 PrefStoreManagerImpl::~PrefStoreManagerImpl() = default; | 97 PrefStoreManagerImpl::~PrefStoreManagerImpl() = default; |
| 98 | 98 |
| 99 void PrefStoreManagerImpl::Register(PrefValueStore::PrefStoreType type, | 99 void PrefStoreManagerImpl::Register(PrefValueStore::PrefStoreType type, |
| 100 mojom::PrefStorePtr pref_store_ptr) { | 100 mojom::PrefStorePtr pref_store_ptr) { |
| 101 if (expected_pref_stores_.count(type) == 0) { | 101 if (expected_pref_stores_.count(type) == 0) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 PrefValueStore::PrefStoreType type) { | 191 PrefValueStore::PrefStoreType type) { |
| 192 DVLOG(1) << "Deregistering pref store: " << type; | 192 DVLOG(1) << "Deregistering pref store: " << type; |
| 193 pref_store_ptrs_.erase(type); | 193 pref_store_ptrs_.erase(type); |
| 194 } | 194 } |
| 195 | 195 |
| 196 bool PrefStoreManagerImpl::AllConnected() const { | 196 bool PrefStoreManagerImpl::AllConnected() const { |
| 197 return pref_store_ptrs_.size() == expected_pref_stores_.size(); | 197 return pref_store_ptrs_.size() == expected_pref_stores_.size(); |
| 198 } | 198 } |
| 199 | 199 |
| 200 } // namespace prefs | 200 } // namespace prefs |
| OLD | NEW |