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

Unified Diff: services/preferences/persistent_pref_store_impl.cc

Issue 2803023005: Switch base::Value typemapping to be by value instead of by unique_ptr.
Patch Set: 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 side-by-side diff with in-line comments
Download patch
Index: services/preferences/persistent_pref_store_impl.cc
diff --git a/services/preferences/persistent_pref_store_impl.cc b/services/preferences/persistent_pref_store_impl.cc
index 95930387654f5c875d845330787287e8bbb2b662..24272a9d1599c8745da4b0590a0596c1e0587b7d 100644
--- a/services/preferences/persistent_pref_store_impl.cc
+++ b/services/preferences/persistent_pref_store_impl.cc
@@ -42,8 +42,7 @@ class PersistentPrefStoreImpl::Connection : public mojom::PersistentPrefStore {
for (const auto& update : updates) {
if (base::ContainsKey(observed_keys_, update->key)) {
filtered_updates.push_back(mojom::PrefUpdate::New(
- update->key,
- update->value ? update->value->CreateDeepCopy() : nullptr, 0));
+ update->key, update->value ? update->value : base::nullopt, 0));
}
}
if (!filtered_updates.empty())
@@ -112,8 +111,9 @@ PersistentPrefStoreImpl::CreateConnection(ObservedPrefs observed_prefs) {
auto* connection_ptr = connection.get();
connections_.insert(std::make_pair(connection_ptr, std::move(connection)));
return mojom::PersistentPrefStoreConnection::New(
- mojom::PrefStoreConnection::New(std::move(observer_request),
- backing_pref_store_->GetValues(), true),
+ mojom::PrefStoreConnection::New(
+ std::move(observer_request),
+ std::move(*backing_pref_store_->GetValues()), true),
std::move(pref_store_ptr), backing_pref_store_->GetReadError(),
backing_pref_store_->ReadOnly());
}
@@ -134,8 +134,8 @@ void PersistentPrefStoreImpl::SetValues(
for (auto& update : updates) {
if (update->value) {
- backing_pref_store_->SetValue(update->key, std::move(update->value),
- update->flags);
+ backing_pref_store_->SetValue(
+ update->key, update->value->CreateDeepCopy(), update->flags);
} else {
backing_pref_store_->RemoveValue(update->key, update->flags);
}

Powered by Google App Engine
This is Rietveld 408576698