Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(768)

Side by Side Diff: test/generated_sdk/lib/async/broadcast_stream_controller.dart

Issue 1112403004: SDK fixes (Closed) Base URL: git@github.com:dart-lang/dev_compiler.git@master
Patch Set: Formatting fix Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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 get _controller => super._controller; 40 _BroadcastStreamController<T> get _controller => super._controller;
41 41
42 bool _expectsEvent(int eventId) => 42 bool _expectsEvent(int eventId) =>
43 (_eventState & _STATE_EVENT_ID) == eventId; 43 (_eventState & _STATE_EVENT_ID) == eventId;
44 44
45 void _toggleEventId() { 45 void _toggleEventId() {
46 _eventState ^= _STATE_EVENT_ID; 46 _eventState ^= _STATE_EVENT_ID;
47 } 47 }
48 48
49 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; 49 bool get _isFiring => (_eventState & _STATE_FIRING) != 0;
50 50
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
194 new _BroadcastSubscription<T>(this, onData, onError, onDone, 194 new _BroadcastSubscription<T>(this, onData, onError, onDone,
195 cancelOnError); 195 cancelOnError);
196 _addListener(subscription); 196 _addListener(subscription);
197 if (identical(_next, _previous)) { 197 if (identical(_next, _previous)) {
198 // Only one listener, so it must be the first listener. 198 // Only one listener, so it must be the first listener.
199 _runGuarded(_onListen); 199 _runGuarded(_onListen);
200 } 200 }
201 return subscription; 201 return subscription;
202 } 202 }
203 203
204 Future _recordCancel(_BroadcastSubscription<T> subscription) { 204 Future _recordCancel(StreamSubscription<T> subscription) {
205 // If already removed by the stream, don't remove it again. 205 // If already removed by the stream, don't remove it again.
206 if (identical(subscription._next, subscription)) return null; 206 if (identical(subscription._next, subscription)) return null;
207 assert(!identical(subscription._next, subscription)); 207 assert(!identical(subscription._next, subscription));
208 if (subscription._isFiring) { 208 if (subscription._isFiring) {
209 subscription._setRemoveAfterFiring(); 209 subscription._setRemoveAfterFiring();
210 } else { 210 } else {
211 assert(!identical(subscription._next, subscription)); 211 assert(!identical(subscription._next, subscription));
212 _removeListener(subscription); 212 _removeListener(subscription);
213 // If we are currently firing an event, the empty-check is performed at 213 // If we are currently firing an event, the empty-check is performed at
214 // the end of the listener loop instead of here. 214 // the end of the listener loop instead of here.
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 _pauseCount++; 503 _pauseCount++;
504 } 504 }
505 void resume() { _resume(null); } 505 void resume() { _resume(null); }
506 void _resume(_) { 506 void _resume(_) {
507 if (_pauseCount > 0) _pauseCount--; 507 if (_pauseCount > 0) _pauseCount--;
508 } 508 }
509 Future cancel() { return new _Future.immediate(null); } 509 Future cancel() { return new _Future.immediate(null); }
510 bool get isPaused => _pauseCount > 0; 510 bool get isPaused => _pauseCount > 0;
511 Future asFuture([Object value]) => new _Future(); 511 Future asFuture([Object value]) => new _Future();
512 } 512 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698