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

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

Issue 10914224: Fix http input stream double close problem. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 3 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 | no next file » | 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 _BaseDataInputStream { 5 class _BaseDataInputStream {
6 abstract int available(); 6 abstract int available();
7 7
8 List<int> read([int len]) { 8 List<int> read([int len]) {
9 if (_closeCallbackCalled || _scheduledCloseCallback != null) return null; 9 if (_closeCallbackCalled || _scheduledCloseCallback != null) return null;
10 int bytesToRead = available(); 10 int bytesToRead = available();
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 _clientDataHandler(); 75 _clientDataHandler();
76 } 76 }
77 _checkScheduleCallbacks(); 77 _checkScheduleCallbacks();
78 } 78 }
79 79
80 void _closeReceived() { 80 void _closeReceived() {
81 // Close indication has been received asynchronously. Perform the 81 // Close indication has been received asynchronously. Perform the
82 // close callback now if all data has been delivered. 82 // close callback now if all data has been delivered.
83 _streamMarkedClosed = true; 83 _streamMarkedClosed = true;
84 if (available() == 0) { 84 if (available() == 0) {
85 if (_clientCloseHandler !== null) { 85 _closeCallbackCalled = true;
86 _clientCloseHandler(); 86 if (_clientCloseHandler !== null) _clientCloseHandler();
87 _closeCallbackCalled = true;
88 }
89 } else { 87 } else {
90 _checkScheduleCallbacks(); 88 _checkScheduleCallbacks();
91 } 89 }
92 } 90 }
93 91
94 void _cancelScheduledDataCallback() { 92 void _cancelScheduledDataCallback() {
95 if (_scheduledDataCallback != null) { 93 if (_scheduledDataCallback != null) {
96 _scheduledDataCallback.cancel(); 94 _scheduledDataCallback.cancel();
97 _scheduledDataCallback = null; 95 _scheduledDataCallback = null;
98 } 96 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
202 void _reportError(e) { 200 void _reportError(e) {
203 if (_onError != null) { 201 if (_onError != null) {
204 _onError(e); 202 _onError(e);
205 } else { 203 } else {
206 throw e; 204 throw e;
207 } 205 }
208 } 206 }
209 207
210 Function _onError; 208 Function _onError;
211 } 209 }
OLDNEW
« 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