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

Unified Diff: components/flags_ui/flags_state.cc

Issue 2058233002: Rewrite simple uses of base::ListValue::Append() taking a raw pointer var. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: less comments more ownership Created 4 years, 6 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/flags_ui/flags_state.cc
diff --git a/components/flags_ui/flags_state.cc b/components/flags_ui/flags_state.cc
index 43185bc7c90a13dec1fe79c3f58ad6657718e10c..8206ef077ad18a3c6878f2d7261f0c050c9cccd9 100644
--- a/components/flags_ui/flags_state.cc
+++ b/components/flags_ui/flags_state.cc
@@ -4,6 +4,9 @@
#include "components/flags_ui/flags_state.h"
+#include <memory>
+#include <utility>
+
#include "base/callback.h"
#include "base/feature_list.h"
#include "base/logging.h"
@@ -163,12 +166,12 @@ base::Value* CreateChoiceData(const FeatureEntry& entry,
entry.type == FeatureEntry::FEATURE_VALUE);
base::ListValue* result = new base::ListValue;
for (int i = 0; i < entry.num_choices; ++i) {
- base::DictionaryValue* value = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> value(new base::DictionaryValue);
const std::string name = entry.NameForChoice(i);
value->SetString("internal_name", name);
value->SetString("description", entry.DescriptionForChoice(i));
value->SetBoolean("selected", enabled_entries.count(name) > 0);
- result->Append(value);
+ result->Append(std::move(value));
}
return result;
}

Powered by Google App Engine
This is Rietveld 408576698