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

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

Issue 12428005: Avoid uncaught errors inside user code in stream-controller callbacks. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: 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 | « no previous file | no next file » | 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 130 matching lines...) Expand 10 before | Expand all | Expand 10 after
141 141
142 typedef void _NotificationHandler(); 142 typedef void _NotificationHandler();
143 143
144 class _MultiControllerStream<T> extends _MultiStreamImpl<T> { 144 class _MultiControllerStream<T> extends _MultiStreamImpl<T> {
145 _NotificationHandler _subscriptionHandler; 145 _NotificationHandler _subscriptionHandler;
146 _NotificationHandler _pauseHandler; 146 _NotificationHandler _pauseHandler;
147 147
148 _MultiControllerStream(this._subscriptionHandler, this._pauseHandler); 148 _MultiControllerStream(this._subscriptionHandler, this._pauseHandler);
149 149
150 void _onSubscriptionStateChange() { 150 void _onSubscriptionStateChange() {
151 if (_subscriptionHandler != null) _subscriptionHandler(); 151 if (_subscriptionHandler != null) {
152 try {
153 _subscriptionHandler();
154 } catch (e, s) {
155 new AsyncError(e, s).throwDelayed();
156 }
157 }
152 } 158 }
153 159
154 void _onPauseStateChange() { 160 void _onPauseStateChange() {
155 if (_pauseHandler != null) _pauseHandler(); 161 if (_pauseHandler != null) {
162 try {
163 _pauseHandler();
164 } catch (e, s) {
165 new AsyncError(e, s).throwDelayed();
166 }
167 }
156 } 168 }
157 } 169 }
158 170
159 class _SingleControllerStream<T> extends _SingleStreamImpl<T> { 171 class _SingleControllerStream<T> extends _SingleStreamImpl<T> {
160 _NotificationHandler _subscriptionHandler; 172 _NotificationHandler _subscriptionHandler;
161 _NotificationHandler _pauseHandler; 173 _NotificationHandler _pauseHandler;
162 174
163 _SingleControllerStream(this._subscriptionHandler, this._pauseHandler); 175 _SingleControllerStream(this._subscriptionHandler, this._pauseHandler);
164 176
165 void _onSubscriptionStateChange() { 177 void _onSubscriptionStateChange() {
166 if (_subscriptionHandler != null) _subscriptionHandler(); 178 if (_subscriptionHandler != null) {
179 try {
180 _subscriptionHandler();
181 } catch (e, s) {
182 new AsyncError(e, s).throwDelayed();
183 }
184 }
167 } 185 }
168 186
169 void _onPauseStateChange() { 187 void _onPauseStateChange() {
170 if (_pauseHandler != null) _pauseHandler(); 188 if (_pauseHandler != null) {
189 try {
190 _pauseHandler();
191 } catch (e, s) {
192 new AsyncError(e, s).throwDelayed();
193 }
194 }
171 } 195 }
172 } 196 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698