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

Unified Diff: runtime/bin/file_impl.dart

Issue 10533110: Make sure that _FileInputStream._fillBuffer is not entered again before it finishes. (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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698