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

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

Issue 301193010: Update documentation for "close". (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove spurious future 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 | « no previous file | sdk/lib/async/stream.dart » ('j') | sdk/lib/async/stream.dart » ('J')
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 21 matching lines...) Expand all
32 bool cancelOnError) 32 bool cancelOnError)
33 : super(controller, cancelOnError) { 33 : super(controller, cancelOnError) {
34 _next = _previous = this; 34 _next = _previous = this;
35 } 35 }
36 36
37 _BroadcastStreamController get _controller => super._controller; 37 _BroadcastStreamController get _controller => super._controller;
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
43 void _toggleEventId() { 42 void _toggleEventId() {
44 _eventState ^= _STATE_EVENT_ID; 43 _eventState ^= _STATE_EVENT_ID;
45 } 44 }
46 45
47 bool get _isFiring => (_eventState & _STATE_FIRING) != 0; 46 bool get _isFiring => (_eventState & _STATE_FIRING) != 0;
48 47
49 bool _setRemoveAfterFiring() { 48 bool _setRemoveAfterFiring() {
50 assert(_isFiring); 49 assert(_isFiring);
51 _eventState |= _STATE_REMOVE_AFTER_FIRING; 50 _eventState |= _STATE_REMOVE_AFTER_FIRING;
52 } 51 }
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 _BroadcastSubscriptionLink next = subscription._next; 173 _BroadcastSubscriptionLink next = subscription._next;
175 previous._next = next; 174 previous._next = next;
176 next._previous = previous; 175 next._previous = previous;
177 subscription._next = subscription._previous = subscription; 176 subscription._next = subscription._previous = subscription;
178 } 177 }
179 178
180 // _StreamControllerLifecycle interface. 179 // _StreamControllerLifecycle interface.
181 180
182 StreamSubscription<T> _subscribe(bool cancelOnError) { 181 StreamSubscription<T> _subscribe(bool cancelOnError) {
183 if (isClosed) { 182 if (isClosed) {
184 throw new StateError("Subscribing to closed stream"); 183 return new _DoneStreamSubscription<T>(_nullDoneHandler);
185 } 184 }
186 StreamSubscription subscription = 185 StreamSubscription subscription =
187 new _BroadcastSubscription<T>(this, cancelOnError); 186 new _BroadcastSubscription<T>(this, cancelOnError);
188 _addListener(subscription); 187 _addListener(subscription);
189 if (identical(_next, _previous)) { 188 if (identical(_next, _previous)) {
190 // Only one listener, so it must be the first listener. 189 // Only one listener, so it must be the first listener.
191 _runGuarded(_onListen); 190 _runGuarded(_onListen);
192 } 191 }
193 return subscription; 192 return subscription;
194 } 193 }
(...skipping 293 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 _pauseCount++; 487 _pauseCount++;
489 } 488 }
490 void resume() { _resume(null); } 489 void resume() { _resume(null); }
491 void _resume(_) { 490 void _resume(_) {
492 if (_pauseCount > 0) _pauseCount--; 491 if (_pauseCount > 0) _pauseCount--;
493 } 492 }
494 Future cancel() { return new _Future.immediate(null); } 493 Future cancel() { return new _Future.immediate(null); }
495 bool get isPaused => _pauseCount > 0; 494 bool get isPaused => _pauseCount > 0;
496 Future asFuture([Object value]) => new _Future(); 495 Future asFuture([Object value]) => new _Future();
497 } 496 }
OLDNEW
« no previous file with comments | « no previous file | sdk/lib/async/stream.dart » ('j') | sdk/lib/async/stream.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698