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

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

Issue 12212016: Remove Expect from core library. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 10 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
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 part of dart.io; 5 part of dart.io;
6 6
7 class _FileInputStream extends _BaseDataInputStream implements InputStream { 7 class _FileInputStream extends _BaseDataInputStream implements InputStream {
8 _FileInputStream(String name) 8 _FileInputStream(String name)
9 : _data = const [], 9 : _data = const [],
10 _position = 0, 10 _position = 0,
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
52 if (available() == 0) _cancelScheduledDataCallback(); 52 if (available() == 0) _cancelScheduledDataCallback();
53 if (!_openedFile.closed) { 53 if (!_openedFile.closed) {
54 _openedFile.close().then((ignore) { 54 _openedFile.close().then((ignore) {
55 _streamMarkedClosed = true; 55 _streamMarkedClosed = true;
56 _checkScheduleCallbacks(); 56 _checkScheduleCallbacks();
57 }); 57 });
58 } 58 }
59 } 59 }
60 60
61 void _fillBuffer() { 61 void _fillBuffer() {
62 Expect.equals(_position, _data.length); 62 assert(_position == _data.length);
63 if (_openedFile == null) return; // Called before the file is opened. 63 if (_openedFile == null) return; // Called before the file is opened.
64 int size = min(_bufferLength, _fileLength - _filePosition); 64 int size = min(_bufferLength, _fileLength - _filePosition);
65 if (size == 0) { 65 if (size == 0) {
66 _closeFile(); 66 _closeFile();
67 return; 67 return;
68 } 68 }
69 // If there is currently a _fillBuffer call waiting on read, 69 // If there is currently a _fillBuffer call waiting on read,
70 // let it fill the buffer instead of us. 70 // let it fill the buffer instead of us.
71 if (_activeFillBufferCall) return; 71 if (_activeFillBufferCall) return;
72 _activeFillBufferCall = true; 72 _activeFillBufferCall = true;
(...skipping 1083 matching lines...) Expand 10 before | Expand all | Expand 10 after
1156 new FileIOException("File closed '$_name'")); 1156 new FileIOException("File closed '$_name'"));
1157 }); 1157 });
1158 return completer.future; 1158 return completer.future;
1159 } 1159 }
1160 1160
1161 final String _name; 1161 final String _name;
1162 int _id; 1162 int _id;
1163 1163
1164 SendPort _fileService; 1164 SendPort _fileService;
1165 } 1165 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698