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

Unified Diff: third_party/WebKit/Source/bindings/scripts/code_generator_v8.py

Issue 2749253002: bindings: Expand typedefs before generating union files. (Closed)
Patch Set: Created 3 years, 9 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 | « no previous file | third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
diff --git a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
index 29feb0319cf1c4d892d4893f5d5f9fa9c11818f2..9022b65cff557aa233bf6ae0535e2437286f6791 100644
--- a/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
+++ b/third_party/WebKit/Source/bindings/scripts/code_generator_v8.py
@@ -287,8 +287,16 @@ class CodeGeneratorUnionType(CodeGeneratorBase):
def __init__(self, info_provider, cache_dir, output_dir, target_component):
CodeGeneratorBase.__init__(self, MODULE_PYNAME, info_provider, cache_dir, output_dir)
self.target_component = target_component
+ # The code below duplicates parts of TypedefResolver. We do not use it
+ # directly because IdlUnionType is not a type defined in
+ # idl_definitions.py. What we do instead is to resolve typedefs in
+ # _generate_container_code() whenever a new union file is generated.
+ self.typedefs = {}
bashi 2017/03/15 23:27:11 Could you explain why do you need to set |typedef|
Raphael Kubo da Costa (rakuco) 2017/03/16 08:04:48 Just to avoid having to iterate through self.info_
+ for name, typedef in self.info_provider.typedefs.iteritems():
+ self.typedefs[name] = typedef.idl_type
def _generate_container_code(self, union_type):
+ union_type = union_type.resolve_typedefs(self.typedefs)
header_template = self.jinja_env.get_template('union_container.h.tmpl')
cpp_template = self.jinja_env.get_template('union_container.cpp.tmpl')
template_context = v8_union.container_context(
« no previous file with comments | « no previous file | third_party/WebKit/Source/bindings/scripts/compute_interfaces_info_individual.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698