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

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

Issue 15673006: Implement asBroadcast using a _MultiplexStreamController. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Don't keep pending events when calling onCancel. Created 7 years, 6 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 | « no previous file | sdk/lib/async/stream_controller.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 // Core Stream types 8 // Core Stream types
9 // ------------------------------------------------------------------- 9 // -------------------------------------------------------------------
10 10
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 * 151 *
152 * If this stream is single-subscription, return a new stream that allows 152 * If this stream is single-subscription, return a new stream that allows
153 * multiple subscribers. It will subscribe to this stream when its first 153 * multiple subscribers. It will subscribe to this stream when its first
154 * subscriber is added, and unsubscribe again when the last subscription is 154 * subscriber is added, and unsubscribe again when the last subscription is
155 * canceled. 155 * canceled.
156 * 156 *
157 * If this stream is already a broadcast stream, it is returned unmodified. 157 * If this stream is already a broadcast stream, it is returned unmodified.
158 */ 158 */
159 Stream<T> asBroadcastStream() { 159 Stream<T> asBroadcastStream() {
160 if (isBroadcast) return this; 160 if (isBroadcast) return this;
161 return new _SingleStreamMultiplexer<T>(this); 161 return new _AsBroadcastStream<T>(this);
162 } 162 }
163 163
164 /** 164 /**
165 * Adds a subscription to this stream. 165 * Adds a subscription to this stream.
166 * 166 *
167 * On each data event from this stream, the subscriber's [onData] handler 167 * On each data event from this stream, the subscriber's [onData] handler
168 * is called. If [onData] is null, nothing happens. 168 * is called. If [onData] is null, nothing happens.
169 * 169 *
170 * On errors from this stream, the [onError] handler is given a 170 * On errors from this stream, the [onError] handler is given a
171 * object describing the error. 171 * object describing the error.
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1241 * 1241 *
1242 * If a [moveNext] call has been made, it will complete with `false` as value, 1242 * If a [moveNext] call has been made, it will complete with `false` as value,
1243 * as will all further calls to [moveNext]. 1243 * as will all further calls to [moveNext].
1244 * 1244 *
1245 * If you need to stop listening for values before the stream iterator is 1245 * If you need to stop listening for values before the stream iterator is
1246 * automatically closed, you must call [cancel] to ensure that the stream 1246 * automatically closed, you must call [cancel] to ensure that the stream
1247 * is properly closed. 1247 * is properly closed.
1248 */ 1248 */
1249 void cancel(); 1249 void cancel();
1250 } 1250 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698