| 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 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 % (file_name, e)) | 76 % (file_name, e)) |
| 77 | 77 |
| 78 | 78 |
| 79 class DatabaseBuilder(object): | 79 class DatabaseBuilder(object): |
| 80 def __init__(self, database): | 80 def __init__(self, database): |
| 81 """DatabaseBuilder is used for importing and merging interfaces into | 81 """DatabaseBuilder is used for importing and merging interfaces into |
| 82 the Database""" | 82 the Database""" |
| 83 self._database = database | 83 self._database = database |
| 84 self._imported_interfaces = [] | 84 self._imported_interfaces = [] |
| 85 self._impl_stmts = [] | 85 self._impl_stmts = [] |
| 86 self.conditionals_met = set() |
| 86 | 87 |
| 87 def _resolve_type_defs(self, idl_file): | 88 def _resolve_type_defs(self, idl_file): |
| 88 type_def_map = {} | 89 type_def_map = {} |
| 89 # build map | 90 # build map |
| 90 for type_def in idl_file.typeDefs: | 91 for type_def in idl_file.typeDefs: |
| 91 if type_def.type.id != type_def.id: # sanity check | 92 if type_def.type.id != type_def.id: # sanity check |
| 92 type_def_map[type_def.id] = type_def.type.id | 93 type_def_map[type_def.id] = type_def.type.id |
| 93 # use the map | 94 # use the map |
| 94 for type_node in idl_file.all(IDLType): | 95 for type_node in idl_file.all(IDLType): |
| 95 while type_node.id in type_def_map: | 96 while type_node.id in type_def_map: |
| (...skipping 370 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 466 def _is_node_enabled(self, node, idl_defines): | 467 def _is_node_enabled(self, node, idl_defines): |
| 467 if not 'Conditional' in node.ext_attrs: | 468 if not 'Conditional' in node.ext_attrs: |
| 468 return True | 469 return True |
| 469 | 470 |
| 470 def enabled(condition): | 471 def enabled(condition): |
| 471 return 'ENABLE_%s' % condition in idl_defines | 472 return 'ENABLE_%s' % condition in idl_defines |
| 472 | 473 |
| 473 conditional = node.ext_attrs['Conditional'] | 474 conditional = node.ext_attrs['Conditional'] |
| 474 if conditional.find('&') != -1: | 475 if conditional.find('&') != -1: |
| 475 for condition in conditional.split('&'): | 476 for condition in conditional.split('&'): |
| 477 self.conditionals_met.add(condition) |
| 476 if not enabled(condition): | 478 if not enabled(condition): |
| 477 return False | 479 return False |
| 478 return True | 480 return True |
| 479 | 481 |
| 480 for condition in conditional.split('|'): | 482 for condition in conditional.split('|'): |
| 483 self.conditionals_met.add(condition) |
| 481 if enabled(condition): | 484 if enabled(condition): |
| 482 return True | 485 return True |
| 483 return False | 486 return False |
| 484 | 487 |
| 485 def fix_displacements(self, source): | 488 def fix_displacements(self, source): |
| 486 """E.g. In W3C, something is declared on HTMLDocument but in WebKit | 489 """E.g. In W3C, something is declared on HTMLDocument but in WebKit |
| 487 its on Document, so we need to mark that something in HTMLDocument | 490 its on Document, so we need to mark that something in HTMLDocument |
| 488 with @WebKit(via=Document). The 'via' attribute specifies the | 491 with @WebKit(via=Document). The 'via' attribute specifies the |
| 489 parent interface that has the declaration.""" | 492 parent interface that has the declaration.""" |
| 490 | 493 |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 562 # TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and
fetch | 565 # TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and
fetch |
| 563 # this information directly from it. Unfortunately right now database is
massaged | 566 # this information directly from it. Unfortunately right now database is
massaged |
| 564 # a lot so it's difficult to maintain necessary information on DOMWindow i
tself. | 567 # a lot so it's difficult to maintain necessary information on DOMWindow i
tself. |
| 565 interface = self._database.GetInterface(type) | 568 interface = self._database.GetInterface(type) |
| 566 if 'V8EnabledPerContext' in attr.ext_attrs: | 569 if 'V8EnabledPerContext' in attr.ext_attrs: |
| 567 interface.ext_attrs['synthesizedV8EnabledPerContext'] = \ | 570 interface.ext_attrs['synthesizedV8EnabledPerContext'] = \ |
| 568 attr.ext_attrs['V8EnabledPerContext'] | 571 attr.ext_attrs['V8EnabledPerContext'] |
| 569 if 'V8EnabledAtRuntime' in attr.ext_attrs: | 572 if 'V8EnabledAtRuntime' in attr.ext_attrs: |
| 570 interface.ext_attrs['synthesizedV8EnabledAtRuntime'] = \ | 573 interface.ext_attrs['synthesizedV8EnabledAtRuntime'] = \ |
| 571 attr.ext_attrs['V8EnabledAtRuntime'] or attr.id | 574 attr.ext_attrs['V8EnabledAtRuntime'] or attr.id |
| OLD | NEW |