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

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

Issue 1205143002: Use a List rather than a Queue in StreamSplitter. (Closed) Base URL: git@github.com:dart-lang/async.git@master
Patch Set: Created 5 years, 6 months 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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'; 8 import 'dart:collection';
9 9
10 import '../result.dart'; 10 import '../result.dart';
(...skipping 17 matching lines...) Expand all
28 /// The wrapped stream. 28 /// The wrapped stream.
29 final Stream<T> _stream; 29 final Stream<T> _stream;
30 30
31 /// The subscription to [_stream]. 31 /// The subscription to [_stream].
32 /// 32 ///
33 /// This will be `null` until a branch has a listener. 33 /// This will be `null` until a branch has a listener.
34 StreamSubscription<T> _subscription; 34 StreamSubscription<T> _subscription;
35 35
36 /// The buffer of events or errors that have already been emitted by 36 /// The buffer of events or errors that have already been emitted by
37 /// [_stream]. 37 /// [_stream].
38 final _buffer = new Queue<Result<T>>(); 38 final _buffer = new List<Result<T>>();
39 39
40 /// The controllers for branches that are listening for future events from 40 /// The controllers for branches that are listening for future events from
41 /// [_stream]. 41 /// [_stream].
42 /// 42 ///
43 /// Once a branch is canceled, it's removed from this list. When [_stream] is 43 /// Once a branch is canceled, it's removed from this list. When [_stream] is
44 /// done, all branches are removed. 44 /// done, all branches are removed.
45 final _controllers = new Set<StreamController<T>>(); 45 final _controllers = new Set<StreamController<T>>();
46 46
47 /// A group of futures returned by [close]. 47 /// A group of futures returned by [close].
48 /// 48 ///
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 } 204 }
205 205
206 /// Marks [_controllers] as done. 206 /// Marks [_controllers] as done.
207 void _onDone() { 207 void _onDone() {
208 _isDone = true; 208 _isDone = true;
209 for (var controller in _controllers) { 209 for (var controller in _controllers) {
210 _closeGroup.add(controller.close()); 210 _closeGroup.add(controller.close());
211 } 211 }
212 } 212 }
213 } 213 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698