| Index: sdk/lib/async/stream_impl.dart
|
| diff --git a/sdk/lib/async/stream_impl.dart b/sdk/lib/async/stream_impl.dart
|
| index 0cc3b26e6e6b9d7ca8996bc0f61c229dc534ddab..f99dc83ba23218b7b30b32dec07ba1024bbfbfd0 100644
|
| --- a/sdk/lib/async/stream_impl.dart
|
| +++ b/sdk/lib/async/stream_impl.dart
|
| @@ -219,7 +219,7 @@ abstract class _StreamImpl<T> extends Stream<T> {
|
| void _pause(_StreamListener<T> listener, Signal resumeSignal) {
|
| assert(identical(listener._source, this));
|
| if (!listener._isSubscribed) {
|
| - throw new StateError("Subscription has been unsubscribed.");
|
| + throw new StateError("Subscription has been canceled.");
|
| }
|
| assert(!_isComplete); // There can be no subscribers when complete.
|
| bool wasPaused = _isPaused;
|
| @@ -264,14 +264,14 @@ abstract class _StreamImpl<T> extends Stream<T> {
|
| void _addListener(_StreamSubscriptionImpl subscription);
|
|
|
| /**
|
| - * Handle an unsubscription requested from a [_StreamSubscriptionImpl].
|
| + * Handle a cancel requested from a [_StreamSubscriptionImpl].
|
| *
|
| - * This method is called from [_StreamSubscriptionImpl.unsubscribe].
|
| + * This method is called from [_StreamSubscriptionImpl.cancel].
|
| *
|
| - * If an event is currently firing, the subscription is delayed
|
| - * until after the event has been sent to all subscribers.
|
| + * If an event is currently firing, the cancel is delayed
|
| + * until after the subscribers have received the event.
|
| */
|
| - void _unsubscribe(_StreamSubscriptionImpl subscriber);
|
| + void _cancel(_StreamSubscriptionImpl subscriber);
|
|
|
| /**
|
| * Iterate over all current subscribers and perform an action on each.
|
| @@ -360,7 +360,7 @@ abstract class _StreamImpl<T> extends Stream<T> {
|
| _setComplete();
|
| if (!_hasSubscribers) return;
|
| _forEachSubscriber((subscriber) {
|
| - _unsubscribe(subscriber);
|
| + _cancel(subscriber);
|
| try {
|
| subscriber._sendDone();
|
| } catch (e, s) {
|
| @@ -438,14 +438,14 @@ class _SingleStreamImpl<T> extends _StreamImpl<T> {
|
| }
|
|
|
| /**
|
| - * Handle an unsubscription requested from a [_StreamSubscriptionImpl].
|
| + * Handle a cancel requested from a [_StreamSubscriptionImpl].
|
| *
|
| - * This method is called from [_StreamSubscriptionImpl.unsubscribe].
|
| + * This method is called from [_StreamSubscriptionImpl.cancel].
|
| *
|
| - * If an event is currently firing, the subscription is delayed
|
| - * until after the event has been sent to all subscribers.
|
| + * If an event is currently firing, the cancel is delayed
|
| + * until after the subscriber has received the event.
|
| */
|
| - void _unsubscribe(_StreamSubscriptionImpl subscriber) {
|
| + void _cancel(_StreamSubscriptionImpl subscriber) {
|
| assert(identical(subscriber._source, this));
|
| // We allow unsubscribing the currently firing subscription during
|
| // the event firing, because it is indistinguishable from delaying it since
|
| @@ -580,14 +580,14 @@ class _MultiStreamImpl<T> extends _StreamImpl<T>
|
| }
|
|
|
| /**
|
| - * Handle an unsubscription requested from a [_StreamListener].
|
| + * Handle a cancel requested from a [_StreamListener].
|
| *
|
| - * This method is called from [_StreamListener.unsubscribe].
|
| + * This method is called from [_StreamListener.cancel].
|
| *
|
| - * If an event is currently firing, the unsubscription is delayed
|
| - * until after the event has been sent to all subscribers.
|
| + * If an event is currently firing, the cancel is delayed
|
| + * until after the subscribers have received the event.
|
| */
|
| - void _unsubscribe(_StreamListener listener) {
|
| + void _cancel(_StreamListener listener) {
|
| assert(identical(listener._source, this));
|
| if (_InternalLink.isUnlinked(listener)) {
|
| // You may unsubscribe more than once, only the first one counts.
|
| @@ -673,15 +673,15 @@ class _StreamSubscriptionImpl<T> extends _StreamListener<T>
|
|
|
| void _sendError(AsyncError error) {
|
| _onError(error);
|
| - if (_unsubscribeOnError) _source._unsubscribe(this);
|
| + if (_unsubscribeOnError) _source._cancel(this);
|
| }
|
|
|
| void _sendDone() {
|
| _onDone();
|
| }
|
|
|
| - void unsubscribe() {
|
| - _source._unsubscribe(this);
|
| + void cancel() {
|
| + _source._cancel(this);
|
| }
|
|
|
| void pause([Signal resumeSignal]) {
|
| @@ -985,7 +985,7 @@ class _DoneSubscription<T> implements StreamSubscription<T> {
|
|
|
| void pause([Signal signal]) {
|
| if (_isComplete) {
|
| - throw new StateError("Subscription has been unsubscribed.");
|
| + throw new StateError("Subscription has been canceled.");
|
| }
|
| if (_timer != null) _timer.cancel();
|
| _pauseCount++;
|
| @@ -993,7 +993,7 @@ class _DoneSubscription<T> implements StreamSubscription<T> {
|
|
|
| void resume() {
|
| if (_isComplete) {
|
| - throw new StateError("Subscription has been unsubscribed.");
|
| + throw new StateError("Subscription has been canceled.");
|
| }
|
| if (_pauseCount == 0) return;
|
| _pauseCount--;
|
| @@ -1004,9 +1004,9 @@ class _DoneSubscription<T> implements StreamSubscription<T> {
|
|
|
| bool get isPaused => _pauseCount > 0;
|
|
|
| - void unsubscribe() {
|
| + void cancel() {
|
| if (_isComplete) {
|
| - throw new StateError("Subscription has been unsubscribed.");
|
| + throw new StateError("Subscription has been canceled.");
|
| }
|
| if (_timer != null) {
|
| _timer.cancel();
|
|
|