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

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

Issue 2213193004: Revert "Return futures on Stream.cancel when possible." (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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 | « sdk/lib/async/stream_impl.dart ('k') | tests/lib/async/stream_controller_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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 /** 7 /**
8 * Wraps an [_EventSink] so it exposes only the [EventSink] interface. 8 * Wraps an [_EventSink] so it exposes only the [EventSink] interface.
9 */ 9 */
10 class _EventSinkWrapper<T> implements EventSink<T> { 10 class _EventSinkWrapper<T> implements EventSink<T> {
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 } 102 }
103 103
104 void _onResume() { 104 void _onResume() {
105 if (_isSubscribed) _subscription.resume(); 105 if (_isSubscribed) _subscription.resume();
106 } 106 }
107 107
108 Future _onCancel() { 108 Future _onCancel() {
109 if (_isSubscribed) { 109 if (_isSubscribed) {
110 StreamSubscription subscription = _subscription; 110 StreamSubscription subscription = _subscription;
111 _subscription = null; 111 _subscription = null;
112 return subscription.cancel(); 112 subscription.cancel();
113 } 113 }
114 return null; 114 return null;
115 } 115 }
116 116
117 void _handleData(S data) { 117 void _handleData(S data) {
118 try { 118 try {
119 _transformerSink.add(data); 119 _transformerSink.add(data);
120 } catch (e, s) { 120 } catch (e, s) {
121 _addError(e, s); 121 _addError(e, s);
122 } 122 }
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after
304 void onDone(), 304 void onDone(),
305 bool cancelOnError }) { 305 bool cancelOnError }) {
306 cancelOnError = identical(true, cancelOnError); 306 cancelOnError = identical(true, cancelOnError);
307 StreamSubscription<T> result = _transformer(_stream, cancelOnError); 307 StreamSubscription<T> result = _transformer(_stream, cancelOnError);
308 result.onData(onData); 308 result.onData(onData);
309 result.onError(onError); 309 result.onError(onError);
310 result.onDone(onDone); 310 result.onDone(onDone);
311 return result; 311 return result;
312 } 312 }
313 } 313 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream_impl.dart ('k') | tests/lib/async/stream_controller_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698