Chromium Code Reviews| Index: sdk/lib/async/broadcast_stream_controller.dart |
| diff --git a/sdk/lib/async/broadcast_stream_controller.dart b/sdk/lib/async/broadcast_stream_controller.dart |
| index 18ff6543f1067fb57f2cee52b341e4dbe20fc3da..89ff7b31f18db61eb5dea1b30325fc700a1b25ac 100644 |
| --- a/sdk/lib/async/broadcast_stream_controller.dart |
| +++ b/sdk/lib/async/broadcast_stream_controller.dart |
| @@ -180,11 +180,12 @@ abstract class _BroadcastStreamController<T> |
| // _StreamControllerLifecycle interface. |
| StreamSubscription<T> _subscribe(bool cancelOnError) { |
| - if (isClosed) { |
| - throw new StateError("Subscribing to closed stream"); |
| - } |
| StreamSubscription subscription = |
| new _BroadcastSubscription<T>(this, cancelOnError); |
| + if (isClosed) { |
| + subscription._addPending(const _DelayedDone()); |
| + return subscription; |
| + } |
| _addListener(subscription); |
| if (identical(_next, _previous)) { |
| // Only one listener, so it must be the first listener. |
| @@ -313,7 +314,7 @@ abstract class _BroadcastStreamController<T> |
| } |
| } |
| - void _callOnCancel() { |
| + Future _callOnCancel() { |
|
Anders Johnsen
2014/06/02 08:22:50
I see no return statements?
Lasse Reichstein Nielsen
2014/06/02 09:48:25
And I don't remember making this change. Odd.
|
| assert(_isEmpty); |
| if (isClosed && _doneFuture._mayComplete) { |
| // When closed, _doneFuture is not null. |