| OLD | NEW |
| 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 // ------------------------------------------------------------------- | 7 // ------------------------------------------------------------------- |
| 8 // Core Stream types | 8 // Core Stream types |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1007 final Stream<S> _source; | 1007 final Stream<S> _source; |
| 1008 final StreamEventTransformer _transformer; | 1008 final StreamEventTransformer _transformer; |
| 1009 EventTransformStream(Stream<S> source, | 1009 EventTransformStream(Stream<S> source, |
| 1010 StreamEventTransformer<S, T> transformer) | 1010 StreamEventTransformer<S, T> transformer) |
| 1011 : _source = source, _transformer = transformer; | 1011 : _source = source, _transformer = transformer; |
| 1012 | 1012 |
| 1013 StreamSubscription<T> listen(void onData(T data), | 1013 StreamSubscription<T> listen(void onData(T data), |
| 1014 { void onError(AsyncError error), | 1014 { void onError(AsyncError error), |
| 1015 void onDone(), | 1015 void onDone(), |
| 1016 bool unsubscribeOnError }) { | 1016 bool unsubscribeOnError }) { |
| 1017 unsubscribeOnError = identical(true, unsubscribeOnError); |
| 1017 return new _EventTransformStreamSubscription(_source, _transformer, | 1018 return new _EventTransformStreamSubscription(_source, _transformer, |
| 1018 onData, onError, onDone, | 1019 onData, onError, onDone, |
| 1019 unsubscribeOnError); | 1020 unsubscribeOnError); |
| 1020 } | 1021 } |
| 1021 } | 1022 } |
| 1022 | 1023 |
| 1023 class _EventTransformStreamSubscription<S, T> | 1024 class _EventTransformStreamSubscription<S, T> |
| 1024 extends _BaseStreamSubscription<T> | 1025 extends _BaseStreamSubscription<T> |
| 1025 implements _StreamOutputSink<T> { | 1026 implements _StreamOutputSink<T> { |
| 1026 /** The transformer used to transform events. */ | 1027 /** The transformer used to transform events. */ |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1104 } | 1105 } |
| 1105 | 1106 |
| 1106 class _StreamOutputSinkWrapper<T> implements StreamSink<T> { | 1107 class _StreamOutputSinkWrapper<T> implements StreamSink<T> { |
| 1107 _StreamOutputSink _sink; | 1108 _StreamOutputSink _sink; |
| 1108 _StreamOutputSinkWrapper(this._sink); | 1109 _StreamOutputSinkWrapper(this._sink); |
| 1109 | 1110 |
| 1110 void add(T data) => _sink._sendData(data); | 1111 void add(T data) => _sink._sendData(data); |
| 1111 void signalError(AsyncError error) => _sink._sendError(error); | 1112 void signalError(AsyncError error) => _sink._sendError(error); |
| 1112 void close() => _sink._sendDone(); | 1113 void close() => _sink._sendDone(); |
| 1113 } | 1114 } |
| OLD | NEW |