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

Unified Diff: services/preferences/persistent_pref_store_factory.cc

Issue 2738353002: Pref service: integrate PersistentPrefStoreImpl with PrefStoreManagerImpl. (Closed)
Patch Set: Created 3 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « services/preferences/persistent_pref_store_factory.h ('k') | services/preferences/public/cpp/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: services/preferences/persistent_pref_store_factory.cc
diff --git a/services/preferences/persistent_pref_store_factory.cc b/services/preferences/persistent_pref_store_factory.cc
new file mode 100644
index 0000000000000000000000000000000000000000..c9909fbbe6942d6d2a07d05e7f0d1a192e63c21c
--- /dev/null
+++ b/services/preferences/persistent_pref_store_factory.cc
@@ -0,0 +1,41 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "services/preferences/persistent_pref_store_factory.h"
+
+#include <memory>
+#include <utility>
+
+#include "components/prefs/json_pref_store.h"
+#include "components/prefs/pref_filter.h"
+#include "services/preferences/persistent_pref_store_impl.h"
+
+namespace prefs {
+namespace {
+
+std::unique_ptr<PersistentPrefStoreImpl> CreateSimplePersistentPrefStore(
+ mojom::SimplePersistentPrefStoreConfigurationPtr config,
+ base::SequencedWorkerPool* worker_pool) {
+ return base::MakeUnique<PersistentPrefStoreImpl>(
+ new JsonPrefStore(config->pref_filename,
+ JsonPrefStore::GetTaskRunnerForFile(
+ config->pref_filename.DirName(), worker_pool),
+ nullptr),
+ nullptr);
+}
+
+} // namespace
+
+std::unique_ptr<PersistentPrefStoreImpl> CreatePersistentPrefStore(
+ mojom::PersistentPrefStoreConfigurationPtr configuration,
+ base::SequencedWorkerPool* worker_pool) {
+ if (configuration->is_simple_configuration()) {
+ return CreateSimplePersistentPrefStore(
+ std::move(configuration->get_simple_configuration()), worker_pool);
+ }
+ NOTREACHED();
+ return nullptr;
+}
+
+} // namespace prefs
« no previous file with comments | « services/preferences/persistent_pref_store_factory.h ('k') | services/preferences/public/cpp/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698