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

Side by Side Diff: lib/src/stream_splitter.dart

Issue 1491923005: Add a LazyStream class. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Code review changes Created 5 years 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
OLDNEW
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698