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

Side by Side Diff: sdk/lib/async/broadcast_stream_controller.dart

Issue 331993005: Rewrite Zone implementation to avoid recursively looking up stuff in the parent chain. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Inadvertent edit. Created 6 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « sdk/lib/_internal/lib/async_patch.dart ('k') | sdk/lib/async/schedule_microtask.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 27 matching lines...) Expand all
38 38
39 bool _expectsEvent(int eventId) => 39 bool _expectsEvent(int eventId) =>
40 (_eventState & _STATE_EVENT_ID) == eventId; 40 (_eventState & _STATE_EVENT_ID) == eventId;
41 41
42 void _toggleEventId() { 42 void _toggleEventId() {
43 _eventState ^= _STATE_EVENT_ID; 43 _eventState ^= _STATE_EVENT_ID;
44 } 44 }
45 45
46 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; 46 bool get _isFiring => (_eventState & _STATE_FIRING) != 0;
47 47
48 bool _setRemoveAfterFiring() { 48 void _setRemoveAfterFiring() {
49 assert(_isFiring); 49 assert(_isFiring);
50 _eventState |= _STATE_REMOVE_AFTER_FIRING; 50 _eventState |= _STATE_REMOVE_AFTER_FIRING;
51 } 51 }
52 52
53 bool get _removeAfterFiring => 53 bool get _removeAfterFiring =>
54 (_eventState & _STATE_REMOVE_AFTER_FIRING) != 0; 54 (_eventState & _STATE_REMOVE_AFTER_FIRING) != 0;
55 55
56 // The controller._recordPause doesn't do anything for a broadcast controller, 56 // The controller._recordPause doesn't do anything for a broadcast controller,
57 // so we don't bother calling it. 57 // so we don't bother calling it.
58 void _onPause() { } 58 void _onPause() { }
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
200 subscription._setRemoveAfterFiring(); 200 subscription._setRemoveAfterFiring();
201 } else { 201 } else {
202 assert(!identical(subscription._next, subscription)); 202 assert(!identical(subscription._next, subscription));
203 _removeListener(subscription); 203 _removeListener(subscription);
204 // If we are currently firing an event, the empty-check is performed at 204 // If we are currently firing an event, the empty-check is performed at
205 // the end of the listener loop instead of here. 205 // the end of the listener loop instead of here.
206 if (!_isFiring && _isEmpty) { 206 if (!_isFiring && _isEmpty) {
207 _callOnCancel(); 207 _callOnCancel();
208 } 208 }
209 } 209 }
210 return null;
210 } 211 }
211 212
212 void _recordPause(StreamSubscription<T> subscription) {} 213 void _recordPause(StreamSubscription<T> subscription) {}
213 void _recordResume(StreamSubscription<T> subscription) {} 214 void _recordResume(StreamSubscription<T> subscription) {}
214 215
215 // EventSink interface. 216 // EventSink interface.
216 217
217 Error _addEventError() { 218 Error _addEventError() {
218 if (isClosed) { 219 if (isClosed) {
219 return new StateError("Cannot add new events after calling close"); 220 return new StateError("Cannot add new events after calling close");
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
487 _pauseCount++; 488 _pauseCount++;
488 } 489 }
489 void resume() { _resume(null); } 490 void resume() { _resume(null); }
490 void _resume(_) { 491 void _resume(_) {
491 if (_pauseCount > 0) _pauseCount--; 492 if (_pauseCount > 0) _pauseCount--;
492 } 493 }
493 Future cancel() { return new _Future.immediate(null); } 494 Future cancel() { return new _Future.immediate(null); }
494 bool get isPaused => _pauseCount > 0; 495 bool get isPaused => _pauseCount > 0;
495 Future asFuture([Object value]) => new _Future(); 496 Future asFuture([Object value]) => new _Future();
496 } 497 }
OLDNEW
« no previous file with comments | « sdk/lib/_internal/lib/async_patch.dart ('k') | sdk/lib/async/schedule_microtask.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698