| Index: sdk/lib/io/common.dart
|
| ===================================================================
|
| --- sdk/lib/io/common.dart (revision 24619)
|
| +++ sdk/lib/io/common.dart (working copy)
|
| @@ -97,23 +97,12 @@
|
| }
|
|
|
| // Ensure that the input List can be serialized through a native port.
|
| -// Only builtin Lists can be serialized through. If user-defined Lists
|
| -// get here, the contents is copied to a Uint8List. This has the added
|
| +// Only Int8List and Uint8List Lists are serialized directly.
|
| +// All other lists are first copied into a Uint8List. This has the added
|
| // benefit that it is faster to access from the C code as well.
|
| -_BufferAndStart _ensureFastAndSerializableData(
|
| +_BufferAndStart _ensureFastAndSerializableByteData(
|
| List buffer, int start, int end) {
|
| - if (buffer is Uint8List ||
|
| - buffer is Int8List ||
|
| - buffer is Uint16List ||
|
| - buffer is Int16List ||
|
| - buffer is Uint32List ||
|
| - buffer is Int32List ||
|
| - buffer is Uint64List ||
|
| - buffer is Int64List ||
|
| - buffer is ByteData ||
|
| - buffer is Float32List ||
|
| - buffer is Float64List ||
|
| - _BufferUtils._isBuiltinList(buffer)) {
|
| + if (buffer is Uint8List || buffer is Int8List) {
|
| return new _BufferAndStart(buffer, start);
|
| }
|
| int length = end - start;
|
| @@ -131,37 +120,6 @@
|
| }
|
|
|
|
|
| -_BufferAndStart _ensureFastAndSerializableByteData(
|
| - List buffer, int start, int end) {
|
| - if (buffer is Uint8List) {
|
| - return new _BufferAndStart(buffer, start);
|
| - }
|
| - int length = end - start;
|
| - var newBuffer = new Uint8List(length);
|
| - int j = start;
|
| - for (int i = 0; i < length; i++) {
|
| - int value = buffer[j];
|
| - if (value is! int ||
|
| - value < 0 || 255 < value) {
|
| - throw new ArgumentError(
|
| - "List element is not a byte value (value $value at index $j)");
|
| - }
|
| - newBuffer[i] = value;
|
| - j++;
|
| - }
|
| - return new _BufferAndStart(newBuffer, 0);
|
| -}
|
| -
|
| -
|
| -// TODO(ager): The only reason for the class here is that
|
| -// we cannot patch a top-level function.
|
| -class _BufferUtils {
|
| - // Check if a List is a builtin VM List type. Returns true
|
| - // if the List is a builtin VM List type and false if it is
|
| - // a user defined List type.
|
| - external static bool _isBuiltinList(List buffer);
|
| -}
|
| -
|
| class _IOCrypto {
|
| external static Uint8List getRandomBytes(int count);
|
| }
|
|
|