| OLD | NEW |
| 1 # Copyright (C) 2013 Google Inc. All rights reserved. | 1 # Copyright (C) 2013 Google Inc. All rights reserved. |
| 2 # | 2 # |
| 3 # Redistribution and use in source and binary forms, with or without | 3 # Redistribution and use in source and binary forms, with or without |
| 4 # modification, are permitted provided that the following conditions are | 4 # modification, are permitted provided that the following conditions are |
| 5 # met: | 5 # met: |
| 6 # | 6 # |
| 7 # * Redistributions of source code must retain the above copyright | 7 # * Redistributions of source code must retain the above copyright |
| 8 # notice, this list of conditions and the following disclaimer. | 8 # notice, this list of conditions and the following disclaimer. |
| 9 # * Redistributions in binary form must reproduce the above | 9 # * Redistributions in binary form must reproduce the above |
| 10 # copyright notice, this list of conditions and the following disclaimer | 10 # copyright notice, this list of conditions and the following disclaimer |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 interface_context = v8_interface.interface_context | 195 interface_context = v8_interface.interface_context |
| 196 | 196 |
| 197 template_context = interface_context(interface, definitions.interfaces) | 197 template_context = interface_context(interface, definitions.interfaces) |
| 198 includes.update(interface_info.get('cpp_includes', {}).get(component, se
t())) | 198 includes.update(interface_info.get('cpp_includes', {}).get(component, se
t())) |
| 199 if not interface.is_partial and not is_testing_target(full_path): | 199 if not interface.is_partial and not is_testing_target(full_path): |
| 200 template_context['header_includes'].add(self.info_provider.include_p
ath_for_export) | 200 template_context['header_includes'].add(self.info_provider.include_p
ath_for_export) |
| 201 template_context['exported'] = self.info_provider.specifier_for_expo
rt | 201 template_context['exported'] = self.info_provider.specifier_for_expo
rt |
| 202 # Add the include for interface itself | 202 # Add the include for interface itself |
| 203 if IdlType(interface_name).is_typed_array: | 203 if IdlType(interface_name).is_typed_array: |
| 204 template_context['header_includes'].add('core/dom/DOMTypedArray.h') | 204 template_context['header_includes'].add('core/dom/DOMTypedArray.h') |
| 205 elif interface_info['include_path']: | 205 else: |
| 206 template_context['header_includes'].add(interface_info['include_path
']) | 206 template_context['header_includes'].add(interface_info['include_path
']) |
| 207 template_context['header_includes'].update( | 207 template_context['header_includes'].update( |
| 208 interface_info.get('additional_header_includes', [])) | 208 interface_info.get('additional_header_includes', [])) |
| 209 header_template = self.jinja_env.get_template(header_template_filename) | 209 header_template = self.jinja_env.get_template(header_template_filename) |
| 210 cpp_template = self.jinja_env.get_template(cpp_template_filename) | 210 cpp_template = self.jinja_env.get_template(cpp_template_filename) |
| 211 header_text, cpp_text = self.render_template( | 211 header_text, cpp_text = self.render_template( |
| 212 include_paths, header_template, cpp_template, template_context, | 212 include_paths, header_template, cpp_template, template_context, |
| 213 component) | 213 component) |
| 214 header_path, cpp_path = self.output_paths(interface_name) | 214 header_path, cpp_path = self.output_paths(interface_name) |
| 215 return ( | 215 return ( |
| 216 (header_path, header_text), | 216 (header_path, header_text), |
| 217 (cpp_path, cpp_text), | 217 (cpp_path, cpp_text), |
| 218 ) | 218 ) |
| 219 | 219 |
| 220 def generate_dictionary_code(self, definitions, dictionary_name, | 220 def generate_dictionary_code(self, definitions, dictionary_name, |
| 221 dictionary): | 221 dictionary): |
| 222 # pylint: disable=unused-argument | 222 # pylint: disable=unused-argument |
| 223 interfaces_info = self.info_provider.interfaces_info | 223 interfaces_info = self.info_provider.interfaces_info |
| 224 header_template = self.jinja_env.get_template('dictionary_v8.h.tmpl') | 224 header_template = self.jinja_env.get_template('dictionary_v8.h.tmpl') |
| 225 cpp_template = self.jinja_env.get_template('dictionary_v8.cpp.tmpl') | 225 cpp_template = self.jinja_env.get_template('dictionary_v8.cpp.tmpl') |
| 226 interface_info = interfaces_info[dictionary_name] | 226 interface_info = interfaces_info[dictionary_name] |
| 227 template_context = v8_dictionary.dictionary_context( | 227 template_context = v8_dictionary.dictionary_context( |
| 228 dictionary, interfaces_info) | 228 dictionary, interfaces_info) |
| 229 include_paths = interface_info.get('dependencies_include_paths') | 229 include_paths = interface_info.get('dependencies_include_paths') |
| 230 # Add the include for interface itself | 230 # Add the include for interface itself |
| 231 if interface_info['include_path']: | 231 template_context['header_includes'].add(interface_info['include_path']) |
| 232 template_context['header_includes'].add(interface_info['include_path
']) | |
| 233 if not is_testing_target(interface_info.get('full_path')): | 232 if not is_testing_target(interface_info.get('full_path')): |
| 234 template_context['header_includes'].add(self.info_provider.include_p
ath_for_export) | 233 template_context['header_includes'].add(self.info_provider.include_p
ath_for_export) |
| 235 template_context['exported'] = self.info_provider.specifier_for_expo
rt | 234 template_context['exported'] = self.info_provider.specifier_for_expo
rt |
| 236 header_text, cpp_text = self.render_template( | 235 header_text, cpp_text = self.render_template( |
| 237 include_paths, header_template, cpp_template, template_context) | 236 include_paths, header_template, cpp_template, template_context) |
| 238 header_path, cpp_path = self.output_paths(dictionary_name) | 237 header_path, cpp_path = self.output_paths(dictionary_name) |
| 239 return ( | 238 return ( |
| 240 (header_path, header_text), | 239 (header_path, header_text), |
| 241 (cpp_path, cpp_text), | 240 (cpp_path, cpp_text), |
| 242 ) | 241 ) |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 374 outputs = set() | 373 outputs = set() |
| 375 for callback_function_dict in callback_functions.itervalues(): | 374 for callback_function_dict in callback_functions.itervalues(): |
| 376 if callback_function_dict['component_dir'] != self.target_component: | 375 if callback_function_dict['component_dir'] != self.target_component: |
| 377 continue | 376 continue |
| 378 callback_function = callback_function_dict['callback_function'] | 377 callback_function = callback_function_dict['callback_function'] |
| 379 if 'Custom' in callback_function.extended_attributes: | 378 if 'Custom' in callback_function.extended_attributes: |
| 380 continue | 379 continue |
| 381 path = callback_function_dict['full_path'] | 380 path = callback_function_dict['full_path'] |
| 382 outputs.update(self.generate_code_internal(callback_function, path)) | 381 outputs.update(self.generate_code_internal(callback_function, path)) |
| 383 return outputs | 382 return outputs |
| OLD | NEW |