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

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

Issue 19473002: Fix a barback bug that triggered when an asset was removed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « no previous file | pkg/barback/lib/src/transform_node.dart » ('j') | pkg/barback/lib/src/transform_node.dart » ('J')
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 b4efbc7fa44bb3b6950f118848e9056edcb0fd4b..e16f94b7a8e9e3aa7a4a175a7ae0be3ff81484d6 100644
--- a/pkg/barback/lib/src/phase.dart
+++ b/pkg/barback/lib/src/phase.dart
@@ -141,11 +141,21 @@ class Phase {
///
/// Passes their outputs to the next phase.
Future _processTransforms() {
- var dirtyTransforms = _transforms.where((transform) => transform.isDirty);
+ // Convert this to a list so we can safely modify _transforms while
+ // iterating over it.
+ var dirtyTransforms = _transforms.where((transform) => transform.isDirty)
+ .toList();
if (dirtyTransforms.isEmpty) return null;
- return Future.wait(dirtyTransforms.map((transform) => transform.apply()))
- .then((transformOutputs) {
+ return Future.wait(dirtyTransforms.map((transform) {
+ if (inputs.containsKey(transform.primary.id)) return transform.apply();
+
+ // If the primary input for the transform has been removed, get rid of it
+ // and all its outputs.
+ _transforms.remove(transform);
+ return new Future.value(
+ new TransformOutputs(new AssetSet(), transform.outputs));
Bob Nystrom 2013/07/17 17:18:26 Smart way to handle this. :)
+ })).then((transformOutputs) {
// Collect all of the outputs. Since the transforms are run in parallel,
// we have to be careful here to ensure that the result is deterministic
// and not influenced by the order that transforms complete.
« no previous file with comments | « no previous file | pkg/barback/lib/src/transform_node.dart » ('j') | pkg/barback/lib/src/transform_node.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698