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

Unified Diff: components/sync_driver/about_sync_util.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/sync_driver/about_sync_util.cc
diff --git a/components/sync_driver/about_sync_util.cc b/components/sync_driver/about_sync_util.cc
index 457728fd8a7d2d13f5a7ca033e17481beb7b8eee..f1ae5a805a5196604917a2eb89c2af3f3630ea55 100644
--- a/components/sync_driver/about_sync_util.cc
+++ b/components/sync_driver/about_sync_util.cc
@@ -5,6 +5,7 @@
#include "components/sync_driver/about_sync_util.h"
#include <string>
+#include <utility>
#include "base/location.h"
#include "base/strings/string16.h"
@@ -70,12 +71,12 @@ namespace {
// |parent_list|, not the caller, owns the newly added section.
base::ListValue* AddSection(base::ListValue* parent_list,
const std::string& title) {
- base::DictionaryValue* section = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue());
base::ListValue* section_contents = new base::ListValue();
section->SetString("title", title);
section->Set("data", section_contents);
section->SetBoolean("is_sensitive", false);
- parent_list->Append(section);
+ parent_list->Append(std::move(section));
return section_contents;
}
@@ -83,12 +84,12 @@ base::ListValue* AddSection(base::ListValue* parent_list,
// form and posted in a public forum (e.g. unique identifiers).
base::ListValue* AddSensitiveSection(base::ListValue* parent_list,
const std::string& title) {
- base::DictionaryValue* section = new base::DictionaryValue();
+ std::unique_ptr<base::DictionaryValue> section(new base::DictionaryValue());
base::ListValue* section_contents = new base::ListValue();
section->SetString("title", title);
section->Set("data", section_contents);
section->SetBoolean("is_sensitive", true);
- parent_list->Append(section);
+ parent_list->Append(std::move(section));
return section_contents;
}
« no previous file with comments | « components/signin/core/browser/about_signin_internals.cc ('k') | components/url_matcher/url_matcher_factory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698