Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Side by Side Diff: sdk/lib/async/stream_impl.dart

Issue 12033019: Make StreamController take on{Pause,Subscription]StateChange as arguments. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « sdk/lib/async/stream_controller.dart ('k') | tests/lib/async/slow_consumer2_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 703 matching lines...) Expand 10 before | Expand all | Expand 10 after
714 stream._sendDone(); 714 stream._sendDone();
715 _isDone = true; 715 _isDone = true;
716 } 716 }
717 } 717 }
718 } 718 }
719 719
720 720
721 /** 721 /**
722 * The subscription class that the [StreamController] uses. 722 * The subscription class that the [StreamController] uses.
723 * 723 *
724 * The [StreamController.createSubscription] method should 724 * The [_StreamImpl.createSubscription] method should
725 * create an object of this type, or another subclass of [_StreamListener]. 725 * create an object of this type, or another subclass of [_StreamListener].
726 * A subclass of [StreamController] can specify which subclass 726 * A subclass of [_StreamImpl] can specify which subclass
727 * of [_StreamSubscriptionImpl] it uses by overriding 727 * of [_StreamSubscriptionImpl] it uses by overriding
728 * [StreamController.createSubscription]. 728 * [_StreamImpl.createSubscription].
729 * 729 *
730 * The subscription is in one of three states: 730 * The subscription is in one of three states:
731 * * Subscribed. 731 * * Subscribed.
732 * * Paused-and-subscribed. 732 * * Paused-and-subscribed.
733 * * Unsubscribed. 733 * * Unsubscribed.
734 * Unsubscribing also unpauses. 734 * Unsubscribing also resumes any pauses started by the subscription.
735 */ 735 */
736 class _StreamSubscriptionImpl<T> extends _StreamListener<T> 736 class _StreamSubscriptionImpl<T> extends _StreamListener<T>
737 implements StreamSubscription<T> { 737 implements StreamSubscription<T> {
738 final bool _unsubscribeOnError; 738 final bool _unsubscribeOnError;
739 // TODO(ahe): Restore type when feature is implemented in dart2js 739 // TODO(ahe): Restore type when feature is implemented in dart2js
740 // checked mode. http://dartbug.com/7733 740 // checked mode. http://dartbug.com/7733
741 var /* _DataHandler<T> */ _onData; 741 var /* _DataHandler<T> */ _onData;
742 _ErrorHandler _onError; 742 _ErrorHandler _onError;
743 _DoneHandler _onDone; 743 _DoneHandler _onDone;
744 _StreamSubscriptionImpl(_StreamImpl source, 744 _StreamSubscriptionImpl(_StreamImpl source,
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
1159 onError: this._signalError, 1159 onError: this._signalError,
1160 onDone: this._close); 1160 onDone: this._close);
1161 } else { 1161 } else {
1162 // TODO(lrn): Check why this can happen. 1162 // TODO(lrn): Check why this can happen.
1163 if (_subscription == null) return; 1163 if (_subscription == null) return;
1164 _subscription.cancel(); 1164 _subscription.cancel();
1165 _subscription = null; 1165 _subscription = null;
1166 } 1166 }
1167 } 1167 }
1168 } 1168 }
OLDNEW
« no previous file with comments | « sdk/lib/async/stream_controller.dart ('k') | tests/lib/async/slow_consumer2_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698