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

Unified Diff: sdk/lib/async/broadcast_stream_controller.dart

Issue 301193010: Update documentation for "close". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Add tests. Don't throw if listening on broadcast stream after close. Created 6 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | sdk/lib/async/stream.dart » ('j') | sdk/lib/async/stream.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « no previous file | sdk/lib/async/stream.dart » ('j') | sdk/lib/async/stream.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698