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

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

Issue 11862008: Make Streams also cosider a thrown AsyncError a rethrow. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix indentation. 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
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 // Default implementation of a stream with a controller for adding 8 // Default implementation of a stream with a controller for adding
9 // events to the stream. 9 // events to the stream.
10 // ------------------------------------------------------------------- 10 // -------------------------------------------------------------------
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 * Called when the first listener subscribes or the last unsubscribes. 123 * Called when the first listener subscribes or the last unsubscribes.
124 * 124 *
125 * Read [hasSubscribers] to see what the new state is. 125 * Read [hasSubscribers] to see what the new state is.
126 */ 126 */
127 void onSubscriptionStateChange() {} 127 void onSubscriptionStateChange() {}
128 128
129 void forEachSubscriber(void action(_StreamSubscriptionImpl<T> subscription)) { 129 void forEachSubscriber(void action(_StreamSubscriptionImpl<T> subscription)) {
130 _stream._forEachSubscriber(() { 130 _stream._forEachSubscriber(() {
131 try { 131 try {
132 action(); 132 action();
133 } on AsyncError catch (e) {
134 e.throwDelayed();
133 } catch (e, s) { 135 } catch (e, s) {
134 new AsyncError(e, s).throwDelayed(); 136 new AsyncError(e, s).throwDelayed();
135 } 137 }
136 }); 138 });
137 } 139 }
138 } 140 }
139 141
140 typedef void _NotificationHandler(); 142 typedef void _NotificationHandler();
141 143
142 class _MultiControllerStream<T> extends _MultiStreamImpl<T> { 144 class _MultiControllerStream<T> extends _MultiStreamImpl<T> {
(...skipping 18 matching lines...) Expand all
161 _SingleControllerStream(this._subscriptionHandler, this._pauseHandler); 163 _SingleControllerStream(this._subscriptionHandler, this._pauseHandler);
162 164
163 void _onSubscriptionStateChange() { 165 void _onSubscriptionStateChange() {
164 _subscriptionHandler(); 166 _subscriptionHandler();
165 } 167 }
166 168
167 void _onPauseStateChange() { 169 void _onPauseStateChange() {
168 _pauseHandler(); 170 _pauseHandler();
169 } 171 }
170 } 172 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698