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

Unified Diff: components/prefs/pref_registry.cc

Issue 2784513002: Move PrefRegistrySimple to use unique_ptr<Value> (Closed)
Patch Set: Android 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 | « components/prefs/pref_registry.h ('k') | components/prefs/pref_registry_simple.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: components/prefs/pref_registry.cc
diff --git a/components/prefs/pref_registry.cc b/components/prefs/pref_registry.cc
index 63b5e6a823eb0ace7a7280aae3efb36bc3ece547..e80d03c46d33e5f33c596396aed0b802ffe4f53c 100644
--- a/components/prefs/pref_registry.cc
+++ b/components/prefs/pref_registry.cc
@@ -4,6 +4,8 @@
#include "components/prefs/pref_registry.h"
+#include <utility>
+
#include "base/logging.h"
#include "base/memory/ptr_util.h"
#include "base/stl_util.h"
@@ -50,9 +52,10 @@ void PrefRegistry::SetDefaultPrefValue(const std::string& pref_name,
defaults_->ReplaceDefaultValue(pref_name, base::WrapUnique(value));
}
-void PrefRegistry::RegisterPreference(const std::string& path,
- base::Value* default_value,
- uint32_t flags) {
+void PrefRegistry::RegisterPreference(
+ const std::string& path,
+ std::unique_ptr<base::Value> default_value,
+ uint32_t flags) {
base::Value::Type orig_type = default_value->GetType();
DCHECK(orig_type != base::Value::Type::NONE &&
orig_type != base::Value::Type::BINARY) <<
@@ -62,7 +65,7 @@ void PrefRegistry::RegisterPreference(const std::string& path,
DCHECK(!base::ContainsKey(registration_flags_, path))
<< "Trying to register a previously registered pref: " << path;
- defaults_->SetDefaultValue(path, base::WrapUnique(default_value));
+ defaults_->SetDefaultValue(path, std::move(default_value));
if (flags != NO_REGISTRATION_FLAGS)
registration_flags_[path] = flags;
}
« no previous file with comments | « components/prefs/pref_registry.h ('k') | components/prefs/pref_registry_simple.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698