| 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/persistent_pref_store_factory.h" | 5 #include "services/preferences/persistent_pref_store_factory.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "components/prefs/json_pref_store.h" | 10 #include "components/prefs/json_pref_store.h" |
| 11 #include "components/prefs/pref_filter.h" | 11 #include "components/prefs/pref_filter.h" |
| 12 #include "services/preferences/persistent_pref_store_impl.h" | 12 #include "services/preferences/persistent_pref_store_impl.h" |
| 13 | 13 |
| 14 namespace prefs { | 14 namespace prefs { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 std::unique_ptr<PersistentPrefStoreImpl> CreateSimplePersistentPrefStore( | 17 std::unique_ptr<PersistentPrefStoreImpl> CreateSimplePersistentPrefStore( |
| 18 mojom::SimplePersistentPrefStoreConfigurationPtr config, | 18 mojom::SimplePersistentPrefStoreConfigurationPtr config, |
| 19 base::SequencedWorkerPool* worker_pool) { | 19 base::SequencedWorkerPool* worker_pool, |
| 20 base::Closure on_initialized) { |
| 20 return base::MakeUnique<PersistentPrefStoreImpl>( | 21 return base::MakeUnique<PersistentPrefStoreImpl>( |
| 21 new JsonPrefStore(config->pref_filename, | 22 new JsonPrefStore(config->pref_filename, |
| 22 JsonPrefStore::GetTaskRunnerForFile( | 23 JsonPrefStore::GetTaskRunnerForFile( |
| 23 config->pref_filename.DirName(), worker_pool), | 24 config->pref_filename.DirName(), worker_pool), |
| 24 nullptr), | 25 nullptr), |
| 25 nullptr); | 26 nullptr, std::move(on_initialized)); |
| 26 } | 27 } |
| 27 | 28 |
| 28 } // namespace | 29 } // namespace |
| 29 | 30 |
| 30 std::unique_ptr<PersistentPrefStoreImpl> CreatePersistentPrefStore( | 31 std::unique_ptr<PersistentPrefStoreImpl> CreatePersistentPrefStore( |
| 31 mojom::PersistentPrefStoreConfigurationPtr configuration, | 32 mojom::PersistentPrefStoreConfigurationPtr configuration, |
| 32 base::SequencedWorkerPool* worker_pool) { | 33 base::SequencedWorkerPool* worker_pool, |
| 34 base::Closure on_initialized) { |
| 33 if (configuration->is_simple_configuration()) { | 35 if (configuration->is_simple_configuration()) { |
| 34 return CreateSimplePersistentPrefStore( | 36 return CreateSimplePersistentPrefStore( |
| 35 std::move(configuration->get_simple_configuration()), worker_pool); | 37 std::move(configuration->get_simple_configuration()), worker_pool, |
| 38 std::move(on_initialized)); |
| 36 } | 39 } |
| 37 NOTREACHED(); | 40 NOTREACHED(); |
| 38 return nullptr; | 41 return nullptr; |
| 39 } | 42 } |
| 40 | 43 |
| 41 } // namespace prefs | 44 } // namespace prefs |
| OLD | NEW |