OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 // TODO(nweiz): Get rid of this when https://codereview.chromium.org/1241723003/ | 5 // TODO(nweiz): Get rid of this when https://codereview.chromium.org/1241723003/ |
6 // lands. | 6 // lands. |
7 library test.util.forkable_stream; | |
8 | |
9 import 'dart:async'; | 7 import 'dart:async'; |
10 | 8 |
11 import 'package:async/async.dart' hide ForkableStream; | 9 import 'package:async/async.dart' hide ForkableStream; |
12 | 10 |
13 /// A single-subscription stream from which other streams may be forked off at | 11 /// A single-subscription stream from which other streams may be forked off at |
14 /// the current position. | 12 /// the current position. |
15 /// | 13 /// |
16 /// This adds an operation, [fork], which produces a new stream that | 14 /// This adds an operation, [fork], which produces a new stream that |
17 /// independently emits the same events as this stream. Unlike the branches | 15 /// independently emits the same events as this stream. Unlike the branches |
18 /// produced by [StreamSplitter], a fork only emits events that arrive *after* | 16 /// produced by [StreamSplitter], a fork only emits events that arrive *after* |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 | 157 |
160 // Don't iterate directly over the set because [controller.close] might | 158 // Don't iterate directly over the set because [controller.close] might |
161 // cause it to be modified synchronously. | 159 // cause it to be modified synchronously. |
162 for (var controller in _controllers.toList()) { | 160 for (var controller in _controllers.toList()) { |
163 controller.close(); | 161 controller.close(); |
164 } | 162 } |
165 _controllers.clear(); | 163 _controllers.clear(); |
166 } | 164 } |
167 } | 165 } |
168 | 166 |
OLD | NEW |