| 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 the systems to generate | 6 """This module provides shared functionality for the systems to generate |
| 7 native binding from the IDL database.""" | 7 native binding from the IDL database.""" |
| 8 | 8 |
| 9 import emitter | 9 import emitter |
| 10 import os | 10 import os |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 ('DOMWindow', 'webkitNotifications'): 'DOMWindowNotifications', | 30 ('DOMWindow', 'webkitNotifications'): 'DOMWindowNotifications', |
| 31 ('DOMWindow', 'storage'): 'DOMWindowQuota', | 31 ('DOMWindow', 'storage'): 'DOMWindowQuota', |
| 32 ('DOMWindow', 'webkitStorageInfo'): 'DOMWindowQuota', | 32 ('DOMWindow', 'webkitStorageInfo'): 'DOMWindowQuota', |
| 33 ('DOMWindow', 'openDatabase'): 'DOMWindowWebDatabase', | 33 ('DOMWindow', 'openDatabase'): 'DOMWindowWebDatabase', |
| 34 ('DOMWindow', 'webkitRequestFileSystem'): 'DOMWindowFileSystem', | 34 ('DOMWindow', 'webkitRequestFileSystem'): 'DOMWindowFileSystem', |
| 35 ('DOMWindow', 'webkitResolveLocalFileSystemURL'): 'DOMWindowFileSystem', | 35 ('DOMWindow', 'webkitResolveLocalFileSystemURL'): 'DOMWindowFileSystem', |
| 36 ('DOMWindow', 'atob'): 'DOMWindowBase64', | 36 ('DOMWindow', 'atob'): 'DOMWindowBase64', |
| 37 ('DOMWindow', 'btoa'): 'DOMWindowBase64', | 37 ('DOMWindow', 'btoa'): 'DOMWindowBase64', |
| 38 ('DOMWindow', 'clearTimeout'): 'DOMWindowTimers', | 38 ('DOMWindow', 'clearTimeout'): 'DOMWindowTimers', |
| 39 ('DOMWindow', 'clearInterval'): 'DOMWindowTimers', | 39 ('DOMWindow', 'clearInterval'): 'DOMWindowTimers', |
| 40 ('DOMWindow', 'createImageBitmap'): 'ImageBitmapFactories', |
| 40 ('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem', | 41 ('HTMLInputElement', 'webkitEntries'): 'HTMLInputElementFileSystem', |
| 41 ('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack', | 42 ('Navigator', 'doNotTrack'): 'NavigatorDoNotTrack', |
| 42 ('Navigator', 'geolocation'): 'NavigatorGeolocation', | 43 ('Navigator', 'geolocation'): 'NavigatorGeolocation', |
| 43 ('Navigator', 'webkitPersistentStorage'): 'NavigatorStorageQuota', | 44 ('Navigator', 'webkitPersistentStorage'): 'NavigatorStorageQuota', |
| 44 ('Navigator', 'webkitTemporaryStorage'): 'NavigatorStorageQuota', | 45 ('Navigator', 'webkitTemporaryStorage'): 'NavigatorStorageQuota', |
| 45 ('Navigator', 'registerProtocolHandler'): 'NavigatorContentUtils', | 46 ('Navigator', 'registerProtocolHandler'): 'NavigatorContentUtils', |
| 46 ('Navigator', 'unregisterProtocolHandler'): 'NavigatorContentUtils', | 47 ('Navigator', 'unregisterProtocolHandler'): 'NavigatorContentUtils', |
| 47 ('Navigator', 'webkitGetUserMedia'): 'NavigatorMediaStream', | 48 ('Navigator', 'webkitGetUserMedia'): 'NavigatorMediaStream', |
| 48 ('Navigator', 'webkitGetGamepads'): 'NavigatorGamepad', | 49 ('Navigator', 'webkitGetGamepads'): 'NavigatorGamepad', |
| 49 ('Navigator', 'requestMIDIAccess'): 'NavigatorWebMIDI', | 50 ('Navigator', 'requestMIDIAccess'): 'NavigatorWebMIDI', |
| 50 ('Navigator', 'vibrate'): 'NavigatorVibration', | 51 ('Navigator', 'vibrate'): 'NavigatorVibration', |
| 52 ('Navigator', 'appName'): 'NavigatorID', |
| 53 ('Navigator', 'appVersion'): 'NavigatorID', |
| 54 ('Navigator', 'platform'): 'NavigatorID', |
| 55 ('Navigator', 'userAgent'): 'NavigatorID', |
| 56 ('Navigator', 'onLine'): 'NavigatorOnLine', |
| 51 ('WorkerGlobalScope', 'crypto'): 'WorkerGlobalScopeCrypto', | 57 ('WorkerGlobalScope', 'crypto'): 'WorkerGlobalScopeCrypto', |
| 52 ('WorkerGlobalScope', 'indexedDB'): 'WorkerGlobalScopeIndexedDatabase', | 58 ('WorkerGlobalScope', 'indexedDB'): 'WorkerGlobalScopeIndexedDatabase', |
| 53 ('WorkerGlobalScope', 'webkitNotifications'): 'WorkerGlobalScopeNotifications'
, | 59 ('WorkerGlobalScope', 'webkitNotifications'): 'WorkerGlobalScopeNotifications'
, |
| 54 ('WorkerGlobalScope', 'openDatabase'): 'WorkerGlobalScopeWebDatabase', | 60 ('WorkerGlobalScope', 'openDatabase'): 'WorkerGlobalScopeWebDatabase', |
| 55 ('WorkerGlobalScope', 'openDatabaseSync'): 'WorkerGlobalScopeWebDatabase', | 61 ('WorkerGlobalScope', 'openDatabaseSync'): 'WorkerGlobalScopeWebDatabase', |
| 56 ('WorkerGlobalScope', 'performance'): 'WorkerGlobalScopePerformance', | 62 ('WorkerGlobalScope', 'performance'): 'WorkerGlobalScopePerformance', |
| 57 ('WorkerGlobalScope', 'webkitRequestFileSystem'): 'WorkerGlobalScopeFileSystem
', | 63 ('WorkerGlobalScope', 'webkitRequestFileSystem'): 'WorkerGlobalScopeFileSystem
', |
| 58 ('WorkerGlobalScope', 'webkitRequestFileSystemSync'): 'WorkerGlobalScopeFileSy
stem', | 64 ('WorkerGlobalScope', 'webkitRequestFileSystemSync'): 'WorkerGlobalScopeFileSy
stem', |
| 59 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemURL'): 'WorkerGlobalScopeFi
leSystem', | 65 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemURL'): 'WorkerGlobalScopeFi
leSystem', |
| 60 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemSyncURL'): 'WorkerGlobalSco
peFileSystem', | 66 ('WorkerGlobalScope', 'webkitResolveLocalFileSystemSyncURL'): 'WorkerGlobalSco
peFileSystem', |
| 61 ('WorkerGlobalScope', 'atob'): 'DOMWindowBase64', | 67 ('WorkerGlobalScope', 'atob'): 'DOMWindowBase64', |
| 62 ('WorkerGlobalScope', 'btoa'): 'DOMWindowBase64', | 68 ('WorkerGlobalScope', 'btoa'): 'DOMWindowBase64', |
| 63 ('WorkerGlobalScope', 'clearTimeout'): 'DOMWindowTimers', | 69 ('WorkerGlobalScope', 'clearTimeout'): 'DOMWindowTimers', |
| 64 ('WorkerGlobalScope', 'clearInterval'): 'DOMWindowTimers', | 70 ('WorkerGlobalScope', 'clearInterval'): 'DOMWindowTimers', |
| 65 } | 71 } |
| 66 | 72 |
| 73 _cpp_import_map = { |
| 74 'ImageBitmapFactories' : 'modules/imagebitmap/ImageBitmapFactories' |
| 75 } |
| 76 |
| 67 _cpp_overloaded_callback_map = { | 77 _cpp_overloaded_callback_map = { |
| 68 ('DOMURL', 'createObjectUrlFromSourceCallback'): 'URLMediaSource', | 78 ('DOMURL', 'createObjectUrlFromSourceCallback'): 'URLMediaSource', |
| 69 ('DOMURL', 'createObjectUrlFromStreamCallback'): 'URLMediaStream', | 79 ('DOMURL', 'createObjectUrlFromStreamCallback'): 'URLMediaStream', |
| 70 ('DOMURL', '_createObjectUrlFromWebKitSourceCallback'): 'URLMediaSource', | 80 ('DOMURL', '_createObjectUrlFromWebKitSourceCallback'): 'URLMediaSource', |
| 71 ('DOMURL', '_createObjectURL_2Callback'): 'URLMediaSource', | 81 ('DOMURL', '_createObjectURL_2Callback'): 'URLMediaSource', |
| 72 ('DOMURL', '_createObjectURL_3Callback'): 'URLMediaSource', | 82 ('DOMURL', '_createObjectURL_3Callback'): 'URLMediaSource', |
| 73 ('DOMURL', '_createObjectURL_4Callback'): 'URLMediaStream', | 83 ('DOMURL', '_createObjectURL_4Callback'): 'URLMediaStream', |
| 74 } | 84 } |
| 75 | 85 |
| 76 _cpp_partial_map = {} | 86 _cpp_partial_map = {} |
| 77 | 87 |
| 78 def _GetCPPPartialNames(interface): | 88 def _GetCPPPartialNames(interface): |
| 79 interface_name = interface.ext_attrs.get('ImplementedAs', interface.id) | 89 interface_name = interface.ext_attrs.get('ImplementedAs', interface.id) |
| 80 if not _cpp_partial_map: | 90 if not _cpp_partial_map: |
| 81 for (type, member) in _cpp_callback_map.keys(): | 91 for (type, member) in _cpp_callback_map.keys(): |
| 82 if type not in _cpp_partial_map: | 92 if type not in _cpp_partial_map: |
| 83 _cpp_partial_map[type] = set([]) | 93 _cpp_partial_map[type] = set([]) |
| 84 _cpp_partial_map[type].add(_cpp_callback_map[(type, member)]) | 94 |
| 95 name_with_path = _cpp_callback_map[(type, member)] |
| 96 if name_with_path in _cpp_import_map: |
| 97 name_with_path = _cpp_import_map[name_with_path] |
| 98 _cpp_partial_map[type].add(name_with_path) |
| 85 | 99 |
| 86 for (type, member) in _cpp_overloaded_callback_map.keys(): | 100 for (type, member) in _cpp_overloaded_callback_map.keys(): |
| 87 if type not in _cpp_partial_map: | 101 if type not in _cpp_partial_map: |
| 88 _cpp_partial_map[type] = set([]) | 102 _cpp_partial_map[type] = set([]) |
| 89 _cpp_partial_map[type].add(_cpp_overloaded_callback_map[(type, member)]) | 103 _cpp_partial_map[type].add(_cpp_overloaded_callback_map[(type, member)]) |
| 90 | 104 |
| 91 if interface_name in _cpp_partial_map: | 105 if interface_name in _cpp_partial_map: |
| 92 return _cpp_partial_map[interface_name] | 106 return _cpp_partial_map[interface_name] |
| 93 else: | 107 else: |
| 94 return set([]) | 108 return set([]) |
| (...skipping 1029 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1124 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' | 1138 ' if (Dart_NativeFunction func = $CLASS_NAME::resolver(name, argu
mentCount))\n' |
| 1125 ' return func;\n', | 1139 ' return func;\n', |
| 1126 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) | 1140 CLASS_NAME=os.path.splitext(os.path.basename(path))[0]) |
| 1127 | 1141 |
| 1128 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): | 1142 def _IsOptionalStringArgumentInInitEventMethod(interface, operation, argument): |
| 1129 return ( | 1143 return ( |
| 1130 interface.id.endswith('Event') and | 1144 interface.id.endswith('Event') and |
| 1131 operation.id.startswith('init') and | 1145 operation.id.startswith('init') and |
| 1132 argument.ext_attrs.get('Default') == 'Undefined' and | 1146 argument.ext_attrs.get('Default') == 'Undefined' and |
| 1133 argument.type.id == 'DOMString') | 1147 argument.type.id == 'DOMString') |
| OLD | NEW |