| 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 202 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 return new StateError("Cannot add new events while doing an addStream"); | 213 return new StateError("Cannot add new events while doing an addStream"); |
| 214 } | 214 } |
| 215 | 215 |
| 216 void add(T data) { | 216 void add(T data) { |
| 217 if (!_mayAddEvent) throw _addEventError(); | 217 if (!_mayAddEvent) throw _addEventError(); |
| 218 _sendData(data); | 218 _sendData(data); |
| 219 } | 219 } |
| 220 | 220 |
| 221 void addError(Object error, [StackTrace stackTrace]) { | 221 void addError(Object error, [StackTrace stackTrace]) { |
| 222 if (!_mayAddEvent) throw _addEventError(); | 222 if (!_mayAddEvent) throw _addEventError(); |
| 223 if (stackTrace != null) _attachStackTrace(error, stackTrace); | |
| 224 _sendError(error, stackTrace); | 223 _sendError(error, stackTrace); |
| 225 } | 224 } |
| 226 | 225 |
| 227 Future close() { | 226 Future close() { |
| 228 if (isClosed) { | 227 if (isClosed) { |
| 229 assert(_doneFuture != null); | 228 assert(_doneFuture != null); |
| 230 return _doneFuture; | 229 return _doneFuture; |
| 231 } | 230 } |
| 232 if (!_mayAddEvent) throw _addEventError(); | 231 if (!_mayAddEvent) throw _addEventError(); |
| 233 _state |= _STATE_CLOSED; | 232 _state |= _STATE_CLOSED; |
| (...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 469 _pauseCount++; | 468 _pauseCount++; |
| 470 } | 469 } |
| 471 void resume() { _resume(null); } | 470 void resume() { _resume(null); } |
| 472 void _resume(_) { | 471 void _resume(_) { |
| 473 if (_pauseCount > 0) _pauseCount--; | 472 if (_pauseCount > 0) _pauseCount--; |
| 474 } | 473 } |
| 475 Future cancel() { return new _Future.immediate(null); } | 474 Future cancel() { return new _Future.immediate(null); } |
| 476 bool get isPaused => _pauseCount > 0; | 475 bool get isPaused => _pauseCount > 0; |
| 477 Future asFuture([Object value]) => new _Future(); | 476 Future asFuture([Object value]) => new _Future(); |
| 478 } | 477 } |
| OLD | NEW |