OLD | NEW |
1 part of dart.async; | 1 part of dart.async; |
2 class _BroadcastStream<T> extends _ControllerStream<T> {_BroadcastStream(_Strea
mControllerLifecycle controller) : super(DEVC$RT.cast(controller, DEVC$RT.type((
_StreamControllerLifecycle<dynamic> _) { | 2 class _BroadcastStream<T> extends _ControllerStream<T> {_BroadcastStream(_Strea
mControllerLifecycle controller) : super(DEVC$RT.cast(controller, DEVC$RT.type((
_StreamControllerLifecycle<dynamic> _) { |
3 } | 3 } |
4 ), DEVC$RT.type((_StreamControllerLifecycle<T> _) { | 4 ), DEVC$RT.type((_StreamControllerLifecycle<T> _) { |
5 } | 5 } |
6 ), "CastDynamic", """line 8, column 67 of dart:async/broadcast_stream_controller
.dart: """, controller is _StreamControllerLifecycle<T>, false)); | 6 ), "CompositeCast", """line 8, column 67 of dart:async/broadcast_stream_controll
er.dart: """, controller is _StreamControllerLifecycle<T>, false)); |
7 bool get isBroadcast => true; | 7 bool get isBroadcast => true; |
8 } | 8 } |
9 abstract class _BroadcastSubscriptionLink {_BroadcastSubscriptionLink _next; | 9 abstract class _BroadcastSubscriptionLink {_BroadcastSubscriptionLink _next; |
10 _BroadcastSubscriptionLink _previous; | 10 _BroadcastSubscriptionLink _previous; |
11 } | 11 } |
12 class _BroadcastSubscription<T> extends _ControllerSubscription<T> implements _
BroadcastSubscriptionLink {static const int _STATE_EVENT_ID = 1; | 12 class _BroadcastSubscription<T> extends _ControllerSubscription<T> implements _
BroadcastSubscriptionLink {static const int _STATE_EVENT_ID = 1; |
13 static const int _STATE_FIRING = 2; | 13 static const int _STATE_FIRING = 2; |
14 static const int _STATE_REMOVE_AFTER_FIRING = 4; | 14 static const int _STATE_REMOVE_AFTER_FIRING = 4; |
15 int _eventState; | 15 int _eventState; |
16 _BroadcastSubscriptionLink _next; | 16 _BroadcastSubscriptionLink _next; |
17 _BroadcastSubscriptionLink _previous; | 17 _BroadcastSubscriptionLink _previous; |
18 _BroadcastSubscription(_StreamControllerLifecycle controller, void onData(T dat
a), Function onError, void onDone(), bool cancelOnError) : super(DEVC$RT.cast(co
ntroller, DEVC$RT.type((_StreamControllerLifecycle<dynamic> _) { | 18 _BroadcastSubscription(_StreamControllerLifecycle controller, void onData(T dat
a), Function onError, void onDone(), bool cancelOnError) : super(DEVC$RT.cast(co
ntroller, DEVC$RT.type((_StreamControllerLifecycle<dynamic> _) { |
19 } | 19 } |
20 ), DEVC$RT.type((_StreamControllerLifecycle<T> _) { | 20 ), DEVC$RT.type((_StreamControllerLifecycle<T> _) { |
21 } | 21 } |
22 ), "CastDynamic", """line 36, column 15 of dart:async/broadcast_stream_controlle
r.dart: """, controller is _StreamControllerLifecycle<T>, false), onData, onErro
r, onDone, cancelOnError) { | 22 ), "CompositeCast", """line 36, column 15 of dart:async/broadcast_stream_control
ler.dart: """, controller is _StreamControllerLifecycle<T>, false), onData, onEr
ror, onDone, cancelOnError) { |
23 _next = _previous = this; | 23 _next = _previous = this; |
24 } | 24 } |
25 _BroadcastStreamController get _controller => ((__x2) => DEVC$RT.cast(__x2, DEV
C$RT.type((_StreamControllerLifecycle<T> _) { | 25 _BroadcastStreamController get _controller => ((__x2) => DEVC$RT.cast(__x2, DEV
C$RT.type((_StreamControllerLifecycle<T> _) { |
26 } | 26 } |
27 ), DEVC$RT.type((_BroadcastStreamController<dynamic> _) { | 27 ), DEVC$RT.type((_BroadcastStreamController<dynamic> _) { |
28 } | 28 } |
29 ), "CastGeneral", """line 40, column 49 of dart:async/broadcast_stream_controlle
r.dart: """, __x2 is _BroadcastStreamController<dynamic>, true))(super._controll
er); | 29 ), "ImplicitCast", """line 40, column 49 of dart:async/broadcast_stream_controll
er.dart: """, __x2 is _BroadcastStreamController<dynamic>, true))(super._control
ler); |
30 bool _expectsEvent(int eventId) => (_eventState & _STATE_EVENT_ID) == eventId; | 30 bool _expectsEvent(int eventId) => (_eventState & _STATE_EVENT_ID) == eventId; |
31 void _toggleEventId() { | 31 void _toggleEventId() { |
32 _eventState ^= _STATE_EVENT_ID; | 32 _eventState ^= _STATE_EVENT_ID; |
33 } | 33 } |
34 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; | 34 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; |
35 void _setRemoveAfterFiring() { | 35 void _setRemoveAfterFiring() { |
36 assert (_isFiring); _eventState |= _STATE_REMOVE_AFTER_FIRING; | 36 assert (_isFiring); _eventState |= _STATE_REMOVE_AFTER_FIRING; |
37 } | 37 } |
38 bool get _removeAfterFiring => (_eventState & _STATE_REMOVE_AFTER_FIRING) != 0; | 38 bool get _removeAfterFiring => (_eventState & _STATE_REMOVE_AFTER_FIRING) != 0; |
39 void _onPause() { | 39 void _onPause() { |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
89 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on
Done(), bool cancelOnError) { | 89 StreamSubscription<T> _subscribe(void onData(T data), Function onError, void on
Done(), bool cancelOnError) { |
90 if (isClosed) { | 90 if (isClosed) { |
91 if (onDone == null) onDone = _nullDoneHandler; | 91 if (onDone == null) onDone = _nullDoneHandler; |
92 return new _DoneStreamSubscription<T>(onDone); | 92 return new _DoneStreamSubscription<T>(onDone); |
93 } | 93 } |
94 StreamSubscription subscription = new _BroadcastSubscription<T>(this, onData, o
nError, onDone, cancelOnError); | 94 StreamSubscription subscription = new _BroadcastSubscription<T>(this, onData, o
nError, onDone, cancelOnError); |
95 _addListener(DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynami
c> _) { | 95 _addListener(DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynami
c> _) { |
96 } | 96 } |
97 ), DEVC$RT.type((_BroadcastSubscription<T> _) { | 97 ), DEVC$RT.type((_BroadcastSubscription<T> _) { |
98 } | 98 } |
99 ), "CastGeneral", """line 196, column 18 of dart:async/broadcast_stream_controll
er.dart: """, subscription is _BroadcastSubscription<T>, false)); | 99 ), "CompositeCast", """line 196, column 18 of dart:async/broadcast_stream_contro
ller.dart: """, subscription is _BroadcastSubscription<T>, false)); |
100 if (identical(_next, _previous)) { | 100 if (identical(_next, _previous)) { |
101 _runGuarded(_onListen); | 101 _runGuarded(_onListen); |
102 } | 102 } |
103 return DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynamic> _)
{ | 103 return DEVC$RT.cast(subscription, DEVC$RT.type((StreamSubscription<dynamic> _)
{ |
104 } | 104 } |
105 ), DEVC$RT.type((StreamSubscription<T> _) { | 105 ), DEVC$RT.type((StreamSubscription<T> _) { |
106 } | 106 } |
107 ), "CastDynamic", """line 201, column 12 of dart:async/broadcast_stream_controll
er.dart: """, subscription is StreamSubscription<T>, false); | 107 ), "CompositeCast", """line 201, column 12 of dart:async/broadcast_stream_contro
ller.dart: """, subscription is StreamSubscription<T>, false); |
108 } | 108 } |
109 Future _recordCancel(_BroadcastSubscription<T> subscription) { | 109 Future _recordCancel(_BroadcastSubscription<T> subscription) { |
110 if (identical(subscription._next, subscription)) return null; | 110 if (identical(subscription._next, subscription)) return null; |
111 assert (!identical(subscription._next, subscription)); if (subscription._isFiri
ng) { | 111 assert (!identical(subscription._next, subscription)); if (subscription._isFiri
ng) { |
112 subscription._setRemoveAfterFiring(); | 112 subscription._setRemoveAfterFiring(); |
113 } | 113 } |
114 else { | 114 else { |
115 assert (!identical(subscription._next, subscription)); _removeListener(subscript
ion); | 115 assert (!identical(subscription._next, subscription)); _removeListener(subscript
ion); |
116 if (!_isFiring && _isEmpty) { | 116 if (!_isFiring && _isEmpty) { |
117 _callOnCancel(); | 117 _callOnCancel(); |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 Future get done => _ensureDoneFuture(); | 156 Future get done => _ensureDoneFuture(); |
157 Future addStream(Stream<T> stream, { | 157 Future addStream(Stream<T> stream, { |
158 bool cancelOnError : true} | 158 bool cancelOnError : true} |
159 ) { | 159 ) { |
160 if (!_mayAddEvent) throw _addEventError(); | 160 if (!_mayAddEvent) throw _addEventError(); |
161 _state |= _STATE_ADDSTREAM; | 161 _state |= _STATE_ADDSTREAM; |
162 _addStreamState = ((__x3) => DEVC$RT.cast(__x3, DEVC$RT.type((_AddStreamState<d
ynamic> _) { | 162 _addStreamState = ((__x3) => DEVC$RT.cast(__x3, DEVC$RT.type((_AddStreamState<d
ynamic> _) { |
163 } | 163 } |
164 ), DEVC$RT.type((_AddStreamState<T> _) { | 164 ), DEVC$RT.type((_AddStreamState<T> _) { |
165 } | 165 } |
166 ), "CastExact", """line 268, column 23 of dart:async/broadcast_stream_controller
.dart: """, __x3 is _AddStreamState<T>, false))(new _AddStreamState(this, stream
, cancelOnError)); | 166 ), "InferableAllocation", """line 268, column 23 of dart:async/broadcast_stream_
controller.dart: """, __x3 is _AddStreamState<T>, false))(new _AddStreamState(th
is, stream, cancelOnError)); |
167 return _addStreamState.addStreamFuture; | 167 return _addStreamState.addStreamFuture; |
168 } | 168 } |
169 void _add(T data) { | 169 void _add(T data) { |
170 _sendData(data); | 170 _sendData(data); |
171 } | 171 } |
172 void _addError(Object error, StackTrace stackTrace) { | 172 void _addError(Object error, StackTrace stackTrace) { |
173 _sendError(error, stackTrace); | 173 _sendError(error, stackTrace); |
174 } | 174 } |
175 void _close() { | 175 void _close() { |
176 assert (_isAddingStream); _AddStreamState addState = _addStreamState; | 176 assert (_isAddingStream); _AddStreamState addState = _addStreamState; |
177 _addStreamState = null; | 177 _addStreamState = null; |
178 _state &= ~_STATE_ADDSTREAM; | 178 _state &= ~_STATE_ADDSTREAM; |
179 addState.complete(); | 179 addState.complete(); |
180 } | 180 } |
181 void _forEachListener(void action(_BufferingStreamSubscription<T> subscription)
) { | 181 void _forEachListener(void action(_BufferingStreamSubscription<T> subscription)
) { |
182 if (_isFiring) { | 182 if (_isFiring) { |
183 throw new StateError("Cannot fire new event. Controller is already firing an eve
nt"); | 183 throw new StateError("Cannot fire new event. Controller is already firing an eve
nt"); |
184 } | 184 } |
185 if (_isEmpty) return; int id = (_state & _STATE_EVENT_ID); | 185 if (_isEmpty) return; int id = (_state & _STATE_EVENT_ID); |
186 _state ^= _STATE_EVENT_ID | _STATE_FIRING; | 186 _state ^= _STATE_EVENT_ID | _STATE_FIRING; |
187 _BroadcastSubscriptionLink link = _next; | 187 _BroadcastSubscriptionLink link = _next; |
188 while (!identical(link, this)) { | 188 while (!identical(link, this)) { |
189 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { | 189 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { |
190 } | 190 } |
191 ), "CastGeneral", """line 309, column 48 of dart:async/broadcast_stream_controll
er.dart: """, link is _BroadcastSubscription<T>, false); | 191 ), "CompositeCast", """line 309, column 48 of dart:async/broadcast_stream_contro
ller.dart: """, link is _BroadcastSubscription<T>, false); |
192 if (subscription._expectsEvent(id)) { | 192 if (subscription._expectsEvent(id)) { |
193 subscription._eventState |= _BroadcastSubscription._STATE_FIRING; | 193 subscription._eventState |= _BroadcastSubscription._STATE_FIRING; |
194 action(subscription); | 194 action(subscription); |
195 subscription._toggleEventId(); | 195 subscription._toggleEventId(); |
196 link = subscription._next; | 196 link = subscription._next; |
197 if (subscription._removeAfterFiring) { | 197 if (subscription._removeAfterFiring) { |
198 _removeListener(subscription); | 198 _removeListener(subscription); |
199 } | 199 } |
200 subscription._eventState &= ~_BroadcastSubscription._STATE_FIRING; | 200 subscription._eventState &= ~_BroadcastSubscription._STATE_FIRING; |
201 } | 201 } |
(...skipping 12 matching lines...) Expand all Loading... |
214 } | 214 } |
215 _runGuarded(_onCancel); | 215 _runGuarded(_onCancel); |
216 } | 216 } |
217 } | 217 } |
218 class _SyncBroadcastStreamController<T> extends _BroadcastStreamController<T> {
_SyncBroadcastStreamController(void onListen(), void onCancel()) : super(onListe
n, onCancel); | 218 class _SyncBroadcastStreamController<T> extends _BroadcastStreamController<T> {
_SyncBroadcastStreamController(void onListen(), void onCancel()) : super(onListe
n, onCancel); |
219 void _sendData(T data) { | 219 void _sendData(T data) { |
220 if (_isEmpty) return; if (_hasOneListener) { | 220 if (_isEmpty) return; if (_hasOneListener) { |
221 _state |= _BroadcastStreamController._STATE_FIRING; | 221 _state |= _BroadcastStreamController._STATE_FIRING; |
222 _BroadcastSubscription subscription = DEVC$RT.cast(_next, _BroadcastSubscriptio
nLink, DEVC$RT.type((_BroadcastSubscription<dynamic> _) { | 222 _BroadcastSubscription subscription = DEVC$RT.cast(_next, _BroadcastSubscriptio
nLink, DEVC$RT.type((_BroadcastSubscription<dynamic> _) { |
223 } | 223 } |
224 ), "CastGeneral", """line 350, column 45 of dart:async/broadcast_stream_controll
er.dart: """, _next is _BroadcastSubscription<dynamic>, true); | 224 ), "AssignmentCast", """line 350, column 45 of dart:async/broadcast_stream_contr
oller.dart: """, _next is _BroadcastSubscription<dynamic>, true); |
225 subscription._add(data); | 225 subscription._add(data); |
226 _state &= ~_BroadcastStreamController._STATE_FIRING; | 226 _state &= ~_BroadcastStreamController._STATE_FIRING; |
227 if (_isEmpty) { | 227 if (_isEmpty) { |
228 _callOnCancel(); | 228 _callOnCancel(); |
229 } | 229 } |
230 return;} | 230 return;} |
231 _forEachListener((_BufferingStreamSubscription<T> subscription) { | 231 _forEachListener((_BufferingStreamSubscription<T> subscription) { |
232 subscription._add(data); | 232 subscription._add(data); |
233 } | 233 } |
234 ); | 234 ); |
(...skipping 26 matching lines...) Expand all Loading... |
261 else { | 261 else { |
262 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as
yncComplete(null); | 262 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as
yncComplete(null); |
263 } | 263 } |
264 } | 264 } |
265 } | 265 } |
266 class _AsyncBroadcastStreamController<T> extends _BroadcastStreamController<T>
{_AsyncBroadcastStreamController(void onListen(), void onCancel()) : super(onLis
ten, onCancel); | 266 class _AsyncBroadcastStreamController<T> extends _BroadcastStreamController<T>
{_AsyncBroadcastStreamController(void onListen(), void onCancel()) : super(onLis
ten, onCancel); |
267 void _sendData(T data) { | 267 void _sendData(T data) { |
268 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin
k._next) { | 268 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin
k._next) { |
269 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { | 269 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { |
270 } | 270 } |
271 ), "CastGeneral", """line 393, column 48 of dart:async/broadcast_stream_controll
er.dart: """, link is _BroadcastSubscription<T>, false); | 271 ), "CompositeCast", """line 393, column 48 of dart:async/broadcast_stream_contro
ller.dart: """, link is _BroadcastSubscription<T>, false); |
272 subscription._addPending(new _DelayedData(data)); | 272 subscription._addPending(new _DelayedData(data)); |
273 } | 273 } |
274 } | 274 } |
275 void _sendError(Object error, StackTrace stackTrace) { | 275 void _sendError(Object error, StackTrace stackTrace) { |
276 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin
k._next) { | 276 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin
k._next) { |
277 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { | 277 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { |
278 } | 278 } |
279 ), "CastGeneral", """line 402, column 48 of dart:async/broadcast_stream_controll
er.dart: """, link is _BroadcastSubscription<T>, false); | 279 ), "CompositeCast", """line 402, column 48 of dart:async/broadcast_stream_contro
ller.dart: """, link is _BroadcastSubscription<T>, false); |
280 subscription._addPending(new _DelayedError(error, stackTrace)); | 280 subscription._addPending(new _DelayedError(error, stackTrace)); |
281 } | 281 } |
282 } | 282 } |
283 void _sendDone() { | 283 void _sendDone() { |
284 if (!_isEmpty) { | 284 if (!_isEmpty) { |
285 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin
k._next) { | 285 for (_BroadcastSubscriptionLink link = _next; !identical(link, this); link = lin
k._next) { |
286 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { | 286 _BroadcastSubscription<T> subscription = DEVC$RT.cast(link, _BroadcastSubscripti
onLink, DEVC$RT.type((_BroadcastSubscription<T> _) { |
287 } | 287 } |
288 ), "CastGeneral", """line 412, column 50 of dart:async/broadcast_stream_controll
er.dart: """, link is _BroadcastSubscription<T>, false); | 288 ), "CompositeCast", """line 412, column 50 of dart:async/broadcast_stream_contro
ller.dart: """, link is _BroadcastSubscription<T>, false); |
289 subscription._addPending(const _DelayedDone()); | 289 subscription._addPending(const _DelayedDone()); |
290 } | 290 } |
291 } | 291 } |
292 else { | 292 else { |
293 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as
yncComplete(null); | 293 assert (_doneFuture != null); assert (_doneFuture._mayComplete); _doneFuture._as
yncComplete(null); |
294 } | 294 } |
295 } | 295 } |
296 } | 296 } |
297 class _AsBroadcastStreamController<T> extends _SyncBroadcastStreamController<T>
implements _EventDispatch<T> {_StreamImplEvents _pending; | 297 class _AsBroadcastStreamController<T> extends _SyncBroadcastStreamController<T>
implements _EventDispatch<T> {_StreamImplEvents _pending; |
298 _AsBroadcastStreamController(void onListen(), void onCancel()) : super(onListen
, onCancel); | 298 _AsBroadcastStreamController(void onListen(), void onCancel()) : super(onListen
, onCancel); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 if (_pauseCount > 0) _pauseCount--; | 357 if (_pauseCount > 0) _pauseCount--; |
358 } | 358 } |
359 Future cancel() { | 359 Future cancel() { |
360 return new _Future.immediate(null); | 360 return new _Future.immediate(null); |
361 } | 361 } |
362 bool get isPaused => _pauseCount > 0; | 362 bool get isPaused => _pauseCount > 0; |
363 Future asFuture([Object value]) => new _Future(); | 363 Future asFuture([Object value]) => new _Future(); |
364 } | 364 } |
365 typedef void __t5<T>(_BufferingStreamSubscription<T> __u6); | 365 typedef void __t5<T>(_BufferingStreamSubscription<T> __u6); |
366 typedef dynamic __t7<T>(_BroadcastSubscription<T> __u8); | 366 typedef dynamic __t7<T>(_BroadcastSubscription<T> __u8); |
OLD | NEW |