| 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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 75 if (connections_.size() == expected_connections_) { | 75 if (connections_.size() == expected_connections_) { |
| 76 // After this method exits |this| will get destroyed so it's safe to move | 76 // After this method exits |this| will get destroyed so it's safe to move |
| 77 // out the map. | 77 // out the map. |
| 78 callback_.Run(std::move(connections_)); | 78 callback_.Run(std::move(connections_)); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 } // namespace | 82 } // namespace |
| 83 | 83 |
| 84 PrefStoreManagerImpl::PrefStoreManagerImpl( | 84 PrefStoreManagerImpl::PrefStoreManagerImpl( |
| 85 PrefStoreTypes expected_pref_stores, | 85 std::set<PrefValueStore::PrefStoreType> expected_pref_stores, |
| 86 scoped_refptr<base::SequencedWorkerPool> worker_pool) | 86 scoped_refptr<base::SequencedWorkerPool> worker_pool) |
| 87 : expected_pref_stores_(std::move(expected_pref_stores)), | 87 : expected_pref_stores_(std::move(expected_pref_stores)), |
| 88 init_binding_(this), | 88 init_binding_(this), |
| 89 worker_pool_(std::move(worker_pool)) {} | 89 worker_pool_(std::move(worker_pool)) {} |
| 90 | 90 |
| 91 PrefStoreManagerImpl::~PrefStoreManagerImpl() = default; | 91 PrefStoreManagerImpl::~PrefStoreManagerImpl() = default; |
| 92 | 92 |
| 93 void PrefStoreManagerImpl::Register(PrefValueStore::PrefStoreType type, | 93 void PrefStoreManagerImpl::Register(PrefValueStore::PrefStoreType type, |
| 94 mojom::PrefStorePtr pref_store_ptr) { | 94 mojom::PrefStorePtr pref_store_ptr) { |
| 95 if (expected_pref_stores_.count(type) == 0) { | 95 if (expected_pref_stores_.count(type) == 0) { |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 185 PrefValueStore::PrefStoreType type) { | 185 PrefValueStore::PrefStoreType type) { |
| 186 DVLOG(1) << "Deregistering pref store: " << type; | 186 DVLOG(1) << "Deregistering pref store: " << type; |
| 187 pref_store_ptrs_.erase(type); | 187 pref_store_ptrs_.erase(type); |
| 188 } | 188 } |
| 189 | 189 |
| 190 bool PrefStoreManagerImpl::AllConnected() const { | 190 bool PrefStoreManagerImpl::AllConnected() const { |
| 191 return pref_store_ptrs_.size() == expected_pref_stores_.size(); | 191 return pref_store_ptrs_.size() == expected_pref_stores_.size(); |
| 192 } | 192 } |
| 193 | 193 |
| 194 } // namespace prefs | 194 } // namespace prefs |
| OLD | NEW |