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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 1549353002: Convert Pass()→std::move() in generated JS schema bindings. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/cc_generator.py
diff --git a/tools/json_schema_compiler/cc_generator.py b/tools/json_schema_compiler/cc_generator.py
index f93c4d9fb80db3479fd43215e66af5161ca9485c..ac1679bee35119d0c57122ef50b5bcf9163b1cc7 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -48,6 +48,7 @@ class _Generator(object):
.Append('#include "%s/%s.h"' %
(self._namespace.source_file_dir, self._namespace.short_filename))
.Append('#include <set>')
+ .Append('#include <utility>')
.Cblock(self._type_helper.GenerateIncludes(include_soft=True))
.Append()
.Append('using base::UTF8ToUTF16;')
@@ -331,7 +332,7 @@ class _Generator(object):
.Append(' if (!Populate(%s))' % self._GenerateArgs(
('value', 'out.get()')))
.Append(' return scoped_ptr<%s>();' % classname)
- .Append(' return out.Pass();')
+ .Append(' return out;')
.Append('}')
)
return c
@@ -407,7 +408,7 @@ class _Generator(object):
)
return (c.Append()
- .Append('return value.Pass();')
+ .Append('return value;')
.Eblock('}'))
def _GenerateChoiceTypeToValue(self, cpp_namespace, type_):
@@ -433,7 +434,7 @@ class _Generator(object):
)
(c.Append('DCHECK(result) << "Must set at least one choice for %s";' %
type_.unix_name)
- .Append('return result.Pass();')
+ .Append('return result;')
.Eblock('}')
)
return c
@@ -645,7 +646,7 @@ class _Generator(object):
.Eblock('}'))
c.Substitute({'value_var': value_var, 'i': i, 'key': param.name})
(c.Append()
- .Append('return params.Pass();')
+ .Append('return params;')
.Eblock('}')
.Append()
)
@@ -734,7 +735,7 @@ class _Generator(object):
)
(c.Append('}')
.Append('else')
- .Append(' %(dst_var)s = temp.Pass();')
+ .Append(' %(dst_var)s = std::move(temp);')
.Eblock('}')
)
else:
@@ -795,7 +796,7 @@ class _Generator(object):
.Append('if (!%%(cpp_type)s::Populate(%s))' % self._GenerateArgs(
('*%(src_var)s', 'temp.get()')))
.Append(' return %(failure_value)s;')
- .Append('%(dst_var)s = temp.Pass();')
+ .Append('%(dst_var)s = std::move(temp);')
)
else:
(c.Append('if (!%%(cpp_type)s::Populate(%s))' % self._GenerateArgs(
@@ -1013,7 +1014,7 @@ class _Generator(object):
param.name,
param.type_,
param.unix_name))
- c.Append('return create_results.Pass();')
+ c.Append('return create_results;')
c.Eblock('}')
c.Substitute({
'function_scope': ('%s::' % function_scope) if function_scope else '',
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698