| 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}\
|
|
|