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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 @property | 82 @property |
83 def typedefs(self): | 83 def typedefs(self): |
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): | 91 def include_path_for_union_types(self, name): |
92 return None | 92 return None |
93 | 93 |
94 | 94 |
95 class ComponentInfoProviderCore(ComponentInfoProvider): | 95 class ComponentInfoProviderCore(ComponentInfoProvider): |
96 def __init__(self, interfaces_info, component_info): | 96 def __init__(self, interfaces_info, component_info): |
97 super(ComponentInfoProviderCore, self).__init__() | 97 super(ComponentInfoProviderCore, self).__init__() |
98 self._interfaces_info = interfaces_info | 98 self._interfaces_info = interfaces_info |
99 self._component_info = component_info | 99 self._component_info = component_info |
100 | 100 |
101 @property | 101 @property |
102 def interfaces_info(self): | 102 def interfaces_info(self): |
103 return self._interfaces_info | 103 return self._interfaces_info |
104 | 104 |
105 @property | 105 @property |
106 def component_info(self): | 106 def component_info(self): |
107 return self._component_info | 107 return self._component_info |
108 | 108 |
109 @property | 109 @property |
110 def enumerations(self): | 110 def enumerations(self): |
111 return self._component_info['enumerations'] | 111 return self._component_info['enumerations'] |
112 | 112 |
113 @property | 113 @property |
114 def typedefs(self): | 114 def typedefs(self): |
115 return self._component_info['typedefs'] | 115 return self._component_info['typedefs'] |
116 | 116 |
117 @property | 117 @property |
118 def union_types(self): | 118 def union_types(self): |
119 return self._component_info['union_types'] | 119 return self._component_info['union_types'] |
120 | 120 |
121 @property | 121 def include_path_for_union_types(self, name): |
122 def include_path_for_union_types(self): | 122 return 'bindings/core/v8/%s.h' % name |
123 return 'bindings/core/v8/UnionTypesCore.h' | |
124 | 123 |
125 @property | 124 @property |
126 def specifier_for_export(self): | 125 def specifier_for_export(self): |
127 return 'CORE_EXPORT ' | 126 return 'CORE_EXPORT ' |
128 | 127 |
129 @property | 128 @property |
130 def include_path_for_export(self): | 129 def include_path_for_export(self): |
131 return 'core/CoreExport.h' | 130 return 'core/CoreExport.h' |
132 | 131 |
133 | 132 |
(...skipping 24 matching lines...) Expand all Loading... |
158 typedefs = self._component_info_core['typedefs'].copy() | 157 typedefs = self._component_info_core['typedefs'].copy() |
159 typedefs.update(self._component_info_modules['typedefs']) | 158 typedefs.update(self._component_info_modules['typedefs']) |
160 return typedefs | 159 return typedefs |
161 | 160 |
162 @property | 161 @property |
163 def union_types(self): | 162 def union_types(self): |
164 # Remove duplicate union types from component_info_modules to avoid | 163 # Remove duplicate union types from component_info_modules to avoid |
165 # generating multiple container generation. | 164 # generating multiple container generation. |
166 return self._component_info_modules['union_types'] - self._component_inf
o_core['union_types'] | 165 return self._component_info_modules['union_types'] - self._component_inf
o_core['union_types'] |
167 | 166 |
168 @property | 167 def include_path_for_union_types(self, name): |
169 def include_path_for_union_types(self): | 168 core_union_type_names = [union_type.name for union_type |
170 return 'bindings/modules/v8/UnionTypesModules.h' | 169 in self._component_info_core['union_types']] |
| 170 if name in core_union_type_names: |
| 171 return 'bindings/core/v8/%s.h' % name |
| 172 return 'bindings/modules/v8/%s.h' % name |
171 | 173 |
172 @property | 174 @property |
173 def specifier_for_export(self): | 175 def specifier_for_export(self): |
174 return 'MODULES_EXPORT ' | 176 return 'MODULES_EXPORT ' |
175 | 177 |
176 @property | 178 @property |
177 def include_path_for_export(self): | 179 def include_path_for_export(self): |
178 return 'modules/ModulesExport.h' | 180 return 'modules/ModulesExport.h' |
179 | 181 |
180 | 182 |
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 extended_attributes_string = match.group(1) | 379 extended_attributes_string = match.group(1) |
378 match = re.search(r'[^=]\bExposed\(([^)]*)\)', file_contents) | 380 match = re.search(r'[^=]\bExposed\(([^)]*)\)', file_contents) |
379 if not match: | 381 if not match: |
380 return None | 382 return None |
381 arguments = [] | 383 arguments = [] |
382 for argument in map(string.strip, match.group(1).split(',')): | 384 for argument in map(string.strip, match.group(1).split(',')): |
383 exposed, runtime_enabled = argument.split() | 385 exposed, runtime_enabled = argument.split() |
384 arguments.append({'exposed': exposed, 'runtime_enabled': runtime_enabled
}) | 386 arguments.append({'exposed': exposed, 'runtime_enabled': runtime_enabled
}) |
385 | 387 |
386 return arguments | 388 return arguments |
OLD | NEW |