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

Unified Diff: content/browser/devtools/protocol/devtools_protocol_handler_generator.py

Issue 2285933003: Remove more usage of the base::ListValue::Append(Value*) overload. (Closed)
Patch Set: rebase Created 4 years, 4 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 | « content/browser/accessibility/accessibility_ui.cc ('k') | content/browser/gpu/gpu_internals_ui.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/devtools/protocol/devtools_protocol_handler_generator.py
diff --git a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
index 1697708fe43b33555dd7aa05a6b99ba5e0d118b3..294854742dbbff3464e82748494847014f44fcfd 100755
--- a/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
+++ b/content/browser/devtools/protocol/devtools_protocol_handler_generator.py
@@ -18,8 +18,8 @@ header = """\
// THIS FILE IS AUTOGENERATED. DO NOT EDIT.
// Generated by
-// content/public/browser/devtools_protocol_handler_generator.py from
-// gen/blink/core/inspector/protocol.json and
+// content/browser/devtools/protocol/devtools_protocol_handler_generator.py
+// from gen/blink/core/inspector/protocol.json
"""
template_h = string.Template(header + """\
@@ -27,6 +27,7 @@ template_h = string.Template(header + """\
#ifndef CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_DISPATCHER_H_
#define CONTENT_BROWSER_DEVTOOLS_PROTOCOL_DEVTOOLS_PROTOCOL_DISPATCHER_H_
+#include <memory>
#include <utility>
#include "base/memory/ptr_util.h"
@@ -43,31 +44,31 @@ extern const char kProtocolVersion[];
bool IsSupportedProtocolVersion(const std::string& version);
template<typename T>
-base::Value* CreateValue(const T& param) {
- return new base::FundamentalValue(param);
+std::unique_ptr<base::Value> CreateValue(const T& param) {
+ return base::MakeUnique<base::FundamentalValue>(param);
}
-template<class T>
-base::Value* CreateValue(std::unique_ptr<T>& param) {
- return param.release();
+template<typename T>
+std::unique_ptr<base::Value> CreateValue(std::unique_ptr<T>& param) {
+ return std::move(param);
}
template<class T>
-base::Value* CreateValue(scoped_refptr<T> param) {
- return param->ToValue().release();
+std::unique_ptr<base::Value> CreateValue(const scoped_refptr<T>& param) {
+ return param->ToValue();
}
template<typename T>
-base::Value* CreateValue(const std::vector<T> param) {
- base::ListValue* result = new base::ListValue();
+std::unique_ptr<base::Value> CreateValue(const std::vector<T>& param) {
+ std::unique_ptr<base::ListValue> result(new base::ListValue());
for (auto& item : param) {
result->Append(CreateValue(item));
}
- return result;
+ return std::move(result);
}
template<>
-base::Value* CreateValue(const std::string& param);
+std::unique_ptr<base::Value> CreateValue(const std::string& param);
${types}\
@@ -284,8 +285,8 @@ bool IsSupportedProtocolVersion(const std::string& version) {
}
template<>
-base::Value* CreateValue(const std::string& param) {
- return new base::StringValue(param);
+std::unique_ptr<base::Value> CreateValue(const std::string& param) {
+ return base::MakeUnique<base::StringValue>(param);
}
${types}\
« no previous file with comments | « content/browser/accessibility/accessibility_ui.cc ('k') | content/browser/gpu/gpu_internals_ui.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698