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

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

Issue 231603005: Preserve laziness in declaring transformers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 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
Index: pkg/barback/lib/src/transform_node.dart
diff --git a/pkg/barback/lib/src/transform_node.dart b/pkg/barback/lib/src/transform_node.dart
index ecd8d8f677f6b481fc6ca1b586bab96a51542974..ee56ffd46600f56c02c18edbe71a89cc770e5ab4 100644
--- a/pkg/barback/lib/src/transform_node.dart
+++ b/pkg/barback/lib/src/transform_node.dart
@@ -114,12 +114,16 @@ class TransformNode {
/// [declareOutputs] has been run successfully.
Set<AssetId> _declaredOutputs;
- TransformNode(this.phase, Transformer transformer, this.primary,
+ TransformNode(this.phase, Transformer transformer, AssetNode primary,
this._location)
: transformer = transformer,
- _isLazy = transformer is LazyTransformer {
+ primary = primary,
+ _isLazy = transformer is LazyTransformer ||
+ (transformer is DeclaringTransformer && primary.isLazy) {
Bob Nystrom 2014/04/10 20:45:34 Laziness propagates downwards from previous lazy t
nweiz 2014/04/10 20:54:53 Done.
_onLogPool.add(_onLogController.stream);
+ if (!_isLazy) primary.force();
+
_primarySubscription = primary.onStateChange.listen((state) {
if (state.isRemoved) {
remove();
@@ -167,6 +171,7 @@ class TransformNode {
// TODO(nweiz): we might want to have a timeout after which, if the
// transform's outputs have gone unused, we switch it back to lazy mode.
if (!_isLazy) return;
+ primary.force();
_isLazy = false;
_dirty();
}
@@ -253,7 +258,7 @@ class TransformNode {
if (!_declaredOutputs.contains(primary.id)) _emitPassThrough();
for (var id in _declaredOutputs) {
- var controller = transformer is LazyTransformer
+ var controller = _isLazy
? new AssetNodeController.lazy(id, force, this)
: new AssetNodeController(id, this);
_outputControllers[id] = controller;

Powered by Google App Engine
This is Rietveld 408576698