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 re | 10 import re |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 # Interface version of the DOM needs to delegate typed array constructors to a | 67 # Interface version of the DOM needs to delegate typed array constructors to a |
68 # factory provider. | 68 # factory provider. |
69 # | 69 # |
70 interface_factories = { | 70 interface_factories = { |
71 'Float32Array': '_TypedArrayFactoryProvider', | 71 'Float32Array': '_TypedArrayFactoryProvider', |
72 'Float64Array': '_TypedArrayFactoryProvider', | 72 'Float64Array': '_TypedArrayFactoryProvider', |
73 'Int8Array': '_TypedArrayFactoryProvider', | 73 'Int8Array': '_TypedArrayFactoryProvider', |
74 'Int16Array': '_TypedArrayFactoryProvider', | 74 'Int16Array': '_TypedArrayFactoryProvider', |
75 'Int32Array': '_TypedArrayFactoryProvider', | 75 'Int32Array': '_TypedArrayFactoryProvider', |
76 'Uint8Array': '_TypedArrayFactoryProvider', | 76 'Uint8Array': '_TypedArrayFactoryProvider', |
| 77 'Uint8ClampedArray': '_TypedArrayFactoryProvider', |
77 'Uint16Array': '_TypedArrayFactoryProvider', | 78 'Uint16Array': '_TypedArrayFactoryProvider', |
78 'Uint32Array': '_TypedArrayFactoryProvider', | 79 'Uint32Array': '_TypedArrayFactoryProvider', |
79 'Uint8ClampedArray': '_TypedArrayFactoryProvider', | |
80 } | 80 } |
81 | 81 |
82 # | 82 # |
83 # Custom native specs for the dart2js dom. | 83 # Custom native specs for the dart2js dom. |
84 # | 84 # |
85 _dart2js_dom_custom_native_specs = { | 85 _dart2js_dom_custom_native_specs = { |
86 # Decorate the singleton Console object, if present (workers do not have a | 86 # Decorate the singleton Console object, if present (workers do not have a |
87 # console). | 87 # console). |
88 'Console': "=(typeof console == 'undefined' ? {} : console)", | 88 'Console': "=(typeof console == 'undefined' ? {} : console)", |
89 | 89 |
(...skipping 755 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
845 def webcore_includes(self): | 845 def webcore_includes(self): |
846 WTF_INCLUDES = [ | 846 WTF_INCLUDES = [ |
847 'ArrayBuffer', | 847 'ArrayBuffer', |
848 'ArrayBufferView', | 848 'ArrayBufferView', |
849 'Float32Array', | 849 'Float32Array', |
850 'Float64Array', | 850 'Float64Array', |
851 'Int8Array', | 851 'Int8Array', |
852 'Int16Array', | 852 'Int16Array', |
853 'Int32Array', | 853 'Int32Array', |
854 'Uint8Array', | 854 'Uint8Array', |
| 855 'Uint8ClampedArray', |
855 'Uint16Array', | 856 'Uint16Array', |
856 'Uint32Array', | 857 'Uint32Array', |
857 'Uint8ClampedArray', | |
858 ] | 858 ] |
859 | 859 |
860 if self._idl_type in WTF_INCLUDES: | 860 if self._idl_type in WTF_INCLUDES: |
861 return ['<wtf/%s.h>' % self.native_type()] | 861 return ['<wtf/%s.h>' % self.native_type()] |
862 | 862 |
863 if not self._idl_type.startswith('SVG'): | 863 if not self._idl_type.startswith('SVG'): |
864 return ['"%s.h"' % self.native_type()] | 864 return ['"%s.h"' % self.native_type()] |
865 | 865 |
866 if self._idl_type in ['SVGNumber', 'SVGPoint']: | 866 if self._idl_type in ['SVGNumber', 'SVGPoint']: |
867 return ['"SVGPropertyTearOff.h"'] | 867 return ['"SVGPropertyTearOff.h"'] |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 'TouchList': TypeData(clazz='Interface', item_type='Touch'), | 1214 'TouchList': TypeData(clazz='Interface', item_type='Touch'), |
1215 'WebKitAnimationList': TypeData(clazz='Interface', | 1215 'WebKitAnimationList': TypeData(clazz='Interface', |
1216 item_type='WebKitAnimation', suppress_interface=True), | 1216 item_type='WebKitAnimation', suppress_interface=True), |
1217 | 1217 |
1218 'Float32Array': TypedArrayTypeData('double'), | 1218 'Float32Array': TypedArrayTypeData('double'), |
1219 'Float64Array': TypedArrayTypeData('double'), | 1219 'Float64Array': TypedArrayTypeData('double'), |
1220 'Int8Array': TypedArrayTypeData('int'), | 1220 'Int8Array': TypedArrayTypeData('int'), |
1221 'Int16Array': TypedArrayTypeData('int'), | 1221 'Int16Array': TypedArrayTypeData('int'), |
1222 'Int32Array': TypedArrayTypeData('int'), | 1222 'Int32Array': TypedArrayTypeData('int'), |
1223 'Uint8Array': TypedArrayTypeData('int'), | 1223 'Uint8Array': TypedArrayTypeData('int'), |
| 1224 'Uint8ClampedArray': TypedArrayTypeData('int'), |
1224 'Uint16Array': TypedArrayTypeData('int'), | 1225 'Uint16Array': TypedArrayTypeData('int'), |
1225 'Uint32Array': TypedArrayTypeData('int'), | 1226 'Uint32Array': TypedArrayTypeData('int'), |
1226 | 1227 |
1227 'SVGAngle': TypeData(clazz='SVGTearOff'), | 1228 'SVGAngle': TypeData(clazz='SVGTearOff'), |
1228 'SVGLength': TypeData(clazz='SVGTearOff'), | 1229 'SVGLength': TypeData(clazz='SVGTearOff'), |
1229 'SVGLengthList': TypeData(clazz='SVGTearOff', item_type='SVGLength'), | 1230 'SVGLengthList': TypeData(clazz='SVGTearOff', item_type='SVGLength'), |
1230 'SVGMatrix': TypeData(clazz='SVGTearOff'), | 1231 'SVGMatrix': TypeData(clazz='SVGTearOff'), |
1231 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<fl
oat>'), | 1232 'SVGNumber': TypeData(clazz='SVGTearOff', native_type='SVGPropertyTearOff<fl
oat>'), |
1232 'SVGNumberList': TypeData(clazz='SVGTearOff', item_type='SVGNumber'), | 1233 'SVGNumberList': TypeData(clazz='SVGTearOff', item_type='SVGNumber'), |
1233 'SVGPathSegList': TypeData(clazz='SVGTearOff', item_type='SVGPathSeg', | 1234 'SVGPathSegList': TypeData(clazz='SVGTearOff', item_type='SVGPathSeg', |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1297 self) | 1298 self) |
1298 | 1299 |
1299 if type_data.clazz == 'SVGTearOff': | 1300 if type_data.clazz == 'SVGTearOff': |
1300 dart_interface_name = self._renamer.RenameInterface( | 1301 dart_interface_name = self._renamer.RenameInterface( |
1301 self._database.GetInterface(type_name)) | 1302 self._database.GetInterface(type_name)) |
1302 return SVGTearOffIDLTypeInfo( | 1303 return SVGTearOffIDLTypeInfo( |
1303 type_name, type_data, dart_interface_name, self) | 1304 type_name, type_data, dart_interface_name, self) |
1304 | 1305 |
1305 class_name = '%sIDLTypeInfo' % type_data.clazz | 1306 class_name = '%sIDLTypeInfo' % type_data.clazz |
1306 return globals()[class_name](type_name, type_data) | 1307 return globals()[class_name](type_name, type_data) |
OLD | NEW |