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

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

Issue 233843002: Don't make lazy transformers eager when an asset is requested. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review + disabling test 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
« no previous file with comments | « no previous file | 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/asset_node.dart
diff --git a/pkg/barback/lib/src/asset_node.dart b/pkg/barback/lib/src/asset_node.dart
index 36a3a669801a37d58068088136fb571ad3abe5e1..16aff4064f4aabd006e910c6d5718128f1346f71 100644
--- a/pkg/barback/lib/src/asset_node.dart
+++ b/pkg/barback/lib/src/asset_node.dart
@@ -58,9 +58,10 @@ class AssetNode {
/// lazy.
Function _lazyCallback;
- /// Whether this is lazy and needs [force] to be called before it will be
- /// marked available.
- bool get isLazy => _lazyCallback != null;
+ /// Whether this asset's transform is deferred.
+ ///
+ /// See [TransformNode.deferred].
+ bool get deferred => transform != null && transform.deferred;
/// A broadcast stream that emits an event whenever the node changes state.
///
@@ -195,9 +196,14 @@ class AssetNodeController {
/// Marks the node as [AssetState.DIRTY].
void setDirty() {
assert(node._state != AssetState.REMOVED);
- node._state = AssetState.DIRTY;
node._asset = null;
node._lazyCallback = null;
+
+ // Don't re-emit a dirty event to avoid cases where we try to dispatch an
+ // event while handling another event (e.g. an output is marked lazy, which
+ // causes it to be forced, which causes it to be marked dirty).
+ if (node._state.isDirty) return;
+ node._state = AssetState.DIRTY;
node._stateChangeController.add(AssetState.DIRTY);
}
« no previous file with comments | « no previous file | pkg/barback/lib/src/transform_node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698