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

Unified Diff: packages/async/lib/src/future_group.dart

Issue 2989763002: Update charted to 0.4.8 and roll (Closed)
Patch Set: Removed Cutch from list of reviewers Created 3 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « packages/async/lib/src/delegate/stream_subscription.dart ('k') | packages/async/lib/src/lazy_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: packages/async/lib/src/future_group.dart
diff --git a/packages/async/lib/src/future_group.dart b/packages/async/lib/src/future_group.dart
index 02ff185ca74adc9261ec5cb58cd69249ae336206..0bf3158f63d46d7b910f7061e194900f39505502 100644
--- a/packages/async/lib/src/future_group.dart
+++ b/packages/async/lib/src/future_group.dart
@@ -2,8 +2,6 @@
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
-library async.future_group;
-
import 'dart:async';
/// A collection of futures waits until all added [Future]s complete.
@@ -35,7 +33,7 @@ class FutureGroup<T> implements Sink<Future<T>> {
Future<List<T>> get future => _completer.future;
final _completer = new Completer<List<T>>();
- /// Whether this group is waiting on any futures.
+ /// Whether this group has no pending futures.
bool get isIdle => _pending == 0;
/// A broadcast stream that emits a `null` event whenever the last pending
@@ -49,6 +47,7 @@ class FutureGroup<T> implements Sink<Future<T>> {
}
return _onIdleController.stream;
}
+
StreamController _onIdleController;
/// The values emitted by the futures that have been added to the group, in
@@ -69,19 +68,19 @@ class FutureGroup<T> implements Sink<Future<T>> {
_pending++;
task.then((value) {
- if (_completer.isCompleted) return;
+ if (_completer.isCompleted) return null;
_pending--;
_values[index] = value;
- if (_pending != 0) return;
+ if (_pending != 0) return null;
if (_onIdleController != null) _onIdleController.add(null);
- if (!_closed) return;
+ if (!_closed) return null;
if (_onIdleController != null) _onIdleController.close();
_completer.complete(_values);
}).catchError((error, stackTrace) {
- if (_completer.isCompleted) return;
+ if (_completer.isCompleted) return null;
_completer.completeError(error, stackTrace);
});
}
@@ -95,4 +94,3 @@ class FutureGroup<T> implements Sink<Future<T>> {
_completer.complete(_values);
}
}
-
« no previous file with comments | « packages/async/lib/src/delegate/stream_subscription.dart ('k') | packages/async/lib/src/lazy_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698