Index: third_party/WebKit/Source/bindings/scripts/code_generator.py |
diff --git a/third_party/WebKit/Source/bindings/scripts/code_generator.py b/third_party/WebKit/Source/bindings/scripts/code_generator.py |
index c9d7946ab760a5f61bb6d4c27bbfe7d942db9d22..37da45b0894d8ab59bb359a6889e8ca09a4986d4 100644 |
--- a/third_party/WebKit/Source/bindings/scripts/code_generator.py |
+++ b/third_party/WebKit/Source/bindings/scripts/code_generator.py |
@@ -121,21 +121,6 @@ class CodeGeneratorBase(object): |
self.info_provider = info_provider |
self.jinja_env = initialize_jinja_env(cache_dir) |
self.output_dir = output_dir |
- self.set_global_type_info() |
- |
- def should_generate_code(self, definitions): |
- return definitions.interfaces or definitions.dictionaries |
- |
- def set_global_type_info(self): |
- interfaces_info = self.info_provider.interfaces_info |
- set_ancestors(interfaces_info['ancestors']) |
- IdlType.set_callback_interfaces(interfaces_info['callback_interfaces']) |
- IdlType.set_dictionaries(interfaces_info['dictionaries']) |
- IdlType.set_enums(self.info_provider.enumerations) |
- IdlType.set_callback_functions(self.info_provider.callback_functions) |
- IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_interfaces']) |
- IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_interfaces']) |
- set_component_dirs(interfaces_info['component_dirs']) |
def render_template(self, include_paths, header_template, cpp_template, |
template_context, component=None): |
@@ -157,6 +142,29 @@ class CodeGeneratorBase(object): |
cpp_text = render_template(cpp_template, template_context) |
return header_text, cpp_text |
+ |
+class IDLCodeGeneratorBase(CodeGeneratorBase): |
Yuki
2017/07/14 03:30:07
Is this just a refactoring?
Does this make sense?
iclelland
2017/07/14 18:25:04
I wanted to reuse some of the functionality from C
|
+ """Base class for code generators which create bindings implementations from |
+ IDL files. |
+ """ |
+ def __init__(self, generator_name, info_provider, cache_dir, output_dir): |
+ super(IDLCodeGeneratorBase, self).__init__(generator_name, info_provider, cache_dir, output_dir) |
+ self.set_global_type_info() |
+ |
+ def should_generate_code(self, definitions): |
+ return definitions.interfaces or definitions.dictionaries |
+ |
+ def set_global_type_info(self): |
+ interfaces_info = self.info_provider.interfaces_info |
+ set_ancestors(interfaces_info['ancestors']) |
+ IdlType.set_callback_interfaces(interfaces_info['callback_interfaces']) |
+ IdlType.set_dictionaries(interfaces_info['dictionaries']) |
+ IdlType.set_enums(self.info_provider.enumerations) |
+ IdlType.set_callback_functions(self.info_provider.callback_functions) |
+ IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_interfaces']) |
+ IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_interfaces']) |
+ set_component_dirs(interfaces_info['component_dirs']) |
+ |
def generate_code(self, definitions, definition_name): |
"""Invokes code generation. The [definitions] argument is a list of definitions, |
and the [definition_name] is the name of the definition |