| OLD | NEW |
| 1 part of dart.async; | 1 part of dart.async; |
| 2 abstract class _EventSink<T> {void _add(T data); | 2 abstract class _EventSink<T> {void _add(T data); |
| 3 void _addError(Object error, StackTrace stackTrace); | 3 void _addError(Object error, StackTrace stackTrace); |
| 4 void _close(); | 4 void _close(); |
| 5 } | 5 } |
| 6 abstract class _EventDispatch<T> {void _sendData(T data); | 6 abstract class _EventDispatch<T> {void _sendData(T data); |
| 7 void _sendError(Object error, StackTrace stackTrace); | 7 void _sendError(Object error, StackTrace stackTrace); |
| 8 void _sendDone(); | 8 void _sendDone(); |
| 9 } | 9 } |
| 10 class _BufferingStreamSubscription<T> implements StreamSubscription<T>, _EventS
ink<T>, _EventDispatch<T> {static const int _STATE_CANCEL_ON_ERROR = 1; | 10 class _BufferingStreamSubscription<T> implements StreamSubscription<T>, _EventS
ink<T>, _EventDispatch<T> {static const int _STATE_CANCEL_ON_ERROR = 1; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 _state |= _STATE_HAS_PENDING; | 34 _state |= _STATE_HAS_PENDING; |
| 35 _pending.schedule(this); | 35 _pending.schedule(this); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 _PendingEvents _extractPending() { | 38 _PendingEvents _extractPending() { |
| 39 assert (_isCanceled); _PendingEvents events = _pending; | 39 assert (_isCanceled); _PendingEvents events = _pending; |
| 40 _pending = null; | 40 _pending = null; |
| 41 return events; | 41 return events; |
| 42 } | 42 } |
| 43 void onData(void handleData(T event)) { | 43 void onData(void handleData(T event)) { |
| 44 if (handleData == null) handleData = DEVC$RT.cast(_nullDataHandler, __CastType51
, DEVC$RT.type((__CastType49<T> _) { | 44 if (handleData == null) handleData = DEVC$RT.cast(_nullDataHandler, __CastType52
, DEVC$RT.type((__CastType50<T> _) { |
| 45 } | 45 } |
| 46 ), "CompositeCast", """line 153, column 42 of dart:async/stream_impl.dart: """,
_nullDataHandler is __CastType49<T>, false); | 46 ), "CompositeCast", """line 153, column 42 of dart:async/stream_impl.dart: """,
_nullDataHandler is __CastType50<T>, false); |
| 47 _onData = ((__x53) => DEVC$RT.cast(__x53, ZoneUnaryCallback, DEVC$RT.type((_Dat
aHandler<T> _) { | 47 _onData = ((__x54) => DEVC$RT.cast(__x54, ZoneUnaryCallback, DEVC$RT.type((_Dat
aHandler<T> _) { |
| 48 } | 48 } |
| 49 ), "CompositeCast", """line 154, column 15 of dart:async/stream_impl.dart: """,
__x53 is _DataHandler<T>, false))(_zone.registerUnaryCallback(handleData)); | 49 ), "CompositeCast", """line 154, column 15 of dart:async/stream_impl.dart: """,
__x54 is _DataHandler<T>, false))(_zone.registerUnaryCallback(handleData)); |
| 50 } | 50 } |
| 51 void onError(Function handleError) { | 51 void onError(Function handleError) { |
| 52 if (handleError == null) handleError = _nullErrorHandler; | 52 if (handleError == null) handleError = _nullErrorHandler; |
| 53 _onError = _registerErrorHandler(handleError, _zone); | 53 _onError = _registerErrorHandler(handleError, _zone); |
| 54 } | 54 } |
| 55 void onDone(void handleDone()) { | 55 void onDone(void handleDone()) { |
| 56 if (handleDone == null) handleDone = _nullDoneHandler; | 56 if (handleDone == null) handleDone = _nullDoneHandler; |
| 57 _onDone = _zone.registerCallback(handleDone); | 57 _onDone = _zone.registerCallback(handleDone); |
| 58 } | 58 } |
| 59 void pause([Future resumeSignal]) { | 59 void pause([Future resumeSignal]) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 } | 165 } |
| 166 } | 166 } |
| 167 } | 167 } |
| 168 void _sendData(T data) { | 168 void _sendData(T data) { |
| 169 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; | 169 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; |
| 170 _state |= _STATE_IN_CALLBACK; | 170 _state |= _STATE_IN_CALLBACK; |
| 171 _zone.runUnaryGuarded(_onData, data); | 171 _zone.runUnaryGuarded(_onData, data); |
| 172 _state &= ~_STATE_IN_CALLBACK; | 172 _state &= ~_STATE_IN_CALLBACK; |
| 173 _checkState(wasInputPaused); | 173 _checkState(wasInputPaused); |
| 174 } | 174 } |
| 175 void _sendError(var error, StackTrace stackTrace) { | 175 void _sendError(Object error, StackTrace stackTrace) { |
| 176 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; | 176 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; |
| 177 void sendError() { | 177 void sendError() { |
| 178 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; | 178 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; |
| 179 if (_onError is ZoneBinaryCallback) { | 179 if (_onError is ZoneBinaryCallback) { |
| 180 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __CastType54, "Implici
tCast", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is
__CastType54, true), error, stackTrace); | 180 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __CastType55, "Implici
tCast", """line 358, column 32 of dart:async/stream_impl.dart: """, _onError is
__CastType55, true), error, stackTrace); |
| 181 } | 181 } |
| 182 else { | 182 else { |
| 183 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __CastType57, "Implicit
Cast", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is _
_CastType57, true), error); | 183 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __CastType58, "Implicit
Cast", """line 360, column 31 of dart:async/stream_impl.dart: """, _onError is _
_CastType58, true), error); |
| 184 } | 184 } |
| 185 _state &= ~_STATE_IN_CALLBACK; | 185 _state &= ~_STATE_IN_CALLBACK; |
| 186 } | 186 } |
| 187 if (_cancelOnError) { | 187 if (_cancelOnError) { |
| 188 _state |= _STATE_WAIT_FOR_CANCEL; | 188 _state |= _STATE_WAIT_FOR_CANCEL; |
| 189 _cancel(); | 189 _cancel(); |
| 190 if (_cancelFuture is Future) { | 190 if (_cancelFuture is Future) { |
| 191 _cancelFuture.whenComplete(sendError); | 191 _cancelFuture.whenComplete(sendError); |
| 192 } | 192 } |
| 193 else { | 193 else { |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 254 ) { | 254 ) { |
| 255 cancelOnError = identical(true, cancelOnError); | 255 cancelOnError = identical(true, cancelOnError); |
| 256 StreamSubscription subscription = _createSubscription(onData, onError, onDone,
cancelOnError); | 256 StreamSubscription subscription = _createSubscription(onData, onError, onDone,
cancelOnError); |
| 257 _onListen(subscription); | 257 _onListen(subscription); |
| 258 return DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynamic> _)
{ | 258 return DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynamic> _)
{ |
| 259 } | 259 } |
| 260 ), DEVC$RT.type((StreamSubscription<T> _) { | 260 ), DEVC$RT.type((StreamSubscription<T> _) { |
| 261 } | 261 } |
| 262 ), "CompositeCast", """line 476, column 12 of dart:async/stream_impl.dart: """,
subscription is StreamSubscription<T>, false); | 262 ), "CompositeCast", """line 476, column 12 of dart:async/stream_impl.dart: """,
subscription is StreamSubscription<T>, false); |
| 263 } | 263 } |
| 264 _BufferingStreamSubscription<T> _createSubscription(void onData(T data), Functi
on onError, void onDone(), bool cancelOnError) { | 264 StreamSubscription<T> _createSubscription(void onData(T data), Function onError
, void onDone(), bool cancelOnError) { |
| 265 return new _BufferingStreamSubscription<T>(onData, onError, onDone, cancelOnErro
r); | 265 return new _BufferingStreamSubscription<T>(onData, onError, onDone, cancelOnErro
r); |
| 266 } | 266 } |
| 267 void _onListen(StreamSubscription subscription) { | 267 void _onListen(StreamSubscription subscription) { |
| 268 } | 268 } |
| 269 } | 269 } |
| 270 typedef _PendingEvents _EventGenerator(); | 270 typedef _PendingEvents _EventGenerator(); |
| 271 class _GeneratedStreamImpl<T> extends _StreamImpl<T> {final _EventGenerator _pe
nding; | 271 class _GeneratedStreamImpl<T> extends _StreamImpl<T> {final _EventGenerator _pe
nding; |
| 272 bool _isUsed = false; | 272 bool _isUsed = false; |
| 273 _GeneratedStreamImpl(this._pending); | 273 _GeneratedStreamImpl(this._pending); |
| 274 StreamSubscription _createSubscription(void onData(T data), Function onError, v
oid onDone(), bool cancelOnError) { | 274 StreamSubscription<T> _createSubscription(void onData(T data), Function onError
, void onDone(), bool cancelOnError) { |
| 275 if (_isUsed) throw new StateError("Stream has already been listened to."); | 275 if (_isUsed) throw new StateError("Stream has already been listened to."); |
| 276 _isUsed = true; | 276 _isUsed = true; |
| 277 return new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError)
.._setPendingEvents(_pending()); | 277 return ((__x60) => DEVC$RT.cast(__x60, DEVC$RT.type((_BufferingStreamSubscripti
on<dynamic> _) { |
| 278 } |
| 279 ), DEVC$RT.type((StreamSubscription<T> _) { |
| 280 } |
| 281 ), "CompositeCast", """line 515, column 12 of dart:async/stream_impl.dart: """,
__x60 is StreamSubscription<T>, false))(new _BufferingStreamSubscription(onData,
onError, onDone, cancelOnError).._setPendingEvents(_pending())); |
| 278 } | 282 } |
| 279 } | 283 } |
| 280 class _IterablePendingEvents<T> extends _PendingEvents {Iterator<T> _iterator; | 284 class _IterablePendingEvents<T> extends _PendingEvents {Iterator<T> _iterator; |
| 281 _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator; | 285 _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator; |
| 282 bool get isEmpty => _iterator == null; | 286 bool get isEmpty => _iterator == null; |
| 283 void handleNext(_EventDispatch dispatch) { | 287 void handleNext(_EventDispatch dispatch) { |
| 284 if (_iterator == null) { | 288 if (_iterator == null) { |
| 285 throw new StateError("No events pending."); | 289 throw new StateError("No events pending."); |
| 286 } | 290 } |
| 287 bool isDone; | 291 bool isDone; |
| (...skipping 19 matching lines...) Expand all Loading... |
| 307 } | 311 } |
| 308 typedef void _DataHandler<T>(T value); | 312 typedef void _DataHandler<T>(T value); |
| 309 typedef void _DoneHandler(); | 313 typedef void _DoneHandler(); |
| 310 void _nullDataHandler(var value) { | 314 void _nullDataHandler(var value) { |
| 311 } | 315 } |
| 312 void _nullErrorHandler(error, [StackTrace stackTrace]) { | 316 void _nullErrorHandler(error, [StackTrace stackTrace]) { |
| 313 Zone.current.handleUncaughtError(error, stackTrace); | 317 Zone.current.handleUncaughtError(error, stackTrace); |
| 314 } | 318 } |
| 315 void _nullDoneHandler() { | 319 void _nullDoneHandler() { |
| 316 } | 320 } |
| 317 abstract class _DelayedEvent {_DelayedEvent next; | 321 abstract class _DelayedEvent<T> {_DelayedEvent next; |
| 318 void perform(_EventDispatch dispatch); | 322 void perform(_EventDispatch<T> dispatch); |
| 319 } | 323 } |
| 320 class _DelayedData<T> extends _DelayedEvent {final T value; | 324 class _DelayedData<T> extends _DelayedEvent<T> {final T value; |
| 321 _DelayedData(this.value); | 325 _DelayedData(this.value); |
| 322 void perform(_EventDispatch<T> dispatch) { | 326 void perform(_EventDispatch<T> dispatch) { |
| 323 dispatch._sendData(value); | 327 dispatch._sendData(value); |
| 324 } | 328 } |
| 325 } | 329 } |
| 326 class _DelayedError extends _DelayedEvent {final error; | 330 class _DelayedError extends _DelayedEvent {final error; |
| 327 final StackTrace stackTrace; | 331 final StackTrace stackTrace; |
| 328 _DelayedError(this.error, this.stackTrace); | 332 _DelayedError(this.error, this.stackTrace); |
| 329 void perform(_EventDispatch dispatch) { | 333 void perform(_EventDispatch dispatch) { |
| 330 dispatch._sendError(error, stackTrace); | 334 dispatch._sendError(error, stackTrace); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 if (isPaused) return; _state |= _DONE_SENT; | 457 if (isPaused) return; _state |= _DONE_SENT; |
| 454 if (_onDone != null) _zone.runGuarded(_onDone); | 458 if (_onDone != null) _zone.runGuarded(_onDone); |
| 455 } | 459 } |
| 456 } | 460 } |
| 457 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source; | 461 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source; |
| 458 final _broadcastCallback _onListenHandler; | 462 final _broadcastCallback _onListenHandler; |
| 459 final _broadcastCallback _onCancelHandler; | 463 final _broadcastCallback _onCancelHandler; |
| 460 final Zone _zone; | 464 final Zone _zone; |
| 461 _AsBroadcastStreamController<T> _controller; | 465 _AsBroadcastStreamController<T> _controller; |
| 462 StreamSubscription<T> _subscription; | 466 StreamSubscription<T> _subscription; |
| 463 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr
iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl
er = ((__x59) => DEVC$RT.cast(__x59, ZoneUnaryCallback, _broadcastCallback, "Com
positeCast", """line 813, column 28 of dart:async/stream_impl.dart: """, __x59 i
s _broadcastCallback, false))(Zone.current.registerUnaryCallback(onListenHandler
)), _onCancelHandler = ((__x60) => DEVC$RT.cast(__x60, ZoneUnaryCallback, _broad
castCallback, "CompositeCast", """line 814, column 28 of dart:async/stream_impl.
dart: """, __x60 is _broadcastCallback, false))(Zone.current.registerUnaryCallba
ck(onCancelHandler)), _zone = Zone.current { | 467 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr
iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl
er = ((__x61) => DEVC$RT.cast(__x61, ZoneUnaryCallback, _broadcastCallback, "Com
positeCast", """line 813, column 28 of dart:async/stream_impl.dart: """, __x61 i
s _broadcastCallback, false))(Zone.current.registerUnaryCallback(onListenHandler
)), _onCancelHandler = ((__x62) => DEVC$RT.cast(__x62, ZoneUnaryCallback, _broad
castCallback, "CompositeCast", """line 814, column 28 of dart:async/stream_impl.
dart: """, __x62 is _broadcastCallback, false))(Zone.current.registerUnaryCallba
ck(onCancelHandler)), _zone = Zone.current { |
| 464 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel); | 468 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel); |
| 465 } | 469 } |
| 466 bool get isBroadcast => true; | 470 bool get isBroadcast => true; |
| 467 StreamSubscription<T> listen(void onData(T data), { | 471 StreamSubscription<T> listen(void onData(T data), { |
| 468 Function onError, void onDone(), bool cancelOnError} | 472 Function onError, void onDone(), bool cancelOnError} |
| 469 ) { | 473 ) { |
| 470 if (_controller == null || _controller.isClosed) { | 474 if (_controller == null || _controller.isClosed) { |
| 471 return new _DoneStreamSubscription<T>(onDone); | 475 return new _DoneStreamSubscription<T>(onDone); |
| 472 } | 476 } |
| 473 if (_subscription == null) { | 477 if (_subscription == null) { |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 bool get _isSubscriptionPaused { | 512 bool get _isSubscriptionPaused { |
| 509 if (_subscription == null) return false; | 513 if (_subscription == null) return false; |
| 510 return _subscription.isPaused; | 514 return _subscription.isPaused; |
| 511 } | 515 } |
| 512 } | 516 } |
| 513 class _BroadcastSubscriptionWrapper<T> implements StreamSubscription<T> {final
_AsBroadcastStream _stream; | 517 class _BroadcastSubscriptionWrapper<T> implements StreamSubscription<T> {final
_AsBroadcastStream _stream; |
| 514 _BroadcastSubscriptionWrapper(this._stream); | 518 _BroadcastSubscriptionWrapper(this._stream); |
| 515 void onData(void handleData(T data)) { | 519 void onData(void handleData(T data)) { |
| 516 throw new UnsupportedError("Cannot change handlers of asBroadcastStream source s
ubscription."); | 520 throw new UnsupportedError("Cannot change handlers of asBroadcastStream source s
ubscription."); |
| 517 } | 521 } |
| 518 void onError(void handleError(Object data)) { | 522 void onError(Function handleError) { |
| 519 throw new UnsupportedError("Cannot change handlers of asBroadcastStream source s
ubscription."); | 523 throw new UnsupportedError("Cannot change handlers of asBroadcastStream source s
ubscription."); |
| 520 } | 524 } |
| 521 void onDone(void handleDone()) { | 525 void onDone(void handleDone()) { |
| 522 throw new UnsupportedError("Cannot change handlers of asBroadcastStream source s
ubscription."); | 526 throw new UnsupportedError("Cannot change handlers of asBroadcastStream source s
ubscription."); |
| 523 } | 527 } |
| 524 void pause([Future resumeSignal]) { | 528 void pause([Future resumeSignal]) { |
| 525 _stream._pauseSubscription(resumeSignal); | 529 _stream._pauseSubscription(resumeSignal); |
| 526 } | 530 } |
| 527 void resume() { | 531 void resume() { |
| 528 _stream._resumeSubscription(); | 532 _stream._resumeSubscription(); |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 633 } | 637 } |
| 634 ), "CompositeCast", """line 1073, column 31 of dart:async/stream_impl.dart: """,
_futureOrPrefetch is _Future<bool>, false); | 638 ), "CompositeCast", """line 1073, column 31 of dart:async/stream_impl.dart: """,
_futureOrPrefetch is _Future<bool>, false); |
| 635 _clear(); | 639 _clear(); |
| 636 hasNext._complete(false); | 640 hasNext._complete(false); |
| 637 return;} | 641 return;} |
| 638 _subscription.pause(); | 642 _subscription.pause(); |
| 639 _futureOrPrefetch = null; | 643 _futureOrPrefetch = null; |
| 640 _state = _STATE_EXTRA_DONE; | 644 _state = _STATE_EXTRA_DONE; |
| 641 } | 645 } |
| 642 } | 646 } |
| 643 typedef void __CastType49<T>(T __u50); | 647 typedef void __CastType50<T>(T __u51); |
| 644 typedef void __CastType51(dynamic __u52); | 648 typedef void __CastType52(dynamic __u53); |
| 645 typedef dynamic __CastType54(dynamic __u55, dynamic __u56); | 649 typedef dynamic __CastType55(dynamic __u56, dynamic __u57); |
| 646 typedef dynamic __CastType57(dynamic __u58); | 650 typedef dynamic __CastType58(dynamic __u59); |
| OLD | NEW |