| 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 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 131 def __init__(self, info_provider, cache_dir, output_dir): | 131 def __init__(self, info_provider, cache_dir, output_dir): |
| 132 CodeGeneratorBase.__init__(self, MODULE_PYNAME, info_provider, cache_dir
, output_dir) | 132 CodeGeneratorBase.__init__(self, MODULE_PYNAME, info_provider, cache_dir
, output_dir) |
| 133 self.typedef_resolver = TypedefResolver(info_provider) | 133 self.typedef_resolver = TypedefResolver(info_provider) |
| 134 | 134 |
| 135 def generate_code(self, definitions, definition_name): | 135 def generate_code(self, definitions, definition_name): |
| 136 """Returns .h/.cpp code as ((path, content)...).""" | 136 """Returns .h/.cpp code as ((path, content)...).""" |
| 137 # Set local type info | 137 # Set local type info |
| 138 if not self.should_generate_code(definitions): | 138 if not self.should_generate_code(definitions): |
| 139 return set() | 139 return set() |
| 140 | 140 |
| 141 IdlType.set_callback_functions(definitions.callback_functions.keys()) | |
| 142 # Resolve typedefs | 141 # Resolve typedefs |
| 143 self.typedef_resolver.resolve(definitions, definition_name) | 142 self.typedef_resolver.resolve(definitions, definition_name) |
| 144 return self.generate_code_internal(definitions, definition_name) | 143 return self.generate_code_internal(definitions, definition_name) |
| 145 | 144 |
| 146 def generate_code_internal(self, definitions, definition_name): | 145 def generate_code_internal(self, definitions, definition_name): |
| 147 # This should be implemented in subclasses. | 146 # This should be implemented in subclasses. |
| 148 raise NotImplementedError() | 147 raise NotImplementedError() |
| 149 | 148 |
| 150 | 149 |
| 151 class CodeGeneratorV8(CodeGeneratorV8Base): | 150 class CodeGeneratorV8(CodeGeneratorV8Base): |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 # pylint: disable=W0221 | 365 # pylint: disable=W0221 |
| 367 def generate_code(self): | 366 def generate_code(self): |
| 368 callback_functions = self.info_provider.callback_functions | 367 callback_functions = self.info_provider.callback_functions |
| 369 if not callback_functions: | 368 if not callback_functions: |
| 370 return () | 369 return () |
| 371 outputs = set() | 370 outputs = set() |
| 372 for callback_function_dict in callback_functions.itervalues(): | 371 for callback_function_dict in callback_functions.itervalues(): |
| 373 if callback_function_dict['component_dir'] != self.target_component: | 372 if callback_function_dict['component_dir'] != self.target_component: |
| 374 continue | 373 continue |
| 375 callback_function = callback_function_dict['callback_function'] | 374 callback_function = callback_function_dict['callback_function'] |
| 375 if 'Custom' in callback_function.extended_attributes: |
| 376 continue |
| 376 path = callback_function_dict['full_path'] | 377 path = callback_function_dict['full_path'] |
| 377 outputs.update(self.generate_code_internal(callback_function, path)) | 378 outputs.update(self.generate_code_internal(callback_function, path)) |
| 378 return outputs | 379 return outputs |
| OLD | NEW |