| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 3 # for details. All rights reserved. Use of this source code is governed by a | 3 # for details. All rights reserved. Use of this source code is governed by a |
| 4 # BSD-style license that can be found in the LICENSE file. | 4 # BSD-style license that can be found in the LICENSE file. |
| 5 | 5 |
| 6 import copy | 6 import copy |
| 7 import database | 7 import database |
| 8 import idlparser | 8 import idlparser |
| 9 import logging | 9 import logging |
| 10 import multiprocessing | 10 import multiprocessing |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 def _merge_ext_attrs(self, old_attrs, new_attrs): | 218 def _merge_ext_attrs(self, old_attrs, new_attrs): |
| 219 """Merges two sets of extended attributes. | 219 """Merges two sets of extended attributes. |
| 220 | 220 |
| 221 Returns: True if old_attrs has changed. | 221 Returns: True if old_attrs has changed. |
| 222 """ | 222 """ |
| 223 changed = False | 223 changed = False |
| 224 for (name, value) in new_attrs.items(): | 224 for (name, value) in new_attrs.items(): |
| 225 if name in old_attrs and old_attrs[name] == value: | 225 if name in old_attrs and old_attrs[name] == value: |
| 226 pass # Identical | 226 pass # Identical |
| 227 else: | 227 else: |
| 228 if name == 'ImplementedAs' and name in old_attrs: |
| 229 continue |
| 228 old_attrs[name] = value | 230 old_attrs[name] = value |
| 229 changed = True | 231 changed = True |
| 230 return changed | 232 return changed |
| 231 | 233 |
| 232 def _merge_nodes(self, old_list, new_list, import_options): | 234 def _merge_nodes(self, old_list, new_list, import_options): |
| 233 """Merges two lists of nodes. Annotates nodes with the source of each | 235 """Merges two lists of nodes. Annotates nodes with the source of each |
| 234 node. | 236 node. |
| 235 | 237 |
| 236 Returns: | 238 Returns: |
| 237 True if the old_list has changed. | 239 True if the old_list has changed. |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 self._merge_interfaces(old_interface, interface, import_options) | 392 self._merge_interfaces(old_interface, interface, import_options) |
| 391 else: | 393 else: |
| 392 if import_options.add_new_interfaces: | 394 if import_options.add_new_interfaces: |
| 393 self._database.AddInterface(interface) | 395 self._database.AddInterface(interface) |
| 394 | 396 |
| 395 # Step 3: Merge in supplemental interfaces | 397 # Step 3: Merge in supplemental interfaces |
| 396 for interface, import_options in self._imported_interfaces: | 398 for interface, import_options in self._imported_interfaces: |
| 397 if interface.is_supplemental: | 399 if interface.is_supplemental: |
| 398 target_name = interface.ext_attrs['Supplemental'] | 400 target_name = interface.ext_attrs['Supplemental'] |
| 399 if target_name: | 401 if target_name: |
| 400 # [Supplemental=DOMWindow] - merge into DOMWindow. | 402 # [Supplemental=Window] - merge into Window. |
| 401 target = target_name | 403 target = target_name |
| 402 else: | 404 else: |
| 403 # [Supplemental] - merge into existing inteface with same name. | 405 # [Supplemental] - merge into existing inteface with same name. |
| 404 target = interface.id | 406 target = interface.id |
| 405 if self._database.HasInterface(target): | 407 if self._database.HasInterface(target): |
| 406 old_interface = self._database.GetInterface(target) | 408 old_interface = self._database.GetInterface(target) |
| 407 self._merge_interfaces(old_interface, interface, import_options) | 409 self._merge_interfaces(old_interface, interface, import_options) |
| 408 else: | 410 else: |
| 409 _logger.warning("Supplemental target '%s' not found", target) | 411 _logger.warning("Supplemental target '%s' not found", target) |
| 410 | 412 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 | 446 |
| 445 def enabled(idl_node): | 447 def enabled(idl_node): |
| 446 return self._is_node_enabled(idl_node, import_options.idl_defines) | 448 return self._is_node_enabled(idl_node, import_options.idl_defines) |
| 447 | 449 |
| 448 for interface in idl_file.interfaces: | 450 for interface in idl_file.interfaces: |
| 449 if not self._is_node_enabled(interface, import_options.idl_defines): | 451 if not self._is_node_enabled(interface, import_options.idl_defines): |
| 450 _logger.info('skipping interface %s (source=%s)' | 452 _logger.info('skipping interface %s (source=%s)' |
| 451 % (interface.id, import_options.source)) | 453 % (interface.id, import_options.source)) |
| 452 continue | 454 continue |
| 453 | 455 |
| 454 _logger.info('importing interface %s (source=%s)' | 456 _logger.info('importing interface %s (source=%s file=%s)' |
| 455 % (interface.id, import_options.source)) | 457 % (interface.id, import_options.source, idl_file)) |
| 456 interface.attributes = filter(enabled, interface.attributes) | 458 interface.attributes = filter(enabled, interface.attributes) |
| 457 interface.operations = filter(enabled, interface.operations) | 459 interface.operations = filter(enabled, interface.operations) |
| 458 self._imported_interfaces.append((interface, import_options)) | 460 self._imported_interfaces.append((interface, import_options)) |
| 459 | 461 |
| 460 for implStmt in idl_file.implementsStatements: | 462 for implStmt in idl_file.implementsStatements: |
| 461 self._impl_stmts.append((implStmt, import_options)) | 463 self._impl_stmts.append((implStmt, import_options)) |
| 462 | 464 |
| 463 for enum in idl_file.enums: | 465 for enum in idl_file.enums: |
| 464 self._database.AddEnum(enum) | 466 self._database.AddEnum(enum) |
| 465 | 467 |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 551 if (name in top_level_annotation | 553 if (name in top_level_annotation |
| 552 and value == top_level_annotation[name]): | 554 and value == top_level_annotation[name]): |
| 553 del annotation[name] | 555 del annotation[name] |
| 554 | 556 |
| 555 map(normalize, interface.parents) | 557 map(normalize, interface.parents) |
| 556 map(normalize, interface.constants) | 558 map(normalize, interface.constants) |
| 557 map(normalize, interface.attributes) | 559 map(normalize, interface.attributes) |
| 558 map(normalize, interface.operations) | 560 map(normalize, interface.operations) |
| 559 | 561 |
| 560 def fetch_constructor_data(self, options): | 562 def fetch_constructor_data(self, options): |
| 561 window_interface = self._database.GetInterface('DOMWindow') | 563 window_interface = self._database.GetInterface('Window') |
| 562 for attr in window_interface.attributes: | 564 for attr in window_interface.attributes: |
| 563 type = attr.type.id | 565 type = attr.type.id |
| 564 if not type.endswith('Constructor'): | 566 if not type.endswith('Constructor'): |
| 565 continue | 567 continue |
| 566 type = re.sub('(Constructor)+$', '', type) | 568 type = re.sub('(Constructor)+$', '', type) |
| 567 # TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and
fetch | 569 # TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and
fetch |
| 568 # this information directly from it. Unfortunately right now database is
massaged | 570 # this information directly from it. Unfortunately right now database is
massaged |
| 569 # a lot so it's difficult to maintain necessary information on DOMWindow i
tself. | 571 # a lot so it's difficult to maintain necessary information on Window itse
lf. |
| 570 interface = self._database.GetInterface(type) | 572 interface = self._database.GetInterface(type) |
| 571 if 'V8EnabledPerContext' in attr.ext_attrs: | 573 if 'V8EnabledPerContext' in attr.ext_attrs: |
| 572 interface.ext_attrs['synthesizedV8EnabledPerContext'] = \ | 574 interface.ext_attrs['synthesizedV8EnabledPerContext'] = \ |
| 573 attr.ext_attrs['V8EnabledPerContext'] | 575 attr.ext_attrs['V8EnabledPerContext'] |
| 574 if 'V8EnabledAtRuntime' in attr.ext_attrs: | 576 if 'V8EnabledAtRuntime' in attr.ext_attrs: |
| 575 interface.ext_attrs['synthesizedV8EnabledAtRuntime'] = \ | 577 interface.ext_attrs['synthesizedV8EnabledAtRuntime'] = \ |
| 576 attr.ext_attrs['V8EnabledAtRuntime'] or attr.id | 578 attr.ext_attrs['V8EnabledAtRuntime'] or attr.id |
| OLD | NEW |