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

Side by Side Diff: runtime/bin/file_impl.dart

Issue 10536112: Add missing closed check to random access file. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 6 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 | « no previous file | tests/standalone/io/file_error_test.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) 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 class _FileInputStream extends _BaseDataInputStream implements InputStream { 5 class _FileInputStream extends _BaseDataInputStream implements InputStream {
6 _FileInputStream(String name) { 6 _FileInputStream(String name) {
7 var file = new File(name); 7 var file = new File(name);
8 _data = []; 8 _data = [];
9 _position = 0; 9 _position = 0;
10 var chained = file.open(FileMode.READ).chain((openedFile) { 10 var chained = file.open(FileMode.READ).chain((openedFile) {
(...skipping 713 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 if (result != -1) { 724 if (result != -1) {
725 _id = result; 725 _id = result;
726 return this; 726 return this;
727 } else { 727 } else {
728 throw new FileIOException("Cannot close file '$_name'"); 728 throw new FileIOException("Cannot close file '$_name'");
729 } 729 }
730 }); 730 });
731 } 731 }
732 732
733 void closeSync() { 733 void closeSync() {
734 _checkNotClosed();
734 var id = _FileUtils.close(_id); 735 var id = _FileUtils.close(_id);
735 if (id == -1) { 736 if (id == -1) {
736 throw new FileIOException("Cannot close file '$_name'"); 737 throw new FileIOException("Cannot close file '$_name'");
737 } 738 }
738 _id = id; 739 _id = id;
739 } 740 }
740 741
741 Future<int> readByte() { 742 Future<int> readByte() {
742 _ensureFileService(); 743 _ensureFileService();
743 Completer<int> completer = new Completer<int>(); 744 Completer<int> completer = new Completer<int>();
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after
1090 new FileIOException("File closed '$_name'")); 1091 new FileIOException("File closed '$_name'"));
1091 }); 1092 });
1092 return completer.future; 1093 return completer.future;
1093 } 1094 }
1094 1095
1095 final String _name; 1096 final String _name;
1096 int _id; 1097 int _id;
1097 1098
1098 SendPort _fileService; 1099 SendPort _fileService;
1099 } 1100 }
OLDNEW
« no previous file with comments | « no previous file | tests/standalone/io/file_error_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698