| 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 // States shared by single/multi stream implementations. | 7 // States shared by single/multi stream implementations. |
| 8 | 8 |
| 9 /// Initial and default state where the stream can receive and send events. | 9 /// Initial and default state where the stream can receive and send events. |
| 10 const int _STREAM_OPEN = 0; | 10 const int _STREAM_OPEN = 0; |
| (...skipping 625 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 636 * | 636 * |
| 637 * The subscription is in one of three states: | 637 * The subscription is in one of three states: |
| 638 * * Subscribed. | 638 * * Subscribed. |
| 639 * * Paused-and-subscribed. | 639 * * Paused-and-subscribed. |
| 640 * * Unsubscribed. | 640 * * Unsubscribed. |
| 641 * Unsubscribing also unpauses. | 641 * Unsubscribing also unpauses. |
| 642 */ | 642 */ |
| 643 class _StreamSubscriptionImpl<T> extends _StreamListener<T> | 643 class _StreamSubscriptionImpl<T> extends _StreamListener<T> |
| 644 implements StreamSubscription<T> { | 644 implements StreamSubscription<T> { |
| 645 final bool _unsubscribeOnError; | 645 final bool _unsubscribeOnError; |
| 646 _DataHandler<T> _onData; | 646 // TODO(ahe): Restore type when feature is implemented in dart2js |
| 647 // checked mode. |
| 648 var /* _DataHandler<T> */ _onData; |
| 647 _ErrorHandler _onError; | 649 _ErrorHandler _onError; |
| 648 _DoneHandler _onDone; | 650 _DoneHandler _onDone; |
| 649 _StreamSubscriptionImpl(_StreamImpl source, | 651 _StreamSubscriptionImpl(_StreamImpl source, |
| 650 this._onData, | 652 this._onData, |
| 651 this._onError, | 653 this._onError, |
| 652 this._onDone, | 654 this._onDone, |
| 653 this._unsubscribeOnError) : super(source); | 655 this._unsubscribeOnError) : super(source); |
| 654 | 656 |
| 655 void onData(void handleData(T event)) { | 657 void onData(void handleData(T event)) { |
| 656 if (handleData == null) handleData = _nullDataHandler; | 658 if (handleData == null) handleData = _nullDataHandler; |
| (...skipping 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1008 if (_isComplete) { | 1010 if (_isComplete) { |
| 1009 throw new StateError("Subscription has been canceled."); | 1011 throw new StateError("Subscription has been canceled."); |
| 1010 } | 1012 } |
| 1011 if (_timer != null) { | 1013 if (_timer != null) { |
| 1012 _timer.cancel(); | 1014 _timer.cancel(); |
| 1013 _timer = null; | 1015 _timer = null; |
| 1014 } | 1016 } |
| 1015 _pauseCount = 0; | 1017 _pauseCount = 0; |
| 1016 } | 1018 } |
| 1017 } | 1019 } |
| OLD | NEW |