Chromium Code Reviews| Index: runtime/bin/file_impl.dart |
| diff --git a/runtime/bin/file_impl.dart b/runtime/bin/file_impl.dart |
| index 5671f358949e1d2fd3990bbb461f8ab6f8559d8f..8b1b5ec4a694d45a740a6c1e9d0b802acf5ce7bb 100644 |
| --- a/runtime/bin/file_impl.dart |
| +++ b/runtime/bin/file_impl.dart |
| @@ -65,8 +65,11 @@ class _FileInputStream extends _BaseDataInputStream implements InputStream { |
| _closeFile(); |
| return; |
| } |
| + if (_activeFillBufferCall) return; |
|
Ivan Posva
2012/06/12 15:56:52
Comment about buffer filling in flight please.
|
| + _activeFillBufferCall = true; |
| if (_data.length != size) { |
| _data = new Uint8List(size); |
| + _position = _data.length; |
|
Bill Hesse
2012/06/12 15:18:10
This was probably the cause of a bug. It could ca
Ivan Posva
2012/06/12 15:56:52
This is very confusing. Please add a comment expla
|
| } |
| var future = _openedFile.readList(_data, 0, _data.length); |
| future.then((read) { |
| @@ -75,12 +78,18 @@ class _FileInputStream extends _BaseDataInputStream implements InputStream { |
| _data = _data.getRange(0, read); |
| } |
| _position = 0; |
| + _activeFillBufferCall = false; |
| if (_fileLength == _filePosition) { |
| _closeFile(); |
| } |
| _checkScheduleCallbacks(); |
| }); |
| + future.handleException((e) { |
| + _activeFillBufferCall = false; |
| + _reportError(e); |
| + return true; |
| + }); |
| } |
| int available() { |
| @@ -135,6 +144,7 @@ class _FileInputStream extends _BaseDataInputStream implements InputStream { |
| int _position; |
| int _filePosition; |
| int _fileLength; |
| + bool _activeFillBufferCall = false; |
| } |