| 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 621 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 632 | 632 |
| 633 StreamSubscription<T> _subscribe( | 633 StreamSubscription<T> _subscribe( |
| 634 void onData(T data), | 634 void onData(T data), |
| 635 Function onError, | 635 Function onError, |
| 636 void onDone(), | 636 void onDone(), |
| 637 bool cancelOnError) { | 637 bool cancelOnError) { |
| 638 if (!_isInitialState) { | 638 if (!_isInitialState) { |
| 639 throw new StateError("Stream has already been listened to."); | 639 throw new StateError("Stream has already been listened to."); |
| 640 } | 640 } |
| 641 _ControllerSubscription subscription = | 641 _ControllerSubscription subscription = |
| 642 new _ControllerSubscription(this, onData, onError, onDone, | 642 new _ControllerSubscription<T>(this, onData, onError, onDone, |
| 643 cancelOnError); | 643 cancelOnError); |
| 644 | 644 |
| 645 _PendingEvents pendingEvents = _pendingEvents; | 645 _PendingEvents pendingEvents = _pendingEvents; |
| 646 _state |= _STATE_SUBSCRIBED; | 646 _state |= _STATE_SUBSCRIBED; |
| 647 if (_isAddingStream) { | 647 if (_isAddingStream) { |
| 648 _StreamControllerAddStreamState addState = _varData; | 648 _StreamControllerAddStreamState addState = _varData; |
| 649 addState.varData = subscription; | 649 addState.varData = subscription; |
| 650 addState.resume(); | 650 addState.resume(); |
| 651 } else { | 651 } else { |
| 652 _varData = subscription; | 652 _varData = subscription; |
| 653 } | 653 } |
| (...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 907 _StreamControllerAddStreamState(_StreamController controller, | 907 _StreamControllerAddStreamState(_StreamController controller, |
| 908 this.varData, | 908 this.varData, |
| 909 Stream source, | 909 Stream source, |
| 910 bool cancelOnError) | 910 bool cancelOnError) |
| 911 : super(controller, source, cancelOnError) { | 911 : super(controller, source, cancelOnError) { |
| 912 if (controller.isPaused) { | 912 if (controller.isPaused) { |
| 913 addSubscription.pause(); | 913 addSubscription.pause(); |
| 914 } | 914 } |
| 915 } | 915 } |
| 916 } | 916 } |
| OLD | NEW |