| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 2 # Copyright (c) 2012, 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 """This module provides shared functionality for systems to generate | 6 """This module provides shared functionality for systems to generate |
| 7 Dart APIs from the IDL database.""" | 7 Dart APIs from the IDL database.""" |
| 8 | 8 |
| 9 import copy | 9 import copy |
| 10 import json | 10 import json |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 # factory provider. | 70 # factory provider. |
| 71 # | 71 # |
| 72 interface_factories = monitored.Dict('generator.interface_factories', { | 72 interface_factories = monitored.Dict('generator.interface_factories', { |
| 73 }) | 73 }) |
| 74 | 74 |
| 75 # | 75 # |
| 76 # Custom native specs for the dart2js dom. | 76 # Custom native specs for the dart2js dom. |
| 77 # | 77 # |
| 78 _dart2js_dom_custom_native_specs = monitored.Dict( | 78 _dart2js_dom_custom_native_specs = monitored.Dict( |
| 79 'generator._dart2js_dom_custom_native_specs', { | 79 'generator._dart2js_dom_custom_native_specs', { |
| 80 # Decorate the singleton Console object, if present (workers do not have a | |
| 81 # console). | |
| 82 'Console': "=(typeof console == 'undefined' ? {} : console)", | |
| 83 | 80 |
| 84 # DOMWindow aliased with global scope. | 81 # Nodes with different tags in different browsers can be listed as multiple |
| 85 'Window': '@*DOMWindow', | 82 # tags here provided there is not conflict in usage (e.g. browser X has tag |
| 83 # T and no other browser has tag T). |
| 84 |
| 85 'DOMApplicationCache': |
| 86 'ApplicationCache,DOMApplicationCache,OfflineResourceList', |
| 87 |
| 88 'MutationObserver': 'MutationObserver,WebKitMutationObserver', |
| 89 |
| 90 'TransitionEvent': 'TransitionEvent,WebKitTransitionEvent', |
| 91 |
| 92 'WheelEvent': 'WheelEvent,MouseWheelEvent,MouseScrollEvent', |
| 93 |
| 86 }, dart2jsOnly=True) | 94 }, dart2jsOnly=True) |
| 87 | 95 |
| 88 def IsRegisteredType(type_name): | 96 def IsRegisteredType(type_name): |
| 89 return type_name in _idl_type_registry | 97 return type_name in _idl_type_registry |
| 90 | 98 |
| 91 def MakeNativeSpec(javascript_binding_name): | 99 def MakeNativeSpec(javascript_binding_name): |
| 92 if javascript_binding_name in _dart2js_dom_custom_native_specs: | 100 if javascript_binding_name in _dart2js_dom_custom_native_specs: |
| 93 return _dart2js_dom_custom_native_specs[javascript_binding_name] | 101 return _dart2js_dom_custom_native_specs[javascript_binding_name] |
| 94 else: | 102 else: |
| 95 # Make the class 'hidden' so it is dynamically patched at runtime. This | 103 # Make the class 'hidden' so it is dynamically patched at runtime. This |
| 96 # is useful for browser compat. | 104 # is useful for browser compat. |
| 97 return '*' + javascript_binding_name | 105 return javascript_binding_name |
| 98 | 106 |
| 99 | 107 |
| 100 def MatchSourceFilter(thing): | 108 def MatchSourceFilter(thing): |
| 101 return 'WebKit' in thing.annotations or 'Dart' in thing.annotations | 109 return 'WebKit' in thing.annotations or 'Dart' in thing.annotations |
| 102 | 110 |
| 103 | 111 |
| 104 class ParamInfo(object): | 112 class ParamInfo(object): |
| 105 """Holder for various information about a parameter of a Dart operation. | 113 """Holder for various information about a parameter of a Dart operation. |
| 106 | 114 |
| 107 Attributes: | 115 Attributes: |
| (...skipping 1469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1577 type_name, type_data, dart_interface_name, self) | 1585 type_name, type_data, dart_interface_name, self) |
| 1578 | 1586 |
| 1579 if type_data.clazz == 'BasicTypedList': | 1587 if type_data.clazz == 'BasicTypedList': |
| 1580 dart_interface_name = self._renamer.RenameInterface( | 1588 dart_interface_name = self._renamer.RenameInterface( |
| 1581 self._database.GetInterface(type_name)) | 1589 self._database.GetInterface(type_name)) |
| 1582 return BasicTypedListIDLTypeInfo( | 1590 return BasicTypedListIDLTypeInfo( |
| 1583 type_name, type_data, dart_interface_name, self) | 1591 type_name, type_data, dart_interface_name, self) |
| 1584 | 1592 |
| 1585 class_name = '%sIDLTypeInfo' % type_data.clazz | 1593 class_name = '%sIDLTypeInfo' % type_data.clazz |
| 1586 return globals()[class_name](type_name, type_data) | 1594 return globals()[class_name](type_name, type_data) |
| OLD | NEW |