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

Unified Diff: tools/json_schema_compiler/util_cc_helper.py

Issue 851673003: Cleanup: Some simplifications in json_schema_compiler. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@fix_dart_tests
Patch Set: Created 5 years, 11 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
« tools/json_schema_compiler/util.h ('K') | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/json_schema_compiler/util_cc_helper.py
diff --git a/tools/json_schema_compiler/util_cc_helper.py b/tools/json_schema_compiler/util_cc_helper.py
index 0e41abfa12b06c7d0b96bde0c5cbe6c67f7790b7..6549b4eab409ff46d6570ed410350825c1a3009f 100644
--- a/tools/json_schema_compiler/util_cc_helper.py
+++ b/tools/json_schema_compiler/util_cc_helper.py
@@ -36,17 +36,24 @@ class UtilCCHelper(object):
return val % sub
- def PopulateArrayFromList(self, src, dst, optional):
+ def PopulateArrayFromList(self, src, dst, optional, items_are_binary):
not at google - send to devlin 2015/01/13 18:15:14 For boolean flags I prefer to make it explicit, li
pneubeck (no reviews) 2015/01/14 10:54:15 Not sure how you could /force/ the caller to use n
"""Generates code to get an array from src into dst.
src: ListValue*
dst: std::vector or scoped_ptr<std::vector>
"""
+
+ binary_tag = 'ITEMS_ARE_NOT_BINARY';
+ if items_are_binary:
+ binary_tag = 'ITEMS_ARE_BINARY';
if optional:
- val = '%(namespace)s::PopulateOptionalArrayFromList(*%(src)s, &%(dst)s)'
+ val = ('%(namespace)s::PopulateOptionalArrayFromList'
+ '(*%(src)s, %(namespace)s::%(binary_tag)s(), &%(dst)s)')
else:
- val = '%(namespace)s::PopulateArrayFromList(*%(src)s, &%(dst)s)'
+ val = ('%(namespace)s::PopulateArrayFromList'
+ '(*%(src)s, %(namespace)s::%(binary_tag)s(), &%(dst)s)')
not at google - send to devlin 2015/01/13 18:15:14 Given there's even more duplication, you should be
pneubeck (no reviews) 2015/01/14 10:54:15 Slight variation of what you proposed because conc
return val % {
+ 'binary_tag': binary_tag,
'namespace': _API_UTIL_NAMESPACE,
'src': src,
'dst': dst
« tools/json_schema_compiler/util.h ('K') | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698