OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 classes for Int8List ..... Float64List and ByteData implementations. | 5 // patch classes for Int8List ..... Float64List and ByteData implementations. |
6 | 6 |
7 import "dart:_internal"; | 7 import "dart:_internal"; |
8 import 'dart:math' show Random; | 8 import 'dart:math' show Random; |
9 | 9 |
10 patch class Int8List { | 10 patch class Int8List { |
(...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
531 int toCid, int fromCid) | 531 int toCid, int fromCid) |
532 native "TypedData_setRange"; | 532 native "TypedData_setRange"; |
533 } | 533 } |
534 | 534 |
535 | 535 |
536 class _ByteBuffer implements ByteBuffer { | 536 class _ByteBuffer implements ByteBuffer { |
537 final _TypedList _data; | 537 final _TypedList _data; |
538 | 538 |
539 _ByteBuffer(this._data); | 539 _ByteBuffer(this._data); |
540 | 540 |
| 541 factory _ByteBuffer._New(data) => new _ByteBuffer(data); |
| 542 |
541 // Forward calls to _data. | 543 // Forward calls to _data. |
542 int get lengthInBytes => _data.lengthInBytes; | 544 int get lengthInBytes => _data.lengthInBytes; |
543 int get hashCode => _data.hashCode; | 545 int get hashCode => _data.hashCode; |
544 bool operator==(Object other) => | 546 bool operator==(Object other) => |
545 (other is _ByteBuffer) && identical(_data, other._data); | 547 (other is _ByteBuffer) && identical(_data, other._data); |
546 | 548 |
547 ByteData asByteData([int offsetInBytes = 0, int length]) { | 549 ByteData asByteData([int offsetInBytes = 0, int length]) { |
548 if (length == null) { | 550 if (length == null) { |
549 length = this.lengthInBytes - offsetInBytes; | 551 length = this.lengthInBytes - offsetInBytes; |
550 } | 552 } |
(...skipping 3008 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3559 return value; | 3561 return value; |
3560 } | 3562 } |
3561 return object; | 3563 return object; |
3562 } | 3564 } |
3563 | 3565 |
3564 | 3566 |
3565 void _throwRangeError(int index, int length) { | 3567 void _throwRangeError(int index, int length) { |
3566 String message = "$index must be in the range [0..$length)"; | 3568 String message = "$index must be in the range [0..$length)"; |
3567 throw new RangeError(message); | 3569 throw new RangeError(message); |
3568 } | 3570 } |
OLD | NEW |