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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 1151763007: Add the boilerplate for actions to File System Provider API. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed. Created 5 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
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 e2b069564fda592eeb5a740eb33193e403847c42..48a723e047246e4c54470a9b161a9cd1cfd002d9 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -420,13 +420,16 @@ class _Generator(object):
c.Append('scoped_ptr<base::Value> result;')
for choice in type_.choices:
choice_var = 'as_%s' % choice.unix_name
+ # Enums cannot be wrapped with scoped_ptr, but the XXX_NONE enum value
+ # is equal to 0.
(c.Sblock('if (%s) {' % choice_var)
.Append('DCHECK(!result) << "Cannot set multiple choices for %s";' %
type_.unix_name)
.Cblock(self._CreateValueFromType('result.reset(%s);',
choice.name,
choice,
- '*%s' % choice_var))
+ choice_var,
+ True))
.Eblock('}')
)
(c.Append('DCHECK(result) << "Must set at least one choice for %s";' %

Powered by Google App Engine
This is Rietveld 408576698