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

Side by Side Diff: sdk/lib/io/file_impl.dart

Issue 13863012: Refactor List.setRange function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Addressed comments. Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/io/buffer_list.dart ('k') | sdk/lib/io/mime_multipart_parser.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 part of dart.io; 5 part of dart.io;
6 6
7 // Read the file in blocks of size 64k. 7 // Read the file in blocks of size 64k.
8 const int _BLOCK_SIZE = 64 * 1024; 8 const int _BLOCK_SIZE = 64 * 1024;
9 9
10 10
(...skipping 718 matching lines...) Expand 10 before | Expand all | Expand 10 after
729 request[0] = _READ_LIST_REQUEST; 729 request[0] = _READ_LIST_REQUEST;
730 request[1] = _id; 730 request[1] = _id;
731 request[2] = bytes; 731 request[2] = bytes;
732 return _fileService.call(request).then((response) { 732 return _fileService.call(request).then((response) {
733 if (_isErrorResponse(response)) { 733 if (_isErrorResponse(response)) {
734 throw _exceptionFromResponse(response, 734 throw _exceptionFromResponse(response,
735 "readList failed for file '$_path'"); 735 "readList failed for file '$_path'");
736 } 736 }
737 var read = response[1]; 737 var read = response[1];
738 var data = response[2]; 738 var data = response[2];
739 buffer.setRange(offset, read, data); 739 buffer.setRange(offset, offset + read, data);
740 return read; 740 return read;
741 }); 741 });
742 } 742 }
743 743
744 static void _checkReadWriteListArguments(int length, int offset, int bytes) { 744 static void _checkReadWriteListArguments(int length, int offset, int bytes) {
745 if (offset < 0) throw new RangeError.value(offset); 745 if (offset < 0) throw new RangeError.value(offset);
746 if (bytes < 0) throw new RangeError.value(bytes); 746 if (bytes < 0) throw new RangeError.value(bytes);
747 if ((offset + bytes) > length) { 747 if ((offset + bytes) > length) {
748 throw new RangeError.value(offset + bytes); 748 throw new RangeError.value(offset + bytes);
749 } 749 }
(...skipping 300 matching lines...) Expand 10 before | Expand all | Expand 10 after
1050 new FileIOException("File closed '$_path'")); 1050 new FileIOException("File closed '$_path'"));
1051 }); 1051 });
1052 return completer.future; 1052 return completer.future;
1053 } 1053 }
1054 1054
1055 final String _path; 1055 final String _path;
1056 int _id; 1056 int _id;
1057 1057
1058 SendPort _fileService; 1058 SendPort _fileService;
1059 } 1059 }
OLDNEW
« no previous file with comments | « sdk/lib/io/buffer_list.dart ('k') | sdk/lib/io/mime_multipart_parser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698