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

Unified Diff: sdk/lib/typed_data/dart2js/native_typed_data_dart2js.dart

Issue 364833002: Add typed data view creation functions on ByteBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 6 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | sdk/lib/typed_data/dart2js/typed_data_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/typed_data/dart2js/native_typed_data_dart2js.dart
diff --git a/sdk/lib/typed_data/dart2js/native_typed_data_dart2js.dart b/sdk/lib/typed_data/dart2js/native_typed_data_dart2js.dart
index c9c025795c7ea8309e93fcba4a8f61c7bbb56c13..afefcae59e39c585558ea27410e735ac0697e138 100644
--- a/sdk/lib/typed_data/dart2js/native_typed_data_dart2js.dart
+++ b/sdk/lib/typed_data/dart2js/native_typed_data_dart2js.dart
@@ -40,6 +40,52 @@ class NativeByteBuffer implements ByteBuffer native "ArrayBuffer" {
final int lengthInBytes;
Type get runtimeType => ByteBuffer;
+
+ Uint8List asUint8List([int offsetInBytes = 0, int length]) {
+ return new NativeUint8List.view(this, offsetInBytes, length);
+ }
+ Int8List asInt8List([int offsetInBytes = 0, int length]) {
+ return new NativeInt8List.view(this, offsetInBytes, length);
+ }
+ Uint8ClampedList asUint8ClampedList([int offsetInBytes = 0, int length]) {
+ return new NativeUint8ClampedList.view(this, offsetInBytes, length);
+ }
+ Uint16List asUint16List([int offsetInBytes = 0, int length]) {
+ return new NativeUint16List.view(this, offsetInBytes, length);
+ }
+ Int16List asInt16List([int offsetInBytes = 0, int length]) {
+ return new NativeInt16List.view(this, offsetInBytes, length);
+ }
+ Uint32List asUint32List([int offsetInBytes = 0, int length]) {
+ return new NativeUint32List.view(this, offsetInBytes, length);
+ }
+ Int32List asInt32List([int offsetInBytes = 0, int length]) {
+ return new NativeInt32List.view(this, offsetInBytes, length);
+ }
+ Uint64List asUint64List([int offsetInBytes = 0, int length]) {
+ throw new UnsupportedError("Uint64List not supported by dart2js.");
+ }
+ Int64List asInt64List([int offsetInBytes = 0, int length]) {
+ throw new UnsupportedError("Int64List not supported by dart2js.");
+ }
+ Int32x4List asInt32x4List([int offsetInBytes = 0, int length]) {
+ return new NativeInt32x4List.view(this, offsetInBytes, length);
+ }
+ Float32List asFloat32List([int offsetInBytes = 0, int length]) {
+ return new NativeFloat32List.view(this, offsetInBytes, length);
+ }
+ Float64List asFloat64List([int offsetInBytes = 0, int length]) {
+ return new NativeFloat64List.view(this, offsetInBytes, length);
+ }
+ Float32x4List asFloat32x4List([int offsetInBytes = 0, int length]) {
+ return new NativeFloat32x4List.view(this, offsetInBytes, length);
+ }
+ Float64x2List asFloat64x2List([int offsetInBytes = 0, int length]) {
+ return new NativeFloat64x2List.view(this, offsetInBytes, length);
+ }
+ ByteData asByteData([int offsetInBytes = 0, int length]) {
+ return new NativeByteData.view(this, offsetInBytes, length);
+ }
}
class NativeTypedData implements TypedData native "ArrayBufferView" {
« no previous file with comments | « runtime/lib/typed_data.dart ('k') | sdk/lib/typed_data/dart2js/typed_data_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698