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

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

Issue 598993002: Add missing null-tests to async error functions. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add co19 issue number to status file. Created 6 years, 2 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/future.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 class _BroadcastStream<T> extends _ControllerStream<T> { 7 class _BroadcastStream<T> extends _ControllerStream<T> {
8 _BroadcastStream(_StreamControllerLifecycle controller) : super(controller); 8 _BroadcastStream(_StreamControllerLifecycle controller) : super(controller);
9 9
10 bool get isBroadcast => true; 10 bool get isBroadcast => true;
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 assert(_isAddingStream); 231 assert(_isAddingStream);
232 return new StateError("Cannot add new events while doing an addStream"); 232 return new StateError("Cannot add new events while doing an addStream");
233 } 233 }
234 234
235 void add(T data) { 235 void add(T data) {
236 if (!_mayAddEvent) throw _addEventError(); 236 if (!_mayAddEvent) throw _addEventError();
237 _sendData(data); 237 _sendData(data);
238 } 238 }
239 239
240 void addError(Object error, [StackTrace stackTrace]) { 240 void addError(Object error, [StackTrace stackTrace]) {
241 error = _nonNullError(error);
241 if (!_mayAddEvent) throw _addEventError(); 242 if (!_mayAddEvent) throw _addEventError();
242 AsyncError replacement = Zone.current.errorCallback(error, stackTrace); 243 AsyncError replacement = Zone.current.errorCallback(error, stackTrace);
243 if (replacement != null) { 244 if (replacement != null) {
244 error = replacement.error; 245 error = _nonNullError(replacement.error);
245 stackTrace = replacement.stackTrace; 246 stackTrace = replacement.stackTrace;
246 } 247 }
247 _sendError(error, stackTrace); 248 _sendError(error, stackTrace);
248 } 249 }
249 250
250 Future close() { 251 Future close() {
251 if (isClosed) { 252 if (isClosed) {
252 assert(_doneFuture != null); 253 assert(_doneFuture != null);
253 return _doneFuture; 254 return _doneFuture;
254 } 255 }
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 _pauseCount++; 503 _pauseCount++;
503 } 504 }
504 void resume() { _resume(null); } 505 void resume() { _resume(null); }
505 void _resume(_) { 506 void _resume(_) {
506 if (_pauseCount > 0) _pauseCount--; 507 if (_pauseCount > 0) _pauseCount--;
507 } 508 }
508 Future cancel() { return new _Future.immediate(null); } 509 Future cancel() { return new _Future.immediate(null); }
509 bool get isPaused => _pauseCount > 0; 510 bool get isPaused => _pauseCount > 0;
510 Future asFuture([Object value]) => new _Future(); 511 Future asFuture([Object value]) => new _Future();
511 } 512 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/future.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698