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

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

Issue 12324004: Add test for whether a completer or stream controller has been closed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. It's isCompleted. Created 7 years, 9 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/future_impl.dart ('k') | tests/lib/async/future_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 // ------------------------------------------------------------------- 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 StreamController({void onPauseStateChange(), 56 StreamController({void onPauseStateChange(),
57 void onSubscriptionStateChange()}) 57 void onSubscriptionStateChange()})
58 : stream = new _SingleControllerStream<T>(onSubscriptionStateChange, 58 : stream = new _SingleControllerStream<T>(onSubscriptionStateChange,
59 onPauseStateChange); 59 onPauseStateChange);
60 60
61 /** 61 /**
62 * Returns a view of this object that only exposes the [StreamSink] interface. 62 * Returns a view of this object that only exposes the [StreamSink] interface.
63 */ 63 */
64 StreamSink<T> get sink => new StreamSinkView<T>(this); 64 StreamSink<T> get sink => new StreamSinkView<T>(this);
65 65
66 /**
67 * Whether the stream is closed for adding more events.
68 *
69 * If true, the "done" event might not have fired yet, but it has been
70 * scheduled, and it is too late to add more events.
71 */
72 bool get isClosed => stream._isClosed;
73
66 /** Whether one or more active subscribers have requested a pause. */ 74 /** Whether one or more active subscribers have requested a pause. */
67 bool get isPaused => stream._isPaused; 75 bool get isPaused => stream._isPaused;
68 76
69 /** Whether there are currently any subscribers on this [Stream]. */ 77 /** Whether there are currently any subscribers on this [Stream]. */
70 bool get hasSubscribers => stream._hasSubscribers; 78 bool get hasSubscribers => stream._hasSubscribers;
71 79
72 /** 80 /**
73 * Send or queue a data event. 81 * Send or queue a data event.
74 */ 82 */
75 void add(T value) => stream._add(value); 83 void add(T value) => stream._add(value);
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 _SingleControllerStream(this._subscriptionHandler, this._pauseHandler); 137 _SingleControllerStream(this._subscriptionHandler, this._pauseHandler);
130 138
131 void _onSubscriptionStateChange() { 139 void _onSubscriptionStateChange() {
132 if (_subscriptionHandler != null) _subscriptionHandler(); 140 if (_subscriptionHandler != null) _subscriptionHandler();
133 } 141 }
134 142
135 void _onPauseStateChange() { 143 void _onPauseStateChange() {
136 if (_pauseHandler != null) _pauseHandler(); 144 if (_pauseHandler != null) _pauseHandler();
137 } 145 }
138 } 146 }
OLDNEW
« no previous file with comments | « sdk/lib/async/future_impl.dart ('k') | tests/lib/async/future_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698