| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 """Utility functions (file reading, simple IDL parsing by regexes) for IDL build
. | 5 """Utility functions (file reading, simple IDL parsing by regexes) for IDL build
. |
| 6 | 6 |
| 7 Design doc: http://www.chromium.org/developers/design-documents/idl-build | 7 Design doc: http://www.chromium.org/developers/design-documents/idl-build |
| 8 """ | 8 """ |
| 9 | 9 |
| 10 import os | 10 import os |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return {} | 84 return {} |
| 85 | 85 |
| 86 @property | 86 @property |
| 87 def union_types(self): | 87 def union_types(self): |
| 88 return set() | 88 return set() |
| 89 | 89 |
| 90 @property | 90 @property |
| 91 def include_path_for_union_types(self, union_type): | 91 def include_path_for_union_types(self, union_type): |
| 92 return None | 92 return None |
| 93 | 93 |
| 94 @property |
| 95 def callback_functions(self): |
| 96 return {} |
| 97 |
| 94 | 98 |
| 95 class ComponentInfoProviderCore(ComponentInfoProvider): | 99 class ComponentInfoProviderCore(ComponentInfoProvider): |
| 96 def __init__(self, interfaces_info, component_info): | 100 def __init__(self, interfaces_info, component_info): |
| 97 super(ComponentInfoProviderCore, self).__init__() | 101 super(ComponentInfoProviderCore, self).__init__() |
| 98 self._interfaces_info = interfaces_info | 102 self._interfaces_info = interfaces_info |
| 99 self._component_info = component_info | 103 self._component_info = component_info |
| 100 | 104 |
| 101 @property | 105 @property |
| 102 def interfaces_info(self): | 106 def interfaces_info(self): |
| 103 return self._interfaces_info | 107 return self._interfaces_info |
| (...skipping 12 matching lines...) Expand all Loading... |
| 116 | 120 |
| 117 @property | 121 @property |
| 118 def union_types(self): | 122 def union_types(self): |
| 119 return self._component_info['union_types'] | 123 return self._component_info['union_types'] |
| 120 | 124 |
| 121 def include_path_for_union_types(self, union_type): | 125 def include_path_for_union_types(self, union_type): |
| 122 name = shorten_union_name(union_type) | 126 name = shorten_union_name(union_type) |
| 123 return 'bindings/core/v8/%s.h' % name | 127 return 'bindings/core/v8/%s.h' % name |
| 124 | 128 |
| 125 @property | 129 @property |
| 130 def callback_functions(self): |
| 131 return self._component_info['callback_functions'] |
| 132 |
| 133 @property |
| 126 def specifier_for_export(self): | 134 def specifier_for_export(self): |
| 127 return 'CORE_EXPORT ' | 135 return 'CORE_EXPORT ' |
| 128 | 136 |
| 129 @property | 137 @property |
| 130 def include_path_for_export(self): | 138 def include_path_for_export(self): |
| 131 return 'core/CoreExport.h' | 139 return 'core/CoreExport.h' |
| 132 | 140 |
| 133 | 141 |
| 134 class ComponentInfoProviderModules(ComponentInfoProvider): | 142 class ComponentInfoProviderModules(ComponentInfoProvider): |
| 135 def __init__(self, interfaces_info, component_info_core, | 143 def __init__(self, interfaces_info, component_info_core, |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 | 175 |
| 168 def include_path_for_union_types(self, union_type): | 176 def include_path_for_union_types(self, union_type): |
| 169 core_union_type_names = [core_union_type.name for core_union_type | 177 core_union_type_names = [core_union_type.name for core_union_type |
| 170 in self._component_info_core['union_types']] | 178 in self._component_info_core['union_types']] |
| 171 name = shorten_union_name(union_type) | 179 name = shorten_union_name(union_type) |
| 172 if union_type.name in core_union_type_names: | 180 if union_type.name in core_union_type_names: |
| 173 return 'bindings/core/v8/%s.h' % name | 181 return 'bindings/core/v8/%s.h' % name |
| 174 return 'bindings/modules/v8/%s.h' % name | 182 return 'bindings/modules/v8/%s.h' % name |
| 175 | 183 |
| 176 @property | 184 @property |
| 185 def callback_functions(self): |
| 186 callback_functions = self._component_info_core['callback_functions'].cop
y() |
| 187 callback_functions.update(self._component_info_modules['callback_functio
ns']) |
| 188 return callback_functions |
| 189 |
| 190 @property |
| 177 def specifier_for_export(self): | 191 def specifier_for_export(self): |
| 178 return 'MODULES_EXPORT ' | 192 return 'MODULES_EXPORT ' |
| 179 | 193 |
| 180 @property | 194 @property |
| 181 def include_path_for_export(self): | 195 def include_path_for_export(self): |
| 182 return 'modules/ModulesExport.h' | 196 return 'modules/ModulesExport.h' |
| 183 | 197 |
| 184 | 198 |
| 185 def load_interfaces_info_overall_pickle(info_dir): | 199 def load_interfaces_info_overall_pickle(info_dir): |
| 186 with open(os.path.join(info_dir, 'modules', 'InterfacesInfoOverall.pickle'))
as interface_info_file: | 200 with open(os.path.join(info_dir, 'modules', 'InterfacesInfoOverall.pickle'))
as interface_info_file: |
| (...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 | 467 |
| 454 # Remember an open brace. | 468 # Remember an open brace. |
| 455 match = re_last_brace.search(line) | 469 match = re_last_brace.search(line) |
| 456 was_open_brace = (match and match.group('last') == '{' and 'namespace' n
ot in line) | 470 was_open_brace = (match and match.group('last') == '{' and 'namespace' n
ot in line) |
| 457 | 471 |
| 458 # Let |'\n'.join| emit the last newline. | 472 # Let |'\n'.join| emit the last newline. |
| 459 if output: | 473 if output: |
| 460 output.append('') | 474 output.append('') |
| 461 | 475 |
| 462 return '\n'.join(output) | 476 return '\n'.join(output) |
| OLD | NEW |