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 1063 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1074 _Future<bool> hasNext = _futureOrPrefetch; | 1074 _Future<bool> hasNext = _futureOrPrefetch; |
1075 _clear(); | 1075 _clear(); |
1076 hasNext._complete(false); | 1076 hasNext._complete(false); |
1077 return; | 1077 return; |
1078 } | 1078 } |
1079 _subscription.pause(); | 1079 _subscription.pause(); |
1080 _futureOrPrefetch = null; | 1080 _futureOrPrefetch = null; |
1081 _state = _STATE_EXTRA_DONE; | 1081 _state = _STATE_EXTRA_DONE; |
1082 } | 1082 } |
1083 } | 1083 } |
| 1084 |
| 1085 /** An empty broadcast stream, sending a done event as soon as possible. */ |
| 1086 class _EmptyStream<T> extends Stream<T> { |
| 1087 const _EmptyStream() : super._internal(); |
| 1088 bool get isBroadcast => true; |
| 1089 StreamSubscription<T> listen(void onData(T data), |
| 1090 {Function onError, |
| 1091 void onDone(), |
| 1092 bool cancelOnError}) { |
| 1093 return new _DoneStreamSubscription<T>(onDone); |
| 1094 } |
| 1095 } |
OLD | NEW |