| 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 monitored | |
| 11 import multiprocessing | 10 import multiprocessing |
| 12 import os | 11 import os |
| 13 import os.path | 12 import os.path |
| 14 import re | 13 import re |
| 15 import sys | 14 import sys |
| 16 import tempfile | 15 import tempfile |
| 17 import time | 16 import time |
| 18 import traceback | 17 import traceback |
| 19 | 18 |
| 20 import idl_validator | 19 import idl_validator |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 """DatabaseBuilder is used for importing and merging interfaces into | 189 """DatabaseBuilder is used for importing and merging interfaces into |
| 191 the Database""" | 190 the Database""" |
| 192 self._database = database | 191 self._database = database |
| 193 self._imported_interfaces = [] | 192 self._imported_interfaces = [] |
| 194 self._impl_stmts = [] | 193 self._impl_stmts = [] |
| 195 self.conditionals_met = set() | 194 self.conditionals_met = set() |
| 196 | 195 |
| 197 # Spin up the new IDL parser. | 196 # Spin up the new IDL parser. |
| 198 self.build = Build(None) | 197 self.build = Build(None) |
| 199 | 198 |
| 200 # Global typedef to mapping. | |
| 201 self.global_type_defs = monitored.Dict('databasebuilder.global_type_defs', { | |
| 202 'Transferable' : 'MessagePort', | |
| 203 }) | |
| 204 | |
| 205 # TODO(terry): Consider keeping richer type information (e.g., | |
| 206 # IdlArrayOrSequenceType from the Blink parser) instead of just | |
| 207 # a type name. | |
| 208 def _resolve_type_defs(self, idl_file): | 199 def _resolve_type_defs(self, idl_file): |
| 200 type_def_map = {} |
| 201 # build map |
| 202 for type_def in idl_file.typeDefs: |
| 203 if type_def.type.id != type_def.id: # sanity check |
| 204 type_def_map[type_def.id] = type_def.type.id |
| 205 # use the map |
| 209 for type_node in idl_file.all(IDLType): | 206 for type_node in idl_file.all(IDLType): |
| 210 type_name = type_node.id | 207 while type_node.id in type_def_map: |
| 211 for typedef in self.global_type_defs: | 208 type_node.id = type_def_map[type_node.id] |
| 212 seq_name_typedef = 'sequence<%s>' % typedef | |
| 213 if type_name == typedef: | |
| 214 type_node.id = self.global_type_defs[typedef] | |
| 215 elif type_name == seq_name_typedef: | |
| 216 type_node.id = 'sequence<%s>' % self.global_type_defs[typedef] | |
| 217 | 209 |
| 218 def _strip_ext_attributes(self, idl_file): | 210 def _strip_ext_attributes(self, idl_file): |
| 219 """Strips unuseful extended attributes.""" | 211 """Strips unuseful extended attributes.""" |
| 220 for ext_attrs in idl_file.all(IDLExtAttrs): | 212 for ext_attrs in idl_file.all(IDLExtAttrs): |
| 221 # TODO: Decide which attributes are uninteresting. | 213 # TODO: Decide which attributes are uninteresting. |
| 222 pass | 214 pass |
| 223 | 215 |
| 224 def _rename_types(self, idl_file, import_options): | 216 def _rename_types(self, idl_file, import_options): |
| 225 """Rename interface and type names with names provided in the | 217 """Rename interface and type names with names provided in the |
| 226 options. Also clears scopes from scoped names""" | 218 options. Also clears scopes from scoped names""" |
| (...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 805 # TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and
fetch | 797 # TODO(antonm): Ideally we'd like to have pristine copy of WebKit IDLs and
fetch |
| 806 # this information directly from it. Unfortunately right now database is
massaged | 798 # this information directly from it. Unfortunately right now database is
massaged |
| 807 # a lot so it's difficult to maintain necessary information on Window itse
lf. | 799 # a lot so it's difficult to maintain necessary information on Window itse
lf. |
| 808 interface = self._database.GetInterface(type) | 800 interface = self._database.GetInterface(type) |
| 809 if 'V8EnabledPerContext' in attr.ext_attrs: | 801 if 'V8EnabledPerContext' in attr.ext_attrs: |
| 810 interface.ext_attrs['synthesizedV8EnabledPerContext'] = \ | 802 interface.ext_attrs['synthesizedV8EnabledPerContext'] = \ |
| 811 attr.ext_attrs['V8EnabledPerContext'] | 803 attr.ext_attrs['V8EnabledPerContext'] |
| 812 if 'V8EnabledAtRuntime' in attr.ext_attrs: | 804 if 'V8EnabledAtRuntime' in attr.ext_attrs: |
| 813 interface.ext_attrs['synthesizedV8EnabledAtRuntime'] = \ | 805 interface.ext_attrs['synthesizedV8EnabledAtRuntime'] = \ |
| 814 attr.ext_attrs['V8EnabledAtRuntime'] or attr.id | 806 attr.ext_attrs['V8EnabledAtRuntime'] or attr.id |
| OLD | NEW |