| 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 // Controller for creating and adding events to a stream. | 8 // Controller for creating and adding events to a stream. |
| 9 // ------------------------------------------------------------------- | 9 // ------------------------------------------------------------------- |
| 10 | 10 |
| (...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 | 652 |
| 653 /** A class that exposes only the [StreamSink] interface of an object. */ | 653 /** A class that exposes only the [StreamSink] interface of an object. */ |
| 654 class _StreamSinkWrapper<T> implements StreamSink<T> { | 654 class _StreamSinkWrapper<T> implements StreamSink<T> { |
| 655 final StreamController _target; | 655 final StreamController _target; |
| 656 _StreamSinkWrapper(this._target); | 656 _StreamSinkWrapper(this._target); |
| 657 void add(T data) { _target.add(data); } | 657 void add(T data) { _target.add(data); } |
| 658 void addError(Object error, [StackTrace stackTrace]) { | 658 void addError(Object error, [StackTrace stackTrace]) { |
| 659 _target.addError(error); | 659 _target.addError(error, stackTrace); |
| 660 } | 660 } |
| 661 Future close() => _target.close(); | 661 Future close() => _target.close(); |
| 662 Future addStream(Stream<T> source) => _target.addStream(source); | 662 Future addStream(Stream<T> source) => _target.addStream(source); |
| 663 Future get done => _target.done; | 663 Future get done => _target.done; |
| 664 } | 664 } |
| 665 | 665 |
| 666 /** | 666 /** |
| 667 * Object containing the state used to handle [StreamController.addStream]. | 667 * Object containing the state used to handle [StreamController.addStream]. |
| 668 */ | 668 */ |
| 669 class _AddStreamState<T> { | 669 class _AddStreamState<T> { |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 715 _StreamControllerAddStreamState(_StreamController controller, | 715 _StreamControllerAddStreamState(_StreamController controller, |
| 716 this.varData, | 716 this.varData, |
| 717 Stream source, | 717 Stream source, |
| 718 bool cancelOnError) | 718 bool cancelOnError) |
| 719 : super(controller, source, cancelOnError) { | 719 : super(controller, source, cancelOnError) { |
| 720 if (controller.isPaused) { | 720 if (controller.isPaused) { |
| 721 addSubscription.pause(); | 721 addSubscription.pause(); |
| 722 } | 722 } |
| 723 } | 723 } |
| 724 } | 724 } |
| OLD | NEW |