OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 | 5 |
6 // These factory methods could all live in one factory provider class but dartc | 6 // These factory methods could all live in one factory provider class but dartc |
7 // has a bug (5399939) preventing that. | 7 // has a bug (5399939) preventing that. |
8 | 8 |
9 class _AudioContextFactoryProvider { | 9 class _AudioContextFactoryProvider { |
10 | 10 |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
46 factory Uint8Array.fromBuffer(ArrayBuffer buffer) => _U8(buffer); | 46 factory Uint8Array.fromBuffer(ArrayBuffer buffer) => _U8(buffer); |
47 | 47 |
48 factory Uint16Array(int length) => _U16(length); | 48 factory Uint16Array(int length) => _U16(length); |
49 factory Uint16Array.fromList(List<num> list) => _U16(ensureNative(list)); | 49 factory Uint16Array.fromList(List<num> list) => _U16(ensureNative(list)); |
50 factory Uint16Array.fromBuffer(ArrayBuffer buffer) => _U16(buffer); | 50 factory Uint16Array.fromBuffer(ArrayBuffer buffer) => _U16(buffer); |
51 | 51 |
52 factory Uint32Array(int length) => _U32(length); | 52 factory Uint32Array(int length) => _U32(length); |
53 factory Uint32Array.fromList(List<num> list) => _U32(ensureNative(list)); | 53 factory Uint32Array.fromList(List<num> list) => _U32(ensureNative(list)); |
54 factory Uint32Array.fromBuffer(ArrayBuffer buffer) => _U32(buffer); | 54 factory Uint32Array.fromBuffer(ArrayBuffer buffer) => _U32(buffer); |
55 | 55 |
| 56 factory Uint8ClampedArray(int length) => _U8C(length); |
| 57 factory Uint8ClampedArray.fromList(List<num> list) => _U8C(ensureNative(list))
; |
| 58 factory Uint8ClampedArray.fromBuffer(ArrayBuffer buffer) => _U8C(buffer); |
56 | 59 |
57 static Float32Array _F32(arg) native 'return new Float32Array(arg);'; | 60 static Float32Array _F32(arg) native 'return new Float32Array(arg);'; |
58 static Float64Array _F64(arg) native 'return new Float64Array(arg);'; | 61 static Float64Array _F64(arg) native 'return new Float64Array(arg);'; |
59 static Int8Array _I8(arg) native 'return new Int8Array(arg);'; | 62 static Int8Array _I8(arg) native 'return new Int8Array(arg);'; |
60 static Int16Array _I16(arg) native 'return new Int16Array(arg);'; | 63 static Int16Array _I16(arg) native 'return new Int16Array(arg);'; |
61 static Int32Array _I32(arg) native 'return new Int32Array(arg);'; | 64 static Int32Array _I32(arg) native 'return new Int32Array(arg);'; |
62 static Uint8Array _U8(arg) native 'return new Uint8Array(arg);'; | 65 static Uint8Array _U8(arg) native 'return new Uint8Array(arg);'; |
63 static Uint16Array _U16(arg) native 'return new Uint16Array(arg);'; | 66 static Uint16Array _U16(arg) native 'return new Uint16Array(arg);'; |
64 static Uint32Array _U32(arg) native 'return new Uint32Array(arg);'; | 67 static Uint32Array _U32(arg) native 'return new Uint32Array(arg);'; |
| 68 static Uint8ClampedArray _U8C(arg) native 'return new Uint8ClampedArray(arg);'
; |
65 | 69 |
66 static ensureNative(List list) => list; // TODO: make sure. | 70 static ensureNative(List list) => list; // TODO: make sure. |
67 } | 71 } |
68 | 72 |
69 class _WebKitCSSMatrixFactoryProvider { | 73 class _WebKitCSSMatrixFactoryProvider { |
70 | 74 |
71 factory WebKitCSSMatrix([String spec = '']) native | 75 factory WebKitCSSMatrix([String spec = '']) native |
72 '''return new WebKitCSSMatrix(spec);'''; | 76 '''return new WebKitCSSMatrix(spec);'''; |
73 } | 77 } |
74 | 78 |
75 class _WebKitPointFactoryProvider { | 79 class _WebKitPointFactoryProvider { |
76 | 80 |
77 factory WebKitPoint(num x, num y) native '''return new WebKitPoint(x, y);'''; | 81 factory WebKitPoint(num x, num y) native '''return new WebKitPoint(x, y);'''; |
78 } | 82 } |
79 | 83 |
80 class _WebSocketFactoryProvider { | 84 class _WebSocketFactoryProvider { |
81 | 85 |
82 factory WebSocket(String url) native '''return new WebSocket(url);'''; | 86 factory WebSocket(String url) native '''return new WebSocket(url);'''; |
83 } | 87 } |
84 | 88 |
85 class _XMLHttpRequestFactoryProvider { | 89 class _XMLHttpRequestFactoryProvider { |
86 | 90 |
87 factory XMLHttpRequest() native '''return new XMLHttpRequest();'''; | 91 factory XMLHttpRequest() native '''return new XMLHttpRequest();'''; |
88 } | 92 } |
OLD | NEW |