| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 } |
| OLD | NEW |