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

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

Issue 1278873008: Add getters for callbacks on StreamController. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Fix incorrect return type on broadcast stream controller. Created 5 years, 4 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_controller.dart » ('j') | no next file with comments »
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 e5a1efc777d0e212c2ea3ae37b2622d024f5a071..6f4ddab11c5156fe17302360b3052d655d63b7a6 100644
--- a/sdk/lib/async/broadcast_stream_controller.dart
+++ b/sdk/lib/async/broadcast_stream_controller.dart
@@ -79,8 +79,8 @@ abstract class _BroadcastStreamController<T>
static const int _STATE_CLOSED = 4;
static const int _STATE_ADDSTREAM = 8;
- _NotificationHandler _onListen;
- _NotificationHandler _onCancel;
+ ControllerCallback onListen;
+ ControllerCancelCallback onCancel;
// State of the controller.
int _state;
@@ -107,24 +107,30 @@ abstract class _BroadcastStreamController<T>
*/
_Future _doneFuture;
- _BroadcastStreamController(this._onListen, this._onCancel)
+ _BroadcastStreamController(this.onListen, this.onCancel)
: _state = _STATE_INITIAL {
_next = _previous = this;
}
- void set onListen(void onListenHandler()) { _onListen = onListenHandler; }
+ ControllerCallback get onPause {
+ throw new UnsupportedError(
+ "Broadcast stream controllers do not support pause callbacks");
+ }
void set onPause(void onPauseHandler()) {
throw new UnsupportedError(
"Broadcast stream controllers do not support pause callbacks");
}
- void set onResume(void onResumeHandler()) {
+ ControllerCallback get onResume {
throw new UnsupportedError(
"Broadcast stream controllers do not support pause callbacks");
}
- void set onCancel(onCancelHandler()) { _onCancel = onCancelHandler; }
+ void set onResume(void onResumeHandler()) {
+ throw new UnsupportedError(
+ "Broadcast stream controllers do not support pause callbacks");
+ }
// StreamController interface.
@@ -209,7 +215,7 @@ abstract class _BroadcastStreamController<T>
_addListener(subscription);
if (identical(_next, _previous)) {
// Only one listener, so it must be the first listener.
- _runGuarded(_onListen);
+ _runGuarded(onListen);
}
return subscription;
}
@@ -310,7 +316,7 @@ abstract class _BroadcastStreamController<T>
// Get event id of this event.
int id = (_state & _STATE_EVENT_ID);
- // Start firing (set the _STATE_FIRING bit). We don't do [_onCancel]
+ // Start firing (set the _STATE_FIRING bit). We don't do [onCancel]
// callbacks while firing, and we prevent reentrancy of this function.
//
// Set [_state]'s event id to the next event's id.
@@ -346,7 +352,7 @@ abstract class _BroadcastStreamController<T>
// When closed, _doneFuture is not null.
_doneFuture._asyncComplete(null);
}
- _runGuarded(_onCancel);
+ _runGuarded(onCancel);
}
}
« no previous file with comments | « no previous file | sdk/lib/async/stream_controller.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698