| 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 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 * The result of binding a StreamTransformer for Sink-mappers. | 164 * The result of binding a StreamTransformer for Sink-mappers. |
| 165 * | 165 * |
| 166 * It contains the bound Stream and the sink-mapper. Only when the user starts | 166 * It contains the bound Stream and the sink-mapper. Only when the user starts |
| 167 * listening to this stream is the sink-mapper invoked. The result is used | 167 * listening to this stream is the sink-mapper invoked. The result is used |
| 168 * to create a StreamSubscription that transforms events. | 168 * to create a StreamSubscription that transforms events. |
| 169 */ | 169 */ |
| 170 class _BoundSinkStream<S, T> extends Stream<T> { | 170 class _BoundSinkStream<S, T> extends Stream<T> { |
| 171 final _SinkMapper<S, T> _sinkMapper; | 171 final _SinkMapper<S, T> _sinkMapper; |
| 172 final Stream<S> _stream; | 172 final Stream<S> _stream; |
| 173 | 173 |
| 174 bool get isBroadcast => _stream.isBroadcast; | |
| 175 | |
| 176 _BoundSinkStream(this._stream, this._sinkMapper); | 174 _BoundSinkStream(this._stream, this._sinkMapper); |
| 177 | 175 |
| 178 StreamSubscription<T> listen(void onData(T event), | 176 StreamSubscription<T> listen(void onData(T event), |
| 179 { Function onError, | 177 { Function onError, |
| 180 void onDone(), | 178 void onDone(), |
| 181 bool cancelOnError }) { | 179 bool cancelOnError }) { |
| 182 cancelOnError = identical(true, cancelOnError); | 180 cancelOnError = identical(true, cancelOnError); |
| 183 StreamSubscription<T> subscription = new _SinkTransformerStreamSubscription( | 181 StreamSubscription<T> subscription = new _SinkTransformerStreamSubscription( |
| 184 _stream, _sinkMapper, cancelOnError); | 182 _stream, _sinkMapper, cancelOnError); |
| 185 subscription.onData(onData); | 183 subscription.onData(onData); |
| (...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 302 void onDone(), | 300 void onDone(), |
| 303 bool cancelOnError }) { | 301 bool cancelOnError }) { |
| 304 cancelOnError = identical(true, cancelOnError); | 302 cancelOnError = identical(true, cancelOnError); |
| 305 StreamSubscription<T> result = _transformer(_stream, cancelOnError); | 303 StreamSubscription<T> result = _transformer(_stream, cancelOnError); |
| 306 result.onData(onData); | 304 result.onData(onData); |
| 307 result.onError(onError); | 305 result.onError(onError); |
| 308 result.onDone(onDone); | 306 result.onDone(onDone); |
| 309 return result; | 307 return result; |
| 310 } | 308 } |
| 311 } | 309 } |
| OLD | NEW |