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 library async.stream_splitter; | 5 library async.stream_splitter; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 import 'dart:collection'; | |
9 | 8 |
10 import '../result.dart'; | 9 import '../result.dart'; |
11 import 'future_group.dart'; | 10 import 'future_group.dart'; |
12 | 11 |
13 /// A class that splits a single source stream into an arbitrary number of | 12 /// A class that splits a single source stream into an arbitrary number of |
14 /// (single-subscription) streams (called "branch") that emit the same events. | 13 /// (single-subscription) streams (called "branch") that emit the same events. |
15 /// | 14 /// |
16 /// Each branch will emit all the same values and errors as the source stream, | 15 /// Each branch will emit all the same values and errors as the source stream, |
17 /// regardless of which values have been emitted on other branches. This means | 16 /// regardless of which values have been emitted on other branches. This means |
18 /// that the splitter stores every event that has been emitted so far, which may | 17 /// that the splitter stores every event that has been emitted so far, which may |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 } | 203 } |
205 | 204 |
206 /// Marks [_controllers] as done. | 205 /// Marks [_controllers] as done. |
207 void _onDone() { | 206 void _onDone() { |
208 _isDone = true; | 207 _isDone = true; |
209 for (var controller in _controllers) { | 208 for (var controller in _controllers) { |
210 _closeGroup.add(controller.close()); | 209 _closeGroup.add(controller.close()); |
211 } | 210 } |
212 } | 211 } |
213 } | 212 } |
OLD | NEW |