| OLD | NEW |
| 1 part of dart.async; | 1 part of dart.async; |
| 2 abstract class StreamController<T> implements StreamSink<T> {Stream<T> get stre
am; | 2 abstract class StreamController<T> implements StreamSink<T> {Stream<T> get stre
am; |
| 3 factory StreamController({ | 3 factory StreamController({ |
| 4 void onListen(), void onPause(), void onResume(), onCancel(), bool sync : fals
e} | 4 void onListen(), void onPause(), void onResume(), onCancel(), bool sync : fals
e} |
| 5 ) { | 5 ) { |
| 6 if (onListen == null && onPause == null && onResume == null && onCancel == nul
l) { | 6 if (onListen == null && onPause == null && onResume == null && onCancel == nul
l) { |
| 7 return ((__x90) => DDC$RT.cast(__x90, DDC$RT.type((_StreamController<dynamic
> _) { | 7 return ((__x117) => DDC$RT.cast(__x117, DDC$RT.type((_StreamController<dynam
ic> _) { |
| 8 } | 8 } |
| 9 ), DDC$RT.type((StreamController<T> _) { | 9 ), DDC$RT.type((StreamController<T> _) { |
| 10 } | 10 } |
| 11 ), "CastDynamic", """line 83, column 14 of dart:async/stream_controller.dart
: """, __x90 is StreamController<T>, false))(sync ? new _NoCallbackSyncStreamCon
troller() : new _NoCallbackAsyncStreamController()); | 11 ), "CastDynamic", """line 83, column 14 of dart:async/stream_controller.dart
: """, __x117 is StreamController<T>, false))(sync ? new _NoCallbackSyncStreamCo
ntroller() : new _NoCallbackAsyncStreamController()); |
| 12 } | 12 } |
| 13 return sync ? new _SyncStreamController<T>(onListen, onPause, onResume, onCan
cel) : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel); | 13 return sync ? new _SyncStreamController<T>(onListen, onPause, onResume, onCan
cel) : new _AsyncStreamController<T>(onListen, onPause, onResume, onCancel); |
| 14 } | 14 } |
| 15 factory StreamController.broadcast({ | 15 factory StreamController.broadcast({ |
| 16 void onListen(), void onCancel(), bool sync : false} | 16 void onListen(), void onCancel(), bool sync : false} |
| 17 ) { | 17 ) { |
| 18 return sync ? new _SyncBroadcastStreamController<T>(onListen, onCancel) : new
_AsyncBroadcastStreamController<T>(onListen, onCancel); | 18 return sync ? new _SyncBroadcastStreamController<T>(onListen, onCancel) : new
_AsyncBroadcastStreamController<T>(onListen, onCancel); |
| 19 } | 19 } |
| 20 StreamSink<T> get sink; | 20 StreamSink<T> get sink; |
| 21 bool get isClosed; | 21 bool get isClosed; |
| (...skipping 18 matching lines...) Expand all Loading... |
| 40 static const int _STATE_CLOSED = 4; | 40 static const int _STATE_CLOSED = 4; |
| 41 static const int _STATE_ADDSTREAM = 8; | 41 static const int _STATE_ADDSTREAM = 8; |
| 42 var _varData; | 42 var _varData; |
| 43 int _state = _STATE_INITIAL; | 43 int _state = _STATE_INITIAL; |
| 44 _Future _doneFuture; | 44 _Future _doneFuture; |
| 45 _StreamController(); | 45 _StreamController(); |
| 46 _NotificationHandler get _onListen; | 46 _NotificationHandler get _onListen; |
| 47 _NotificationHandler get _onPause; | 47 _NotificationHandler get _onPause; |
| 48 _NotificationHandler get _onResume; | 48 _NotificationHandler get _onResume; |
| 49 _NotificationHandler get _onCancel; | 49 _NotificationHandler get _onCancel; |
| 50 Stream<T> get stream => ((__x91) => DDC$RT.cast(__x91, DDC$RT.type((_Controller
Stream<dynamic> _) { | 50 Stream<T> get stream => ((__x118) => DDC$RT.cast(__x118, DDC$RT.type((_Controll
erStream<dynamic> _) { |
| 51 } | 51 } |
| 52 ), DDC$RT.type((Stream<T> _) { | 52 ), DDC$RT.type((Stream<T> _) { |
| 53 } | 53 } |
| 54 ), "CastExact", """line 293, column 27 of dart:async/stream_controller.dart: """
, __x91 is Stream<T>, false))(new _ControllerStream(this)); | 54 ), "CastExact", """line 293, column 27 of dart:async/stream_controller.dart: """
, __x118 is Stream<T>, false))(new _ControllerStream(this)); |
| 55 StreamSink<T> get sink => new _StreamSinkWrapper<T>(this); | 55 StreamSink<T> get sink => new _StreamSinkWrapper<T>(this); |
| 56 bool get _isCanceled => (_state & _STATE_CANCELED) != 0; | 56 bool get _isCanceled => (_state & _STATE_CANCELED) != 0; |
| 57 bool get hasListener => (_state & _STATE_SUBSCRIBED) != 0; | 57 bool get hasListener => (_state & _STATE_SUBSCRIBED) != 0; |
| 58 bool get _isInitialState => (_state & _STATE_SUBSCRIPTION_MASK) == _STATE_INITI
AL; | 58 bool get _isInitialState => (_state & _STATE_SUBSCRIPTION_MASK) == _STATE_INITI
AL; |
| 59 bool get isClosed => (_state & _STATE_CLOSED) != 0; | 59 bool get isClosed => (_state & _STATE_CLOSED) != 0; |
| 60 bool get isPaused => hasListener ? _subscription._isInputPaused : !_isCanceled; | 60 bool get isPaused => hasListener ? _subscription._isInputPaused : !_isCanceled; |
| 61 bool get _isAddingStream => (_state & _STATE_ADDSTREAM) != 0; | 61 bool get _isAddingStream => (_state & _STATE_ADDSTREAM) != 0; |
| 62 bool get _mayAddEvent => (_state < _STATE_CLOSED); | 62 bool get _mayAddEvent => (_state < _STATE_CLOSED); |
| 63 _PendingEvents get _pendingEvents { | 63 _PendingEvents get _pendingEvents { |
| 64 assert (_isInitialState); if (!_isAddingStream) { | 64 assert (_isInitialState); if (!_isAddingStream) { |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 } | 168 } |
| 169 ), "CastGeneral", """line 482, column 48 of dart:async/stream_controller.dart: "
"", _varData is _StreamControllerAddStreamState<dynamic>, true); | 169 ), "CastGeneral", """line 482, column 48 of dart:async/stream_controller.dart: "
"", _varData is _StreamControllerAddStreamState<dynamic>, true); |
| 170 _varData = addState.varData; | 170 _varData = addState.varData; |
| 171 _state &= ~_STATE_ADDSTREAM; | 171 _state &= ~_STATE_ADDSTREAM; |
| 172 addState.complete(); | 172 addState.complete(); |
| 173 } | 173 } |
| 174 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on
Done(), bool cancelOnError) { | 174 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on
Done(), bool cancelOnError) { |
| 175 if (!_isInitialState) { | 175 if (!_isInitialState) { |
| 176 throw new StateError("Stream has already been listened to."); | 176 throw new StateError("Stream has already been listened to."); |
| 177 } | 177 } |
| 178 _ControllerSubscription subscription = new _ControllerSubscription(this, onData
, onError, onDone, cancelOnError); | 178 _ControllerSubscription subscription = new _ControllerSubscription(this, DDC$RT
.wrap((void f(T __u119)) { |
| 179 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 499, column 4
3 of dart:async/stream_controller.dart: """, x0 is T, false)); |
| 180 return f == null ? null : c; |
| 181 } |
| 182 , onData, DDC$RT.type((__t122<T> _) { |
| 183 } |
| 184 ), __t120, "Wrap", """line 499, column 43 of dart:async/stream_controller.dart:
""", onData is __t120), onError, onDone, cancelOnError); |
| 179 _PendingEvents pendingEvents = _pendingEvents; | 185 _PendingEvents pendingEvents = _pendingEvents; |
| 180 _state |= _STATE_SUBSCRIBED; | 186 _state |= _STATE_SUBSCRIBED; |
| 181 if (_isAddingStream) { | 187 if (_isAddingStream) { |
| 182 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT
.type((_StreamControllerAddStreamState<dynamic> _) { | 188 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT
.type((_StreamControllerAddStreamState<dynamic> _) { |
| 183 } | 189 } |
| 184 ), "CastGeneral", """line 505, column 50 of dart:async/stream_controller.dart: "
"", _varData is _StreamControllerAddStreamState<dynamic>, true); | 190 ), "CastGeneral", """line 505, column 50 of dart:async/stream_controller.dart: "
"", _varData is _StreamControllerAddStreamState<dynamic>, true); |
| 185 addState.varData = subscription; | 191 addState.varData = subscription; |
| 186 addState.resume(); | 192 addState.resume(); |
| 187 } | 193 } |
| 188 else { | 194 else { |
| (...skipping 16 matching lines...) Expand all Loading... |
| 205 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT
.type((_StreamControllerAddStreamState<dynamic> _) { | 211 _StreamControllerAddStreamState addState = DDC$RT.cast(_varData, dynamic, DDC$RT
.type((_StreamControllerAddStreamState<dynamic> _) { |
| 206 } | 212 } |
| 207 ), "CastGeneral", """line 530, column 50 of dart:async/stream_controller.dart: "
"", _varData is _StreamControllerAddStreamState<dynamic>, true); | 213 ), "CastGeneral", """line 530, column 50 of dart:async/stream_controller.dart: "
"", _varData is _StreamControllerAddStreamState<dynamic>, true); |
| 208 result = addState.cancel(); | 214 result = addState.cancel(); |
| 209 } | 215 } |
| 210 _varData = null; | 216 _varData = null; |
| 211 _state = (_state & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM)) | _STATE_CANCELED; | 217 _state = (_state & ~(_STATE_SUBSCRIBED | _STATE_ADDSTREAM)) | _STATE_CANCELED; |
| 212 if (_onCancel != null) { | 218 if (_onCancel != null) { |
| 213 if (result == null) { | 219 if (result == null) { |
| 214 try { | 220 try { |
| 215 result = ((__x92) => DDC$RT.cast(__x92, dynamic, DDC$RT.type((Future<dynamic
> _) { | 221 result = ((__x124) => DDC$RT.cast(__x124, dynamic, DDC$RT.type((Future<dynam
ic> _) { |
| 216 } | 222 } |
| 217 ), "CastGeneral", """line 542, column 20 of dart:async/stream_controller.dar
t: """, __x92 is Future<dynamic>, true))(_onCancel()); | 223 ), "CastGeneral", """line 542, column 20 of dart:async/stream_controller.dar
t: """, __x124 is Future<dynamic>, true))(_onCancel()); |
| 218 } | 224 } |
| 219 catch (e, s) { | 225 catch (e, s) { |
| 220 result = new _Future().._asyncCompleteError(e, s); | 226 result = new _Future().._asyncCompleteError(e, s); |
| 221 } | 227 } |
| 222 } | 228 } |
| 223 else { | 229 else { |
| 224 result = result.whenComplete(_onCancel); | 230 result = result.whenComplete(_onCancel); |
| 225 } | 231 } |
| 226 } | 232 } |
| 227 void complete() { | 233 void complete() { |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 343 _target.addError(error, stackTrace); | 349 _target.addError(error, stackTrace); |
| 344 } | 350 } |
| 345 Future close() => _target.close(); | 351 Future close() => _target.close(); |
| 346 Future addStream(Stream<T> source, { | 352 Future addStream(Stream<T> source, { |
| 347 bool cancelOnError : true} | 353 bool cancelOnError : true} |
| 348 ) => _target.addStream(source, cancelOnError: cancelOnError); | 354 ) => _target.addStream(source, cancelOnError: cancelOnError); |
| 349 Future get done => _target.done; | 355 Future get done => _target.done; |
| 350 } | 356 } |
| 351 class _AddStreamState<T> {final _Future addStreamFuture; | 357 class _AddStreamState<T> {final _Future addStreamFuture; |
| 352 final StreamSubscription addSubscription; | 358 final StreamSubscription addSubscription; |
| 353 _AddStreamState(_EventSink<T> controller, Stream source, bool cancelOnError) :
addStreamFuture = new _Future(), addSubscription = source.listen(DDC$RT.wrap((vo
id f(T __u93)) { | 359 _AddStreamState(_EventSink<T> controller, Stream source, bool cancelOnError) :
addStreamFuture = new _Future(), addSubscription = source.listen(DDC$RT.wrap((vo
id f(T __u125)) { |
| 354 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 745, column 4
1 of dart:async/stream_controller.dart: """, x0 is T, false)); | 360 void c(T x0) => f(DDC$RT.cast(x0, dynamic, T, "CastParam", """line 745, column 4
1 of dart:async/stream_controller.dart: """, x0 is T, false)); |
| 355 return f == null ? null : c; | 361 return f == null ? null : c; |
| 356 } | 362 } |
| 357 , controller._add, DDC$RT.type((__t96<T> _) { | 363 , controller._add, DDC$RT.type((__t126<T> _) { |
| 358 } | 364 } |
| 359 ), __t94, "Wrap", """line 745, column 41 of dart:async/stream_controller.dart: "
"", controller._add is __t94), onError: ((__x98) => DDC$RT.cast(__x98, dynamic,
Function, "CastGeneral", """line 746, column 50 of dart:async/stream_controller.
dart: """, __x98 is Function, true))(cancelOnError ? makeErrorHandler(controller
) : controller._addError), onDone: controller._close, cancelOnError: cancelOnErr
or); | 365 ), __t120, "Wrap", """line 745, column 41 of dart:async/stream_controller.dart:
""", controller._add is __t120), onError: ((__x128) => DDC$RT.cast(__x128, dynam
ic, Function, "CastGeneral", """line 746, column 50 of dart:async/stream_control
ler.dart: """, __x128 is Function, true))(cancelOnError ? makeErrorHandler(contr
oller) : controller._addError), onDone: controller._close, cancelOnError: cancel
OnError); |
| 360 static makeErrorHandler(_EventSink controller) => (e, StackTrace s) { | 366 static makeErrorHandler(_EventSink controller) => (e, StackTrace s) { |
| 361 controller._addError(e, s); | 367 controller._addError(e, s); |
| 362 controller._close(); | 368 controller._close(); |
| 363 } | 369 } |
| 364 ; | 370 ; |
| 365 void pause() { | 371 void pause() { |
| 366 addSubscription.pause(); | 372 addSubscription.pause(); |
| 367 } | 373 } |
| 368 void resume() { | 374 void resume() { |
| 369 addSubscription.resume(); | 375 addSubscription.resume(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 387 _StreamControllerAddStreamState(_StreamController controller, this.varData, Str
eam source, bool cancelOnError) : super(DDC$RT.cast(controller, DDC$RT.type((_St
reamController<dynamic> _) { | 393 _StreamControllerAddStreamState(_StreamController controller, this.varData, Str
eam source, bool cancelOnError) : super(DDC$RT.cast(controller, DDC$RT.type((_St
reamController<dynamic> _) { |
| 388 } | 394 } |
| 389 ), DDC$RT.type((_EventSink<T> _) { | 395 ), DDC$RT.type((_EventSink<T> _) { |
| 390 } | 396 } |
| 391 ), "CastDynamic", """line 798, column 15 of dart:async/stream_controller.dart: "
"", controller is _EventSink<T>, false), source, cancelOnError) { | 397 ), "CastDynamic", """line 798, column 15 of dart:async/stream_controller.dart: "
"", controller is _EventSink<T>, false), source, cancelOnError) { |
| 392 if (controller.isPaused) { | 398 if (controller.isPaused) { |
| 393 addSubscription.pause(); | 399 addSubscription.pause(); |
| 394 } | 400 } |
| 395 } | 401 } |
| 396 } | 402 } |
| 397 typedef void __t94(dynamic __u95); | 403 typedef void __t120(dynamic __u121); |
| 398 typedef void __t96<T>(T __u97); | 404 typedef void __t122<T>(T __u123); |
| 405 typedef void __t126<T>(T __u127); |
| OLD | NEW |