| 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 = _nullDataHandler; | 44 if (handleData == null) handleData = DEVC$RT.wrap((void f(dynamic __u86)) { |
| 45 _onData = _zone.registerUnaryCallback(DEVC$RT.wrap((void f(T __u118)) { | 45 void c(dynamic x0) => f(x0); |
| 46 void c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 154, column
43 of dart:async/stream_impl.dart: """, x0 is T, false)); | |
| 47 return f == null ? null : c; | 46 return f == null ? null : c; |
| 48 } | 47 } |
| 49 , handleData, DEVC$RT.type((__t121<T> _) { | 48 , _nullDataHandler, __t89, DEVC$RT.type((__t87<T> _) { |
| 50 } | 49 } |
| 51 ), __t119, "Wrap", """line 154, column 43 of dart:async/stream_impl.dart: """, h
andleData is __t119)); | 50 ), "Wrap", """line 153, column 42 of dart:async/stream_impl.dart: """, _nullData
Handler is __t87<T>); |
| 51 _onData = ((__x94) => DEVC$RT.wrap((dynamic f(dynamic __u91)) { |
| 52 dynamic c(dynamic x0) => f(x0); |
| 53 return f == null ? null : c; |
| 54 } |
| 55 , __x94, __t92, DEVC$RT.type((__t87<T> _) { |
| 56 } |
| 57 ), "Wrap", """line 154, column 15 of dart:async/stream_impl.dart: """, __x94 is
__t87<T>))(_zone.registerUnaryCallback(handleData)); |
| 52 } | 58 } |
| 53 void onError(Function handleError) { | 59 void onError(Function handleError) { |
| 54 if (handleError == null) handleError = _nullErrorHandler; | 60 if (handleError == null) handleError = _nullErrorHandler; |
| 55 _onError = _registerErrorHandler(handleError, _zone); | 61 _onError = _registerErrorHandler(handleError, _zone); |
| 56 } | 62 } |
| 57 void onDone(void handleDone()) { | 63 void onDone(void handleDone()) { |
| 58 if (handleDone == null) handleDone = _nullDoneHandler; | 64 if (handleDone == null) handleDone = _nullDoneHandler; |
| 59 _onDone = _zone.registerCallback(handleDone); | 65 _onDone = _zone.registerCallback(handleDone); |
| 60 } | 66 } |
| 61 void pause([Future resumeSignal]) { | 67 void pause([Future resumeSignal]) { |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 if (!_hasPending) { | 169 if (!_hasPending) { |
| 164 _state |= _STATE_HAS_PENDING; | 170 _state |= _STATE_HAS_PENDING; |
| 165 if (!_isPaused) { | 171 if (!_isPaused) { |
| 166 _pending.schedule(this); | 172 _pending.schedule(this); |
| 167 } | 173 } |
| 168 } | 174 } |
| 169 } | 175 } |
| 170 void _sendData(T data) { | 176 void _sendData(T data) { |
| 171 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; | 177 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; |
| 172 _state |= _STATE_IN_CALLBACK; | 178 _state |= _STATE_IN_CALLBACK; |
| 173 _zone.runUnaryGuarded(DEVC$RT.wrap((void f(T __u123)) { | 179 _zone.runUnaryGuarded(_onData, data); |
| 174 void c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 341, column
27 of dart:async/stream_impl.dart: """, x0 is T, false)); | |
| 175 return f == null ? null : c; | |
| 176 } | |
| 177 , _onData, DEVC$RT.type((__t121<T> _) { | |
| 178 } | |
| 179 ), __t119, "Wrap", """line 341, column 27 of dart:async/stream_impl.dart: """, _
onData is __t119), data); | |
| 180 _state &= ~_STATE_IN_CALLBACK; | 180 _state &= ~_STATE_IN_CALLBACK; |
| 181 _checkState(wasInputPaused); | 181 _checkState(wasInputPaused); |
| 182 } | 182 } |
| 183 void _sendError(var error, StackTrace stackTrace) { | 183 void _sendError(var error, StackTrace stackTrace) { |
| 184 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; | 184 assert (!_isCanceled); assert (!_isPaused); assert (!_inCallback); bool wasInput
Paused = _isInputPaused; |
| 185 void sendError() { | 185 void sendError() { |
| 186 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; | 186 if (_isCanceled && !_waitsForCancel) return; _state |= _STATE_IN_CALLBACK; |
| 187 if (_onError is ZoneBinaryCallback) { | 187 if (_onError is ZoneBinaryCallback) { |
| 188 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __t124, "CastGeneral",
"""line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __t124,
false), error, stackTrace); | 188 _zone.runBinaryGuarded(DEVC$RT.cast(_onError, Function, __t95, "CastGeneral",
"""line 358, column 32 of dart:async/stream_impl.dart: """, _onError is __t95, f
alse), error, stackTrace); |
| 189 } | 189 } |
| 190 else { | 190 else { |
| 191 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __t119, "CastGeneral",
"""line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __t119,
false), error); | 191 _zone.runUnaryGuarded(DEVC$RT.cast(_onError, Function, __t92, "CastGeneral", "
""line 360, column 31 of dart:async/stream_impl.dart: """, _onError is __t92, fa
lse), error); |
| 192 } | 192 } |
| 193 _state &= ~_STATE_IN_CALLBACK; | 193 _state &= ~_STATE_IN_CALLBACK; |
| 194 } | 194 } |
| 195 if (_cancelOnError) { | 195 if (_cancelOnError) { |
| 196 _state |= _STATE_WAIT_FOR_CANCEL; | 196 _state |= _STATE_WAIT_FOR_CANCEL; |
| 197 _cancel(); | 197 _cancel(); |
| 198 if (_cancelFuture is Future) { | 198 if (_cancelFuture is Future) { |
| 199 _cancelFuture.whenComplete(sendError); | 199 _cancelFuture.whenComplete(sendError); |
| 200 } | 200 } |
| 201 else { | 201 else { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 void _onListen(StreamSubscription subscription) { | 275 void _onListen(StreamSubscription subscription) { |
| 276 } | 276 } |
| 277 } | 277 } |
| 278 typedef _PendingEvents _EventGenerator(); | 278 typedef _PendingEvents _EventGenerator(); |
| 279 class _GeneratedStreamImpl<T> extends _StreamImpl<T> {final _EventGenerator _pe
nding; | 279 class _GeneratedStreamImpl<T> extends _StreamImpl<T> {final _EventGenerator _pe
nding; |
| 280 bool _isUsed = false; | 280 bool _isUsed = false; |
| 281 _GeneratedStreamImpl(this._pending); | 281 _GeneratedStreamImpl(this._pending); |
| 282 StreamSubscription _createSubscription(void onData(T data), Function onError, v
oid onDone(), bool cancelOnError) { | 282 StreamSubscription _createSubscription(void onData(T data), Function onError, v
oid onDone(), bool cancelOnError) { |
| 283 if (_isUsed) throw new StateError("Stream has already been listened to."); | 283 if (_isUsed) throw new StateError("Stream has already been listened to."); |
| 284 _isUsed = true; | 284 _isUsed = true; |
| 285 return new _BufferingStreamSubscription(DEVC$RT.wrap((void f(T __u127)) { | 285 return new _BufferingStreamSubscription(onData, onError, onDone, cancelOnError)
.._setPendingEvents(_pending()); |
| 286 void c(T x0) => f(DEVC$RT.cast(x0, dynamic, T, "CastParam", """line 516, column
9 of dart:async/stream_impl.dart: """, x0 is T, false)); | |
| 287 return f == null ? null : c; | |
| 288 } | |
| 289 , onData, DEVC$RT.type((__t130<T> _) { | |
| 290 } | |
| 291 ), __t128, "Wrap", """line 516, column 9 of dart:async/stream_impl.dart: """, on
Data is __t128), onError, onDone, cancelOnError).._setPendingEvents(_pending()); | |
| 292 } | 286 } |
| 293 } | 287 } |
| 294 class _IterablePendingEvents<T> extends _PendingEvents {Iterator<T> _iterator; | 288 class _IterablePendingEvents<T> extends _PendingEvents {Iterator<T> _iterator; |
| 295 _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator; | 289 _IterablePendingEvents(Iterable<T> data) : _iterator = data.iterator; |
| 296 bool get isEmpty => _iterator == null; | 290 bool get isEmpty => _iterator == null; |
| 297 void handleNext(_EventDispatch dispatch) { | 291 void handleNext(_EventDispatch dispatch) { |
| 298 if (_iterator == null) { | 292 if (_iterator == null) { |
| 299 throw new StateError("No events pending."); | 293 throw new StateError("No events pending."); |
| 300 } | 294 } |
| 301 bool isDone; | 295 bool isDone; |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 467 if (isPaused) return; _state |= _DONE_SENT; | 461 if (isPaused) return; _state |= _DONE_SENT; |
| 468 if (_onDone != null) _zone.runGuarded(_onDone); | 462 if (_onDone != null) _zone.runGuarded(_onDone); |
| 469 } | 463 } |
| 470 } | 464 } |
| 471 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source; | 465 class _AsBroadcastStream<T> extends Stream<T> {final Stream<T> _source; |
| 472 final _broadcastCallback _onListenHandler; | 466 final _broadcastCallback _onListenHandler; |
| 473 final _broadcastCallback _onCancelHandler; | 467 final _broadcastCallback _onCancelHandler; |
| 474 final Zone _zone; | 468 final Zone _zone; |
| 475 _AsBroadcastStreamController<T> _controller; | 469 _AsBroadcastStreamController<T> _controller; |
| 476 StreamSubscription<T> _subscription; | 470 StreamSubscription<T> _subscription; |
| 477 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr
iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl
er = Zone.current.registerUnaryCallback(DEVC$RT.wrap((void f(StreamSubscription<
dynamic> __u132)) { | 471 _AsBroadcastStream(this._source, void onListenHandler(StreamSubscription subscr
iption), void onCancelHandler(StreamSubscription subscription)) : _onListenHandl
er = ((__x101) => DEVC$RT.wrap((dynamic f(dynamic __u98)) { |
| 478 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty
pe((StreamSubscription<dynamic> _) { | 472 dynamic c(dynamic x0) => f(x0); |
| 479 } | |
| 480 ), "CastParam", """line 813, column 63 of dart:async/stream_impl.dart: """, x0 i
s StreamSubscription<dynamic>, true)); | |
| 481 return f == null ? null : c; | 473 return f == null ? null : c; |
| 482 } | 474 } |
| 483 , onListenHandler, __t133, __t119, "Wrap", """line 813, column 63 of dart:async/
stream_impl.dart: """, onListenHandler is __t119)), _onCancelHandler = Zone.curr
ent.registerUnaryCallback(DEVC$RT.wrap((void f(StreamSubscription<dynamic> __u13
5)) { | 475 , __x101, __t92, __t99, "Wrap", """line 813, column 28 of dart:async/stream_impl
.dart: """, __x101 is __t99))(Zone.current.registerUnaryCallback(onListenHandler
)), _onCancelHandler = ((__x103) => DEVC$RT.wrap((dynamic f(dynamic __u102)) { |
| 484 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty
pe((StreamSubscription<dynamic> _) { | 476 dynamic c(dynamic x0) => f(x0); |
| 485 } | |
| 486 ), "CastParam", """line 814, column 63 of dart:async/stream_impl.dart: """, x0 i
s StreamSubscription<dynamic>, true)); | |
| 487 return f == null ? null : c; | 477 return f == null ? null : c; |
| 488 } | 478 } |
| 489 , onCancelHandler, __t133, __t119, "Wrap", """line 814, column 63 of dart:async/
stream_impl.dart: """, onCancelHandler is __t119)), _zone = Zone.current { | 479 , __x103, __t92, __t99, "Wrap", """line 814, column 28 of dart:async/stream_impl
.dart: """, __x103 is __t99))(Zone.current.registerUnaryCallback(onCancelHandler
)), _zone = Zone.current { |
| 490 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel); | 480 _controller = new _AsBroadcastStreamController<T>(_onListen, _onCancel); |
| 491 } | 481 } |
| 492 bool get isBroadcast => true; | 482 bool get isBroadcast => true; |
| 493 StreamSubscription<T> listen(void onData(T data), { | 483 StreamSubscription<T> listen(void onData(T data), { |
| 494 Function onError, void onDone(), bool cancelOnError} | 484 Function onError, void onDone(), bool cancelOnError} |
| 495 ) { | 485 ) { |
| 496 if (_controller == null || _controller.isClosed) { | 486 if (_controller == null || _controller.isClosed) { |
| 497 return new _DoneStreamSubscription<T>(onDone); | 487 return new _DoneStreamSubscription<T>(onDone); |
| 498 } | 488 } |
| 499 if (_subscription == null) { | 489 if (_subscription == null) { |
| 500 _subscription = _source.listen(_controller.add, onError: _controller.addError, o
nDone: _controller.close); | 490 _subscription = _source.listen(_controller.add, onError: _controller.addError, o
nDone: _controller.close); |
| 501 } | 491 } |
| 502 cancelOnError = identical(true, cancelOnError); | 492 cancelOnError = identical(true, cancelOnError); |
| 503 return _controller._subscribe(onData, onError, onDone, cancelOnError); | 493 return _controller._subscribe(onData, onError, onDone, cancelOnError); |
| 504 } | 494 } |
| 505 void _onCancel() { | 495 void _onCancel() { |
| 506 bool shutdown = (_controller == null) || _controller.isClosed; | 496 bool shutdown = (_controller == null) || _controller.isClosed; |
| 507 if (_onCancelHandler != null) { | 497 if (_onCancelHandler != null) { |
| 508 _zone.runUnary(DEVC$RT.wrap((void f(StreamSubscription<dynamic> __u136)) { | 498 _zone.runUnary(_onCancelHandler, new _BroadcastSubscriptionWrapper(this)); |
| 509 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty
pe((StreamSubscription<dynamic> _) { | |
| 510 } | |
| 511 ), "CastParam", """line 842, column 22 of dart:async/stream_impl.dart: """, x0 i
s StreamSubscription<dynamic>, true)); | |
| 512 return f == null ? null : c; | |
| 513 } | |
| 514 , _onCancelHandler, __t133, __t119, "Wrap", """line 842, column 22 of dart:async
/stream_impl.dart: """, _onCancelHandler is __t119), new _BroadcastSubscriptionW
rapper(this)); | |
| 515 } | 499 } |
| 516 if (shutdown) { | 500 if (shutdown) { |
| 517 if (_subscription != null) { | 501 if (_subscription != null) { |
| 518 _subscription.cancel(); | 502 _subscription.cancel(); |
| 519 _subscription = null; | 503 _subscription = null; |
| 520 } | 504 } |
| 521 } | 505 } |
| 522 } | 506 } |
| 523 void _onListen() { | 507 void _onListen() { |
| 524 if (_onListenHandler != null) { | 508 if (_onListenHandler != null) { |
| 525 _zone.runUnary(DEVC$RT.wrap((void f(StreamSubscription<dynamic> __u137)) { | 509 _zone.runUnary(_onListenHandler, new _BroadcastSubscriptionWrapper(this)); |
| 526 void c(StreamSubscription<dynamic> x0) => f(DEVC$RT.cast(x0, dynamic, DEVC$RT.ty
pe((StreamSubscription<dynamic> _) { | |
| 527 } | |
| 528 ), "CastParam", """line 854, column 22 of dart:async/stream_impl.dart: """, x0 i
s StreamSubscription<dynamic>, true)); | |
| 529 return f == null ? null : c; | |
| 530 } | |
| 531 , _onListenHandler, __t133, __t119, "Wrap", """line 854, column 22 of dart:async
/stream_impl.dart: """, _onListenHandler is __t119), new _BroadcastSubscriptionW
rapper(this)); | |
| 532 } | 510 } |
| 533 } | 511 } |
| 534 void _cancelSubscription() { | 512 void _cancelSubscription() { |
| 535 if (_subscription == null) return; StreamSubscription subscription = _subscripti
on; | 513 if (_subscription == null) return; StreamSubscription subscription = _subscripti
on; |
| 536 _subscription = null; | 514 _subscription = null; |
| 537 _controller = null; | 515 _controller = null; |
| 538 subscription.cancel(); | 516 subscription.cancel(); |
| 539 } | 517 } |
| 540 void _pauseSubscription(Future resumeSignal) { | 518 void _pauseSubscription(Future resumeSignal) { |
| 541 if (_subscription == null) return; _subscription.pause(resumeSignal); | 519 if (_subscription == null) return; _subscription.pause(resumeSignal); |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 671 } | 649 } |
| 672 ), "CastGeneral", """line 1073, column 31 of dart:async/stream_impl.dart: """, _
futureOrPrefetch is _Future<bool>, false); | 650 ), "CastGeneral", """line 1073, column 31 of dart:async/stream_impl.dart: """, _
futureOrPrefetch is _Future<bool>, false); |
| 673 _clear(); | 651 _clear(); |
| 674 hasNext._complete(false); | 652 hasNext._complete(false); |
| 675 return;} | 653 return;} |
| 676 _subscription.pause(); | 654 _subscription.pause(); |
| 677 _futureOrPrefetch = null; | 655 _futureOrPrefetch = null; |
| 678 _state = _STATE_EXTRA_DONE; | 656 _state = _STATE_EXTRA_DONE; |
| 679 } | 657 } |
| 680 } | 658 } |
| 681 typedef dynamic __t119(dynamic __u120); | 659 typedef void __t87<T>(T __u88); |
| 682 typedef void __t121<T>(T __u122); | 660 typedef void __t89(dynamic __u90); |
| 683 typedef dynamic __t124(dynamic __u125, dynamic __u126); | 661 typedef dynamic __t92(dynamic __u93); |
| 684 typedef void __t128(dynamic __u129); | 662 typedef dynamic __t95(dynamic __u96, dynamic __u97); |
| 685 typedef void __t130<T>(T __u131); | 663 typedef void __t99(StreamSubscription<dynamic> __u100); |
| 686 typedef void __t133(StreamSubscription<dynamic> __u134); | |
| OLD | NEW |