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

Unified Diff: pkg/barback/lib/src/phase.dart

Issue 26273003: Pool future creation to ensure no more than 10 ops are in flight (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: using in polymer Created 7 years, 2 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 | « no previous file | pkg/barback/lib/src/phase_input.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/phase.dart
diff --git a/pkg/barback/lib/src/phase.dart b/pkg/barback/lib/src/phase.dart
index b83061bb96a1a200fd730319aef32d4c70375978..14d236a9b784264a795bd504e75c62680e335908 100644
--- a/pkg/barback/lib/src/phase.dart
+++ b/pkg/barback/lib/src/phase.dart
@@ -273,19 +273,15 @@ class Phase {
}
}
- var outputFutures = [];
- outputFutures.addAll(_inputs.values.map((input) {
- if (!input.isDirty) return new Future.value(new Set());
- return input.process().then(_handleOutputs);
- }));
- outputFutures.addAll(_groups.values.map((input) {
- if (!input.isDirty) return new Future.value(new Set());
- return input.process().then(_handleOutputs);
- }));
+ var outputs = new List.from(_inputs.values);
+ outputs.addAll(_groups.values);
// TODO(nweiz): handle pass-through.
- return Future.wait(outputFutures).then((_) {
+ return forEachPooledFuture(outputs, (input) {
+ if (!input.isDirty) return null;
+ return input.process().then(_handleOutputs);
+ }).then((_) {
// Report collisions in a deterministic order.
outputIds = outputIds.toList();
outputIds.sort((a, b) => a.compareTo(b));
« no previous file with comments | « no previous file | pkg/barback/lib/src/phase_input.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698