Chromium Code Reviews| Index: runtime/bin/file_impl.dart |
| =================================================================== |
| --- runtime/bin/file_impl.dart (revision 3627) |
| +++ runtime/bin/file_impl.dart (working copy) |
| @@ -19,10 +19,10 @@ |
| } |
| List<int> _read(int bytesToRead) { |
| - List<int> result = new List<int>(bytesToRead); |
| + List<int> result = new ByteArray(bytesToRead); |
|
cshapiro
2012/01/28 02:25:48
This can be a ByteArray now.
Anders Johnsen
2012/01/30 21:15:28
Done.
|
| int bytesRead = _file.readListSync(result, 0, bytesToRead); |
| if (bytesRead < bytesToRead) { |
| - List<int> buffer = new List<int>(bytesRead); |
| + List<int> buffer = new ByteArray(bytesRead); |
|
cshapiro
2012/01/28 02:25:48
Same here.
Anders Johnsen
2012/01/30 21:15:28
Done.
|
| buffer.copyFrom(result, 0, 0, bytesRead); |
| result = buffer; |
| } |
| @@ -175,7 +175,7 @@ |
| port.toSendPort()); |
| return; |
| } |
| - var buffer = new List(_bytes); |
| + var buffer = new ByteArray(_bytes); |
|
cshapiro
2012/01/28 02:25:48
No need for the unspecific type here. (I don't th
Anders Johnsen
2012/01/30 21:15:28
Done.
|
| var result = |
| new _ReadListResult(_FileUtils.readList(_id, buffer, 0, _bytes), |
| buffer); |
| @@ -424,12 +424,14 @@ |
| // When using the Dart C API access to ObjectArray by index is |
|
cshapiro
2012/01/28 02:25:48
Update this comment. Improvements to the English
Anders Johnsen
2012/01/30 21:15:28
Done.
|
| // currently much faster. This function will make a copy of the |
| // supplied List to an ObjectArray if it isn't already. |
| - ObjectArray outBuffer; |
| + List<int> outBuffer; |
| int outOffset = offset; |
| if (buffer is ObjectArray) { |
| outBuffer = buffer; |
| + } else if (buffer is ByteArray) { |
| + outBuffer = buffer; |
| } else { |
| - outBuffer = new ObjectArray(bytes); |
| + outBuffer = new ByteArray(bytes); |
| outOffset = 0; |
| int j = offset; |
| for (int i = 0; i < bytes; i++) { |