OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 part of dart.async; | 5 part of dart.async; |
6 | 6 |
7 class _BroadcastStream<T> extends _ControllerStream<T> { | 7 class _BroadcastStream<T> extends _ControllerStream<T> { |
8 _BroadcastStream(_StreamControllerLifecycle controller) : super(controller); | 8 _BroadcastStream(_StreamControllerLifecycle controller) : super(controller); |
9 | 9 |
10 bool get isBroadcast => true; | 10 bool get isBroadcast => true; |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 _BroadcastSubscription(_StreamControllerLifecycle controller, | 31 _BroadcastSubscription(_StreamControllerLifecycle controller, |
32 void onData(T data), | 32 void onData(T data), |
33 Function onError, | 33 Function onError, |
34 void onDone(), | 34 void onDone(), |
35 bool cancelOnError) | 35 bool cancelOnError) |
36 : super(controller, onData, onError, onDone, cancelOnError) { | 36 : super(controller, onData, onError, onDone, cancelOnError) { |
37 _next = _previous = this; | 37 _next = _previous = this; |
38 } | 38 } |
39 | 39 |
40 _BroadcastStreamController<T> get _controller => super._controller; | |
41 | |
42 bool _expectsEvent(int eventId) => | 40 bool _expectsEvent(int eventId) => |
43 (_eventState & _STATE_EVENT_ID) == eventId; | 41 (_eventState & _STATE_EVENT_ID) == eventId; |
44 | 42 |
45 void _toggleEventId() { | 43 void _toggleEventId() { |
46 _eventState ^= _STATE_EVENT_ID; | 44 _eventState ^= _STATE_EVENT_ID; |
47 } | 45 } |
48 | 46 |
49 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; | 47 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; |
50 | 48 |
51 void _setRemoveAfterFiring() { | 49 void _setRemoveAfterFiring() { |
(...skipping 452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
504 _pauseCount++; | 502 _pauseCount++; |
505 } | 503 } |
506 void resume() { _resume(null); } | 504 void resume() { _resume(null); } |
507 void _resume(_) { | 505 void _resume(_) { |
508 if (_pauseCount > 0) _pauseCount--; | 506 if (_pauseCount > 0) _pauseCount--; |
509 } | 507 } |
510 Future cancel() { return new _Future.immediate(null); } | 508 Future cancel() { return new _Future.immediate(null); } |
511 bool get isPaused => _pauseCount > 0; | 509 bool get isPaused => _pauseCount > 0; |
512 Future asFuture([Object value]) => new _Future(); | 510 Future asFuture([Object value]) => new _Future(); |
513 } | 511 } |
OLD | NEW |