Chromium Code Reviews| 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 patch class Int8List { | 5 patch class Int8List { |
| 6 /* patch */ factory Int8List(int length) { | 6 /* patch */ factory Int8List(int length) { |
| 7 return new _Int8Array(length); | 7 return new _Int8Array(length); |
| 8 } | 8 } |
| 9 | 9 |
| 10 /* patch */ factory Int8List.transferrable(int length) { | |
| 11 return new _Int8ArrayTransferrable(length); | |
| 12 } | |
| 13 | |
| 10 /* patch */ factory Int8List.view(ByteArray array, | 14 /* patch */ factory Int8List.view(ByteArray array, |
| 11 [int start = 0, int length]) { | 15 [int start = 0, int length]) { |
| 12 return new _Int8ArrayView(array, start, length); | 16 return new _Int8ArrayView(array, start, length); |
| 13 } | 17 } |
| 14 } | 18 } |
| 15 | 19 |
| 16 | 20 |
| 17 patch class Uint8List { | 21 patch class Uint8List { |
| 18 /* patch */ factory Uint8List(int length) { | 22 /* patch */ factory Uint8List(int length) { |
| 19 return new _Uint8Array(length); | 23 return new _Uint8Array(length); |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 340 } | 344 } |
| 341 throw new ArgumentError("$object is not an integer or null"); | 345 throw new ArgumentError("$object is not an integer or null"); |
| 342 } | 346 } |
| 343 | 347 |
| 344 | 348 |
| 345 class _Int8Array extends _ByteArrayBase implements Int8List { | 349 class _Int8Array extends _ByteArrayBase implements Int8List { |
| 346 factory _Int8Array(int length) { | 350 factory _Int8Array(int length) { |
| 347 return _new(length); | 351 return _new(length); |
| 348 } | 352 } |
| 349 | 353 |
| 354 factory _Int8Array.transferrable(int length) { | |
| 355 return _newTransferrable(length); | |
| 356 } | |
| 357 | |
| 350 factory _Int8Array.view(ByteArray array, [int start = 0, int length]) { | 358 factory _Int8Array.view(ByteArray array, [int start = 0, int length]) { |
| 351 if (length == null) { | 359 if (length == null) { |
| 352 length = array.lengthInBytes(); | 360 length = array.lengthInBytes(); |
| 353 } | 361 } |
| 354 return new _Int8ArrayView(array, start, length); | 362 return new _Int8ArrayView(array, start, length); |
| 355 } | 363 } |
| 356 | 364 |
| 357 int operator[](int index) { | 365 int operator[](int index) { |
| 358 return _getIndexed(index); | 366 return _getIndexed(index); |
| 359 } | 367 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 392 return _BYTES_PER_ELEMENT; | 400 return _BYTES_PER_ELEMENT; |
| 393 } | 401 } |
| 394 | 402 |
| 395 int lengthInBytes() { | 403 int lengthInBytes() { |
| 396 return _length() * _BYTES_PER_ELEMENT; | 404 return _length() * _BYTES_PER_ELEMENT; |
| 397 } | 405 } |
| 398 | 406 |
| 399 static const int _BYTES_PER_ELEMENT = 1; | 407 static const int _BYTES_PER_ELEMENT = 1; |
| 400 | 408 |
| 401 static _Int8Array _new(int length) native "Int8Array_new"; | 409 static _Int8Array _new(int length) native "Int8Array_new"; |
| 410 static _Int8Array _newTransferrable(int length) native "Int8Array_newTransferr able"; | |
|
cshapiro
2012/11/28 22:28:01
line break here...
| |
| 402 | 411 |
| 403 int _getIndexed(int index) native "Int8Array_getIndexed"; | 412 int _getIndexed(int index) native "Int8Array_getIndexed"; |
| 404 int _setIndexed(int index, int value) native "Int8Array_setIndexed"; | 413 int _setIndexed(int index, int value) native "Int8Array_setIndexed"; |
| 405 } | 414 } |
| 406 | 415 |
| 407 | 416 |
| 408 class _Uint8Array extends _ByteArrayBase implements Uint8List { | 417 class _Uint8Array extends _ByteArrayBase implements Uint8List { |
| 409 factory _Uint8Array(int length) { | 418 factory _Uint8Array(int length) { |
| 410 return _new(length); | 419 return _new(length); |
| 411 } | 420 } |
| (...skipping 2007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2419 } | 2428 } |
| 2420 _rangeCheck(this.length, start, length); | 2429 _rangeCheck(this.length, start, length); |
| 2421 return _array.subByteArray(_offset + start, length); | 2430 return _array.subByteArray(_offset + start, length); |
| 2422 } | 2431 } |
| 2423 | 2432 |
| 2424 static const int _BYTES_PER_ELEMENT = 8; | 2433 static const int _BYTES_PER_ELEMENT = 8; |
| 2425 final ByteArray _array; | 2434 final ByteArray _array; |
| 2426 final int _offset; | 2435 final int _offset; |
| 2427 final int _length; | 2436 final int _length; |
| 2428 } | 2437 } |
| OLD | NEW |