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

Side by Side Diff: sdk/lib/async/stream_pipe.dart

Issue 1284223005: Forward cancel subscription in stream pipes. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address comment. Created 5 years, 4 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
« no previous file with comments | « no previous file | tests/language/async_star_regression_fisk_test.dart » ('j') | 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 part of dart.async; 5 part of dart.async;
6 6
7 /** Runs user code and takes actions depending on success or failure. */ 7 /** Runs user code and takes actions depending on success or failure. */
8 _runUserCode(userCode(), 8 _runUserCode(userCode(),
9 onSuccess(value), 9 onSuccess(value),
10 onError(error, StackTrace stackTrace)) { 10 onError(error, StackTrace stackTrace)) {
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 154
155 void _onResume() { 155 void _onResume() {
156 if (_subscription == null) return; 156 if (_subscription == null) return;
157 _subscription.resume(); 157 _subscription.resume();
158 } 158 }
159 159
160 Future _onCancel() { 160 Future _onCancel() {
161 if (_subscription != null) { 161 if (_subscription != null) {
162 StreamSubscription subscription = _subscription; 162 StreamSubscription subscription = _subscription;
163 _subscription = null; 163 _subscription = null;
164 subscription.cancel(); 164 return subscription.cancel();
165 } 165 }
166 return null; 166 return null;
167 } 167 }
168 168
169 // Methods used as listener on source subscription. 169 // Methods used as listener on source subscription.
170 170
171 void _handleData(S data) { 171 void _handleData(S data) {
172 _stream._handleData(data, this); 172 _stream._handleData(data, this);
173 } 173 }
174 174
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after
482 _addErrorWithReplacement(sink, e, s); 482 _addErrorWithReplacement(sink, e, s);
483 return null; 483 return null;
484 } 484 }
485 if (!isEqual) { 485 if (!isEqual) {
486 sink._add(inputEvent); 486 sink._add(inputEvent);
487 _previous = inputEvent; 487 _previous = inputEvent;
488 } 488 }
489 } 489 }
490 } 490 }
491 } 491 }
OLDNEW
« no previous file with comments | « no previous file | tests/language/async_star_regression_fisk_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698