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

Unified Diff: runtime/bin/stream_util.dart

Issue 10536168: Close a _FileInputStream only immediately before onClosed is called, so .closed returns false befor… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix extra line break. 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 | tests/standalone/io/file_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/stream_util.dart
diff --git a/runtime/bin/stream_util.dart b/runtime/bin/stream_util.dart
index f8856f7af703064a5109b6ab046aaeb418ed69e7..c6d62b6538b9764f07d090812769e1f102bff8e3 100644
--- a/runtime/bin/stream_util.dart
+++ b/runtime/bin/stream_util.dart
@@ -6,7 +6,7 @@ class _BaseDataInputStream {
abstract int available();
List<int> read([int len]) {
- if (_closeCallbackCalled) return null;
+ if (_closeCallbackCalled || _scheduledCloseCallback != null) return null;
int bytesToRead = available();
if (bytesToRead == 0) {
_checkScheduleCallbacks();
@@ -23,7 +23,7 @@ class _BaseDataInputStream {
}
int readInto(List<int> buffer, [int offset = 0, int len]) {
- if (_closeCallbackCalled) return 0;
+ if (_closeCallbackCalled || _scheduledCloseCallback != null) return 0;
if (len === null) len = buffer.length;
if (offset < 0) throw new StreamException("Illegal offset $offset");
if (len < 0) throw new StreamException("Illegal length $len");
@@ -109,6 +109,7 @@ class _BaseDataInputStream {
void issueCloseCallback(Timer timer) {
_scheduledCloseCallback = null;
+ _closeCallbackCalled = true;
if (_clientCloseHandler !== null) _clientCloseHandler();
}
@@ -120,11 +121,10 @@ class _BaseDataInputStream {
if (_scheduledDataCallback == null) {
_scheduledDataCallback = new Timer(0, issueDataCallback);
}
- } else if (_streamMarkedClosed && !_closeCallbackCalled) {
+ } else if (_streamMarkedClosed && _scheduledCloseCallback == null) {
_cancelScheduledDataCallback();
_close();
_scheduledCloseCallback = new Timer(0, issueCloseCallback);
- _closeCallbackCalled = true;
}
}
}
« no previous file with comments | « no previous file | tests/standalone/io/file_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698