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

Unified Diff: tools/json_schema_compiler/h_generator.py

Issue 1869503004: Convert //tools to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, change iwyu fixes for converted directories to include <memory> Created 4 years, 8 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: tools/json_schema_compiler/h_generator.py
diff --git a/tools/json_schema_compiler/h_generator.py b/tools/json_schema_compiler/h_generator.py
index a190eded36c843dd0ade45eeee263833bdf2e83f..c64241cd62d6d66b46230ee62cf84867f0432e08 100644
--- a/tools/json_schema_compiler/h_generator.py
+++ b/tools/json_schema_compiler/h_generator.py
@@ -53,11 +53,11 @@ class _Generator(object):
.Append('#include <stdint.h>')
.Append()
.Append('#include <map>')
+ .Append('#include <memory>')
.Append('#include <string>')
.Append('#include <vector>')
.Append()
.Append('#include "base/logging.h"')
- .Append('#include "base/memory/scoped_ptr.h"')
.Append('#include "base/values.h"')
.Cblock(self._type_helper.GenerateIncludes(include_soft=include_soft))
.Append()
@@ -241,7 +241,7 @@ class _Generator(object):
(c.Append()
.Comment('Creates a %s object from a base::Value, or NULL on '
'failure.' % classname)
- .Append('static scoped_ptr<%s> FromValue(%s);' % (
+ .Append('static std::unique_ptr<%s> FromValue(%s);' % (
classname, self._GenerateParams(('const base::Value& value',))))
)
if type_.origin.from_client:
@@ -251,7 +251,7 @@ class _Generator(object):
(c.Append()
.Comment('Returns a new %s representing the serialized form of this '
'%s object.' % (value_type, classname))
- .Append('scoped_ptr<%s> ToValue() const;' % value_type)
+ .Append('std::unique_ptr<%s> ToValue() const;' % value_type)
)
if type_.property_type == PropertyType.CHOICES:
# Choices are modelled with optional fields for each choice. Exactly one
@@ -328,8 +328,8 @@ class _Generator(object):
c = Code()
(c.Sblock('struct Params {')
- .Append('static scoped_ptr<Params> Create(%s);' % self._GenerateParams(
- ('const base::ListValue& args',)))
+ .Append('static std::unique_ptr<Params> Create(%s);' %
+ self._GenerateParams(('const base::ListValue& args',)))
.Append('~Params();')
.Append()
.Cblock(self._GenerateTypes(p.type_ for p in function.params))
@@ -368,7 +368,7 @@ class _Generator(object):
c.Comment(param.description)
declaration_list.append(cpp_util.GetParameterDeclaration(
param, self._type_helper.GetCppType(param.type_)))
- c.Append('scoped_ptr<base::ListValue> Create(%s);' %
+ c.Append('std::unique_ptr<base::ListValue> Create(%s);' %
', '.join(declaration_list))
return c
« no previous file with comments | « tools/json_schema_compiler/cpp_type_generator.py ('k') | tools/json_schema_compiler/test/additional_properties_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698