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

Side by Side Diff: third_party/WebKit/Source/bindings/scripts/code_generator.py

Issue 2312093003: Generated bindings for IDL callback functions (Closed)
Patch Set: Addressed comments Created 4 years, 3 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 unified diff | Download patch
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # pylint: disable=import-error,print-statement,relative-import 5 # pylint: disable=import-error,print-statement,relative-import
6 6
7 """Plumbing for a Jinja-based code generator, including CodeGeneratorBase, a bas e class for all generators.""" 7 """Plumbing for a Jinja-based code generator, including CodeGeneratorBase, a bas e class for all generators."""
8 8
9 import os 9 import os
10 import posixpath 10 import posixpath
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
117 117
118 def should_generate_code(self, definitions): 118 def should_generate_code(self, definitions):
119 return definitions.interfaces or definitions.dictionaries 119 return definitions.interfaces or definitions.dictionaries
120 120
121 def set_global_type_info(self): 121 def set_global_type_info(self):
122 interfaces_info = self.info_provider.interfaces_info 122 interfaces_info = self.info_provider.interfaces_info
123 set_ancestors(interfaces_info['ancestors']) 123 set_ancestors(interfaces_info['ancestors'])
124 IdlType.set_callback_interfaces(interfaces_info['callback_interfaces']) 124 IdlType.set_callback_interfaces(interfaces_info['callback_interfaces'])
125 IdlType.set_dictionaries(interfaces_info['dictionaries']) 125 IdlType.set_dictionaries(interfaces_info['dictionaries'])
126 IdlType.set_enums(self.info_provider.enumerations) 126 IdlType.set_enums(self.info_provider.enumerations)
127 IdlType.set_experimental_callback_functions(self.info_provider.callback_ functions)
127 IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_in terfaces']) 128 IdlType.set_implemented_as_interfaces(interfaces_info['implemented_as_in terfaces'])
128 IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_i nterfaces']) 129 IdlType.set_garbage_collected_types(interfaces_info['garbage_collected_i nterfaces'])
129 set_component_dirs(interfaces_info['component_dirs']) 130 set_component_dirs(interfaces_info['component_dirs'])
130 131
131 def render_template(self, include_paths, header_template, cpp_template, 132 def render_template(self, include_paths, header_template, cpp_template,
132 template_context, component=None): 133 template_context, component=None):
133 template_context['code_generator'] = self.generator_name 134 template_context['code_generator'] = self.generator_name
134 135
135 # Add includes for any dependencies 136 # Add includes for any dependencies
136 template_context['header_includes'] = normalize_and_sort_includes( 137 template_context['header_includes'] = normalize_and_sort_includes(
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 176
176 # Create a dummy file as output for the build system, 177 # Create a dummy file as output for the build system,
177 # since filenames of individual cache files are unpredictable and opaque 178 # since filenames of individual cache files are unpredictable and opaque
178 # (they are hashes of the template path, which varies based on environment) 179 # (they are hashes of the template path, which varies based on environment)
179 with open(dummy_filename, 'w') as dummy_file: 180 with open(dummy_filename, 'w') as dummy_file:
180 pass # |open| creates or touches the file 181 pass # |open| creates or touches the file
181 182
182 183
183 if __name__ == '__main__': 184 if __name__ == '__main__':
184 sys.exit(main(sys.argv)) 185 sys.exit(main(sys.argv))
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/BUILD.gn ('k') | third_party/WebKit/Source/bindings/scripts/code_generator_v8.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698