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

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

Issue 191223004: Add BaseTransform.consumePrimary to barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 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 | « pkg/barback/lib/src/base_transform.dart ('k') | pkg/barback/lib/src/transform_node.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/phase_input.dart
diff --git a/pkg/barback/lib/src/phase_input.dart b/pkg/barback/lib/src/phase_input.dart
index 5949a84ef6faadb1f830d95da61ab43458100ce3..24d2e2424ddbd4b2929466f12165869df0bee688 100644
--- a/pkg/barback/lib/src/phase_input.dart
+++ b/pkg/barback/lib/src/phase_input.dart
@@ -260,7 +260,12 @@ class PhaseInput {
}
_onAssetController.add(asset);
- }, onDone: () => _transforms.remove(transform));
+ }, onDone: () {
+ _transforms.remove(transform);
+ // When a transform is removed, we need to re-adjust the pass-through
+ // in case its call to `consumePrimary` was preventing pass-through
+ _adjustPassThrough();
+ });
_onLogPool.add(transform.onLog);
});
@@ -278,10 +283,12 @@ class PhaseInput {
if (!input.state.isAvailable) return;
// If there's an output with the same id as the primary input, that
- // overwrites the input so it doesn't get passed through. Otherwise,
- // create a pass-through controller if none exists, or set the existing
- // one available.
- if (_overwritingOutputs.isNotEmpty) {
+ // overwrites the input so it doesn't get passed through. A transformer
+ // explicitly consuming the input will also cause it not to get passed
+ // through. Otherwise, create a pass-through controller if none exists, or
+ // set the existing one available.
+ if (_overwritingOutputs.isNotEmpty ||
+ _transforms.any((transform) => transform.consumePrimary)) {
if (_passThroughController != null) {
_passThroughController.setRemoved();
_passThroughController = null;
« no previous file with comments | « pkg/barback/lib/src/base_transform.dart ('k') | pkg/barback/lib/src/transform_node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698