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

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

Issue 16137009: Fix issue 10898 by fixing the ByteData constructor to implicitly create an ArrayBuffer. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix length <-> byteLength issue. Created 7 years, 7 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 | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
diff --git a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
index d7afeeddc55fed8fb5bad560b5051ce14afc4731..1fcecdbb9b944714642533b45fbc436dae6a9b09 100644
--- a/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
+++ b/sdk/lib/typed_data/dart2js/typed_data_dart2js.dart
@@ -123,22 +123,12 @@ class TypedData native "ArrayBufferView" {
}
class ByteData extends TypedData native "DataView" {
- factory ByteData(int length) => JS('ByteData', 'new DataView(#)', length);
+ factory ByteData(int length) =>
+ _TypedArrayFactoryProvider.createByteData(length);
- factory ByteData.view(ByteBuffer buffer, [int byteOffset, int byteLength]) {
- if (?byteLength) {
- return ByteData._create_1(buffer, byteOffset, byteLength);
- }
- if (?byteOffset) {
- return ByteData._create_2(buffer, byteOffset);
- }
- return ByteData._create_3(buffer);
- }
-
- static ByteData _create_1(buffer, byteOffset, byteLength) =>
- JS('ByteData', 'new DataView(#,#,#)', buffer, byteOffset, byteLength);
- static ByteData _create_2(buffer, byteOffset) => JS('ByteData', 'new DataView(#,#)', buffer, byteOffset);
- static ByteData _create_3(buffer) => JS('ByteData', 'new DataView(#)', buffer);
+ factory ByteData.view(ByteBuffer buffer, [int byteOffset, int byteLength]) =>
+ _TypedArrayFactoryProvider.createByteData_fromBuffer(
+ buffer, byteOffset, byteLength);
num getFloat32(int byteOffset, [Endianness endian=Endianness.BIG_ENDIAN]) =>
_getFloat32(byteOffset, endian._littleEndian);
@@ -2280,7 +2270,7 @@ abstract class Float32x4List implements List<Float32x4>, TypedData {
}
factory Float32x4List.view(ByteBuffer buffer,
- [int offsetInBytes = 0, int length]) {
+ [int offsetInBytes = 0, int length]) {
throw new UnsupportedError("Float32x4List not supported by dart2js.");
}
« no previous file with comments | « no previous file | tests/lib/lib.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698