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

Unified Diff: mojo/common/values_struct_traits.cc

Issue 2812863002: Pref service: Add a ScopedDictionaryPrefUpdate to track value changes. (Closed)
Patch Set: rebase 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
« no previous file with comments | « mojo/common/values_struct_traits.h ('k') | services/preferences/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/common/values_struct_traits.cc
diff --git a/mojo/common/values_struct_traits.cc b/mojo/common/values_struct_traits.cc
index 6d392ecabdeba15e8875490d259ba67262dcd59e..12e5173e5eadbf1854d3b4a6531f9ea4d9bbb972 100644
--- a/mojo/common/values_struct_traits.cc
+++ b/mojo/common/values_struct_traits.cc
@@ -48,9 +48,7 @@ bool StructTraits<common::mojom::DictionaryValueDataView,
std::unique_ptr<base::DictionaryValue>
CloneTraits<std::unique_ptr<base::DictionaryValue>, false>::Clone(
const std::unique_ptr<base::DictionaryValue>& input) {
- auto result = base::MakeUnique<base::DictionaryValue>();
- result->MergeDictionary(input.get());
- return result;
+ return input ? input->CreateDeepCopy() : nullptr;
}
bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>::
@@ -106,4 +104,10 @@ bool UnionTraits<common::mojom::ValueDataView, std::unique_ptr<base::Value>>::
return false;
}
+std::unique_ptr<base::Value>
+CloneTraits<std::unique_ptr<base::Value>, false>::Clone(
+ const std::unique_ptr<base::Value>& input) {
+ return input ? input->CreateDeepCopy() : nullptr;
+}
+
} // namespace mojo
« no previous file with comments | « mojo/common/values_struct_traits.h ('k') | services/preferences/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698