OLD | NEW |
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 Loading... |
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 Loading... |
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 } |
OLD | NEW |