Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(712)

Side by Side Diff: client/dom/src/_FactoryProviders.dart

Issue 8889001: Implement typed array constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: comment Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « client/dom/scripts/template_wrapping_dom.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 _FileReaderFactoryProvider { 9 class _FileReaderFactoryProvider {
10 10
11 factory FileReader() { return create(); } 11 factory FileReader() { return create(); }
12 12
13 static FileReader create() native; 13 static FileReader create() native;
14 } 14 }
15 15
16 class _TypedArrayFactoryProvider {
17
18 factory Float32Array(int length) => _F32(length);
19 factory Float32Array.fromList(List<num> list) => _F32(ensureNative(list));
20 factory Float32Array.fromBuffer(ArrayBuffer buffer) => _F32(buffer);
21
22 factory Float64Array(int length) => _F64(length);
23 factory Float64Array.fromList(List<num> list) => _F64(ensureNative(list));
24 factory Float64Array.fromBuffer(ArrayBuffer buffer) => _F64(buffer);
25
26 factory Int8Array(int length) => _I8(length);
27 factory Int8Array.fromList(List<num> list) => _I8(ensureNative(list));
28 factory Int8Array.fromBuffer(ArrayBuffer buffer) => _I8(buffer);
29
30 factory Int16Array(int length) => _I16(length);
31 factory Int16Array.fromList(List<num> list) => _I16(ensureNative(list));
32 factory Int16Array.fromBuffer(ArrayBuffer buffer) => _I16(buffer);
33
34 factory Int32Array(int length) => _I32(length);
35 factory Int32Array.fromList(List<num> list) => _I32(ensureNative(list));
36 factory Int32Array.fromBuffer(ArrayBuffer buffer) => _I32(buffer);
37
38 factory Uint8Array(int length) => _U8(length);
39 factory Uint8Array.fromList(List<num> list) => _U8(ensureNative(list));
40 factory Uint8Array.fromBuffer(ArrayBuffer buffer) => _U8(buffer);
41
42 factory Uint16Array(int length) => _U16(length);
43 factory Uint16Array.fromList(List<num> list) => _U16(ensureNative(list));
44 factory Uint16Array.fromBuffer(ArrayBuffer buffer) => _U16(buffer);
45
46 factory Uint32Array(int length) => _U32(length);
47 factory Uint32Array.fromList(List<num> list) => _U32(ensureNative(list));
48 factory Uint32Array.fromBuffer(ArrayBuffer buffer) => _U32(buffer);
49
50
51 static Float32Array _F32(arg) native;
52 static Float32Array _F64(arg) native;
53 static Float32Array _I8(arg) native;
54 static Float32Array _I16(arg) native;
55 static Float32Array _I32(arg) native;
56 static Float32Array _U8(arg) native;
57 static Float32Array _U16(arg) native;
58 static Float32Array _U32(arg) native;
59
60 static ensureNative(List list) => list; // TODO: make sure.
61 }
62
16 class _WebKitCSSMatrixFactoryProvider { 63 class _WebKitCSSMatrixFactoryProvider {
17 64
18 factory WebKitCSSMatrix([String spec = '']) { return create(spec); } 65 factory WebKitCSSMatrix([String spec = '']) { return create(spec); }
19 66
20 static WebKitCSSMatrix create(spec) native; 67 static WebKitCSSMatrix create(spec) native;
21 } 68 }
22 69
23 class _WebKitPointFactoryProvider { 70 class _WebKitPointFactoryProvider {
24 71
25 factory WebKitPoint(num x, num y) { return create(x, y); } 72 factory WebKitPoint(num x, num y) { return create(x, y); }
26 73
27 static WebKitPoint create(x, y) native; 74 static WebKitPoint create(x, y) native;
28 } 75 }
29 76
30 class _XMLHttpRequestFactoryProvider { 77 class _XMLHttpRequestFactoryProvider {
31 78
32 factory XMLHttpRequest() { return create(); } 79 factory XMLHttpRequest() { return create(); }
33 80
34 static XMLHttpRequest create() native; 81 static XMLHttpRequest create() native;
35 } 82 }
OLDNEW
« no previous file with comments | « client/dom/scripts/template_wrapping_dom.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698