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

Unified Diff: google_apis/drive/drive_api_requests.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
« no previous file with comments | « extensions/browser/extension_prefs.cc ('k') | gpu/config/gpu_control_list.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: google_apis/drive/drive_api_requests.cc
diff --git a/google_apis/drive/drive_api_requests.cc b/google_apis/drive/drive_api_requests.cc
index 2e30a9a4df056e485a2cc85d09674fabd4c4abf3..d1b9b1f5988b35735774ae6deb76750f3daa3c9f 100644
--- a/google_apis/drive/drive_api_requests.cc
+++ b/google_apis/drive/drive_api_requests.cc
@@ -5,7 +5,6 @@
#include "google_apis/drive/drive_api_requests.h"
#include <stddef.h>
-#include <utility>
#include "base/bind.h"
#include "base/callback.h"
@@ -417,9 +416,9 @@ bool FilesInsertRequest::GetContentData(std::string* upload_content_type,
if (!parents_.empty()) {
base::ListValue* parents_value = new base::ListValue;
for (size_t i = 0; i < parents_.size(); ++i) {
- base::DictionaryValue* parent = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> parent(new base::DictionaryValue);
parent->SetString("id", parents_[i]);
- parents_value->Append(parent);
+ parents_value->Append(std::move(parent));
}
root.Set("parents", parents_value);
}
@@ -495,9 +494,9 @@ bool FilesPatchRequest::GetContentData(std::string* upload_content_type,
if (!parents_.empty()) {
base::ListValue* parents_value = new base::ListValue;
for (size_t i = 0; i < parents_.size(); ++i) {
- base::DictionaryValue* parent = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> parent(new base::DictionaryValue);
parent->SetString("id", parents_[i]);
- parents_value->Append(parent);
+ parents_value->Append(std::move(parent));
}
root.Set("parents", parents_value);
}
@@ -549,9 +548,9 @@ bool FilesCopyRequest::GetContentData(std::string* upload_content_type,
if (!parents_.empty()) {
base::ListValue* parents_value = new base::ListValue;
for (size_t i = 0; i < parents_.size(); ++i) {
- base::DictionaryValue* parent = new base::DictionaryValue;
+ std::unique_ptr<base::DictionaryValue> parent(new base::DictionaryValue);
parent->SetString("id", parents_[i]);
- parents_value->Append(parent);
+ parents_value->Append(std::move(parent));
}
root.Set("parents", parents_value);
}
« no previous file with comments | « extensions/browser/extension_prefs.cc ('k') | gpu/config/gpu_control_list.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698