| 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 /** Abstract and private interface for a place to put events. */ | 7 /** Abstract and private interface for a place to put events. */ |
| 8 abstract class _EventSink<T> { | 8 abstract class _EventSink<T> { |
| 9 void _add(T data); | 9 void _add(T data); |
| 10 void _addError(Object error, StackTrace stackTrace); | 10 void _addError(Object error, StackTrace stackTrace); |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 * when `cancelOnError` is true. | 72 * when `cancelOnError` is true. |
| 73 */ | 73 */ |
| 74 static const int _STATE_CANCELED = 8; | 74 static const int _STATE_CANCELED = 8; |
| 75 /** | 75 /** |
| 76 * Set when either: | 76 * Set when either: |
| 77 * | 77 * |
| 78 * * an error is sent, and [cancelOnError] is true, or | 78 * * an error is sent, and [cancelOnError] is true, or |
| 79 * * a done event is sent. | 79 * * a done event is sent. |
| 80 * | 80 * |
| 81 * If the subscription is canceled while _STATE_WAIT_FOR_CANCEL is set, the | 81 * If the subscription is canceled while _STATE_WAIT_FOR_CANCEL is set, the |
| 82 * state is unset, and no furher events must be delivered. | 82 * state is unset, and no further events must be delivered. |
| 83 */ | 83 */ |
| 84 static const int _STATE_WAIT_FOR_CANCEL = 16; | 84 static const int _STATE_WAIT_FOR_CANCEL = 16; |
| 85 static const int _STATE_IN_CALLBACK = 32; | 85 static const int _STATE_IN_CALLBACK = 32; |
| 86 static const int _STATE_HAS_PENDING = 64; | 86 static const int _STATE_HAS_PENDING = 64; |
| 87 static const int _STATE_PAUSE_COUNT = 128; | 87 static const int _STATE_PAUSE_COUNT = 128; |
| 88 | 88 |
| 89 /* Event handlers provided in constructor. */ | 89 /* Event handlers provided in constructor. */ |
| 90 _DataHandler<T> _onData; | 90 _DataHandler<T> _onData; |
| 91 Function _onError; | 91 Function _onError; |
| 92 _DoneHandler _onDone; | 92 _DoneHandler _onDone; |
| (...skipping 949 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1042 | 1042 |
| 1043 /** An empty broadcast stream, sending a done event as soon as possible. */ | 1043 /** An empty broadcast stream, sending a done event as soon as possible. */ |
| 1044 class _EmptyStream<T> extends Stream<T> { | 1044 class _EmptyStream<T> extends Stream<T> { |
| 1045 const _EmptyStream() : super._internal(); | 1045 const _EmptyStream() : super._internal(); |
| 1046 bool get isBroadcast => true; | 1046 bool get isBroadcast => true; |
| 1047 StreamSubscription<T> listen(void onData(T data), | 1047 StreamSubscription<T> listen(void onData(T data), |
| 1048 {Function onError, void onDone(), bool cancelOnError}) { | 1048 {Function onError, void onDone(), bool cancelOnError}) { |
| 1049 return new _DoneStreamSubscription<T>(onDone); | 1049 return new _DoneStreamSubscription<T>(onDone); |
| 1050 } | 1050 } |
| 1051 } | 1051 } |
| OLD | NEW |