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