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

Unified Diff: tools/json_schema_compiler/cc_generator.py

Issue 10217018: Alarm resolution changed to minutes and minimum delay added. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Sinked. Created 8 years, 7 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 | « chrome/common/extensions/docs/samples.json ('k') | tools/json_schema_compiler/idl_schema.py » ('j') | 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 b8adaafe6c147e234a729cbe836170601d88455e..3efad841e48abb226715dd04c18944d1d9bfc1d8 100644
--- a/tools/json_schema_compiler/cc_generator.py
+++ b/tools/json_schema_compiler/cc_generator.py
@@ -455,21 +455,16 @@ class CCGenerator(object):
c = Code()
c.Sblock('{')
- if check_type and prop.type_ not in (
- PropertyType.CHOICES, PropertyType.ANY):
- (c.Append('if (!%(value_var)s->IsType(%(value_type)s))')
- .Append(' return %(failure_value)s;')
- )
-
if self._IsFundamentalOrFundamentalRef(prop):
if prop.optional:
(c.Append('%(ctype)s temp;')
- .Append('if (%s)' %
+ .Append('if (!%s)' %
cpp_util.GetAsFundamentalValue(
self._cpp_type_generator.GetReferencedProperty(prop),
value_var,
'&temp'))
- .Append(' %(dst)s->%(name)s.reset(new %(ctype)s(temp));')
+ .Append(' return %(failure_value)s;')
+ .Append('%(dst)s->%(name)s.reset(new %(ctype)s(temp));')
)
else:
(c.Append('if (!%s)' %
@@ -477,7 +472,7 @@ class CCGenerator(object):
self._cpp_type_generator.GetReferencedProperty(prop),
value_var,
'&%s->%s' % (dst, prop.unix_name)))
- .Append('return %(failure_value)s;')
+ .Append(' return %(failure_value)s;')
)
elif self._IsObjectOrObjectRef(prop):
if prop.optional:
@@ -551,7 +546,9 @@ class CCGenerator(object):
# This is the same if the property is optional or not. We need a pointer
# to the BinaryValue to be able to populate it, so a scoped_ptr is used
# whether it is optional or required.
- (c.Append('%(dst)s->%(name)s.reset(')
+ (c.Append('if (!%(value_var)s->IsType(%(value_type)s))')
+ .Append(' return %(failure_value)s;')
+ .Append('%(dst)s->%(name)s.reset(')
.Append(' static_cast<BinaryValue*>(%(value_var)s)->DeepCopy());')
)
else:
« no previous file with comments | « chrome/common/extensions/docs/samples.json ('k') | tools/json_schema_compiler/idl_schema.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698