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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
174 definitions.dictionaries[definition_name]) | 174 definitions.dictionaries[definition_name]) |
175 raise ValueError('%s is not in IDL definitions' % definition_name) | 175 raise ValueError('%s is not in IDL definitions' % definition_name) |
176 | 176 |
177 def generate_interface_code(self, definitions, interface_name, interface): | 177 def generate_interface_code(self, definitions, interface_name, interface): |
178 interface_info = self.info_provider.interfaces_info[interface_name] | 178 interface_info = self.info_provider.interfaces_info[interface_name] |
179 full_path = interface_info.get('full_path') | 179 full_path = interface_info.get('full_path') |
180 component = idl_filename_to_component(full_path) | 180 component = idl_filename_to_component(full_path) |
181 include_paths = interface_info.get('dependencies_include_paths') | 181 include_paths = interface_info.get('dependencies_include_paths') |
182 | 182 |
183 # Select appropriate Jinja template and contents function | 183 # Select appropriate Jinja template and contents function |
184 if interface.is_callback: | 184 if interface.is_callback and len(interface.constants) > 0: |
bashi
2017/04/28 06:28:34
Could you add a comment why we use len(interface.c
tkent
2017/04/28 09:22:01
Done.
| |
185 header_template_filename = 'legacy_callback_interface.h.tmpl' | |
186 cpp_template_filename = 'legacy_callback_interface.cpp.tmpl' | |
187 interface_context = v8_callback_interface.legacy_callback_interface_ context | |
188 elif interface.is_callback: | |
185 header_template_filename = 'callback_interface.h.tmpl' | 189 header_template_filename = 'callback_interface.h.tmpl' |
186 cpp_template_filename = 'callback_interface.cpp.tmpl' | 190 cpp_template_filename = 'callback_interface.cpp.tmpl' |
187 interface_context = v8_callback_interface.callback_interface_context | 191 interface_context = v8_callback_interface.callback_interface_context |
188 elif interface.is_partial: | 192 elif interface.is_partial: |
189 interface_context = v8_interface.interface_context | 193 interface_context = v8_interface.interface_context |
190 header_template_filename = 'partial_interface.h.tmpl' | 194 header_template_filename = 'partial_interface.h.tmpl' |
191 cpp_template_filename = 'partial_interface.cpp.tmpl' | 195 cpp_template_filename = 'partial_interface.cpp.tmpl' |
192 interface_name += 'Partial' | 196 interface_name += 'Partial' |
193 assert component == 'core' | 197 assert component == 'core' |
194 component = 'modules' | 198 component = 'modules' |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
385 outputs = set() | 389 outputs = set() |
386 for callback_function_dict in callback_functions.itervalues(): | 390 for callback_function_dict in callback_functions.itervalues(): |
387 if callback_function_dict['component_dir'] != self.target_component: | 391 if callback_function_dict['component_dir'] != self.target_component: |
388 continue | 392 continue |
389 callback_function = callback_function_dict['callback_function'] | 393 callback_function = callback_function_dict['callback_function'] |
390 if 'Custom' in callback_function.extended_attributes: | 394 if 'Custom' in callback_function.extended_attributes: |
391 continue | 395 continue |
392 path = callback_function_dict['full_path'] | 396 path = callback_function_dict['full_path'] |
393 outputs.update(self.generate_code_internal(callback_function, path)) | 397 outputs.update(self.generate_code_internal(callback_function, path)) |
394 return outputs | 398 return outputs |
OLD | NEW |