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

Unified Diff: components/prefs/pref_service.cc

Issue 1907043002: Convert //components/prefs from scoped_ptr to std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: IWYU fixes Created 4 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: components/prefs/pref_service.cc
diff --git a/components/prefs/pref_service.cc b/components/prefs/pref_service.cc
index 1ef2313b3fa45576e6784ed373609f23725984ef..8b634780c342f823b6b4abd55ed2eedc9435c598 100644
--- a/components/prefs/pref_service.cc
+++ b/components/prefs/pref_service.cc
@@ -11,6 +11,7 @@
#include "base/files/file_path.h"
#include "base/location.h"
#include "base/logging.h"
+#include "base/memory/ptr_util.h"
#include "base/metrics/histogram.h"
#include "base/single_thread_task_runner.h"
#include "base/stl_util.h"
@@ -192,19 +193,20 @@ bool PrefService::HasPrefPath(const std::string& path) const {
return pref && !pref->IsDefaultValue();
}
-scoped_ptr<base::DictionaryValue> PrefService::GetPreferenceValues() const {
+std::unique_ptr<base::DictionaryValue> PrefService::GetPreferenceValues()
+ const {
DCHECK(CalledOnValidThread());
- scoped_ptr<base::DictionaryValue> out(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue);
for (const auto& it : *pref_registry_) {
out->Set(it.first, GetPreferenceValue(it.first)->CreateDeepCopy());
}
return out;
}
-scoped_ptr<base::DictionaryValue> PrefService::GetPreferenceValuesOmitDefaults()
- const {
+std::unique_ptr<base::DictionaryValue>
+PrefService::GetPreferenceValuesOmitDefaults() const {
DCHECK(CalledOnValidThread());
- scoped_ptr<base::DictionaryValue> out(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue);
for (const auto& it : *pref_registry_) {
const Preference* pref = FindPreference(it.first);
if (pref->IsDefaultValue())
@@ -214,10 +216,10 @@ scoped_ptr<base::DictionaryValue> PrefService::GetPreferenceValuesOmitDefaults()
return out;
}
-scoped_ptr<base::DictionaryValue>
+std::unique_ptr<base::DictionaryValue>
PrefService::GetPreferenceValuesWithoutPathExpansion() const {
DCHECK(CalledOnValidThread());
- scoped_ptr<base::DictionaryValue> out(new base::DictionaryValue);
+ std::unique_ptr<base::DictionaryValue> out(new base::DictionaryValue);
for (const auto& it : *pref_registry_) {
const base::Value* value = GetPreferenceValue(it.first);
DCHECK(value);
@@ -476,7 +478,7 @@ base::Value* PrefService::GetMutableUserPref(const std::string& path,
} else {
NOTREACHED();
}
- user_pref_store_->SetValueSilently(path, make_scoped_ptr(value),
+ user_pref_store_->SetValueSilently(path, base::WrapUnique(value),
GetWriteFlags(pref));
}
return value;
@@ -489,7 +491,7 @@ void PrefService::ReportUserPrefChanged(const std::string& key) {
void PrefService::SetUserPrefValue(const std::string& path,
base::Value* new_value) {
- scoped_ptr<base::Value> owned_value(new_value);
+ std::unique_ptr<base::Value> owned_value(new_value);
DCHECK(CalledOnValidThread());
const Preference* pref = FindPreference(path);

Powered by Google App Engine
This is Rietveld 408576698