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

Side by Side Diff: services/preferences/public/cpp/persistent_pref_store_client.cc

Issue 2746023002: Pref service: enable for user prefs in chrome behind a flag. (Closed)
Patch Set: no, the other pref service Created 3 years, 8 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 unified diff | Download patch
« no previous file with comments | « mojo/public/cpp/bindings/sync_call_restrictions.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/persistent_pref_store_client.h" 5 #include "services/preferences/public/cpp/persistent_pref_store_client.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/values.h" 9 #include "base/values.h"
10 #include "components/prefs/pref_registry.h" 10 #include "components/prefs/pref_registry.h"
11 #include "mojo/public/cpp/bindings/sync_call_restrictions.h"
11 #include "services/preferences/public/cpp/pref_registry_serializer.h" 12 #include "services/preferences/public/cpp/pref_registry_serializer.h"
12 13
13 namespace prefs { 14 namespace prefs {
14 15
15 PersistentPrefStoreClient::PersistentPrefStoreClient( 16 PersistentPrefStoreClient::PersistentPrefStoreClient(
16 mojom::PrefStoreConnectorPtr connector, 17 mojom::PrefStoreConnectorPtr connector,
17 scoped_refptr<PrefRegistry> pref_registry) 18 scoped_refptr<PrefRegistry> pref_registry)
18 : connector_(std::move(connector)), 19 : connector_(std::move(connector)),
19 pref_registry_(std::move(pref_registry)) { 20 pref_registry_(std::move(pref_registry)) {
20 DCHECK(connector_); 21 DCHECK(connector_);
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 PersistentPrefStore::PrefReadError PersistentPrefStoreClient::GetReadError() 76 PersistentPrefStore::PrefReadError PersistentPrefStoreClient::GetReadError()
76 const { 77 const {
77 return read_error_; 78 return read_error_;
78 } 79 }
79 80
80 PersistentPrefStore::PrefReadError PersistentPrefStoreClient::ReadPrefs() { 81 PersistentPrefStore::PrefReadError PersistentPrefStoreClient::ReadPrefs() {
81 mojom::PersistentPrefStoreConnectionPtr connection; 82 mojom::PersistentPrefStoreConnectionPtr connection;
82 std::unordered_map<PrefValueStore::PrefStoreType, 83 std::unordered_map<PrefValueStore::PrefStoreType,
83 prefs::mojom::PrefStoreConnectionPtr> 84 prefs::mojom::PrefStoreConnectionPtr>
84 other_pref_stores; 85 other_pref_stores;
86 mojo::SyncCallRestrictions::ScopedAllowSyncCall allow_sync_calls;
85 if (!connector_->Connect(SerializePrefRegistry(*pref_registry_), &connection, 87 if (!connector_->Connect(SerializePrefRegistry(*pref_registry_), &connection,
86 &other_pref_stores)) { 88 &other_pref_stores)) {
87 NOTREACHED(); 89 NOTREACHED();
88 } 90 }
89 pref_registry_ = nullptr; 91 pref_registry_ = nullptr;
90 OnConnect(std::move(connection), std::move(other_pref_stores)); 92 OnConnect(std::move(connection), std::move(other_pref_stores));
91 return read_error_; 93 return read_error_;
92 } 94 }
93 95
94 void PersistentPrefStoreClient::ReadPrefsAsync( 96 void PersistentPrefStoreClient::ReadPrefsAsync(
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 139
138 if (connection->pref_store_connection) { 140 if (connection->pref_store_connection) {
139 Init(std::move(connection->pref_store_connection->initial_prefs), true, 141 Init(std::move(connection->pref_store_connection->initial_prefs), true,
140 std::move(connection->pref_store_connection->observer)); 142 std::move(connection->pref_store_connection->observer));
141 } else { 143 } else {
142 Init(nullptr, false, nullptr); 144 Init(nullptr, false, nullptr);
143 } 145 }
144 } 146 }
145 147
146 } // namespace prefs 148 } // namespace prefs
OLDNEW
« no previous file with comments | « mojo/public/cpp/bindings/sync_call_restrictions.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698