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

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

Issue 21275003: Move barback to a more event-based model. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes. 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 | « pkg/barback/lib/src/phase.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/transform.dart
diff --git a/pkg/barback/lib/src/transform.dart b/pkg/barback/lib/src/transform.dart
index cb5175305c7a05339079dbecc1f4aba2db92c8d9..3eb3a29ba16a9b03a7309b2d0aa1f557eb0bb6d2 100644
--- a/pkg/barback/lib/src/transform.dart
+++ b/pkg/barback/lib/src/transform.dart
@@ -67,9 +67,17 @@ class Transform {
// results stream.
if (node == null) throw new MissingInputException(id);
- // Keep track of which assets this transform depends on.
- _inputs.add(node);
- return node.asset;
+ // If the asset node is found, wait until its contents are actually
+ // available before we return them.
+ return node.whenAvailable.then((asset) {
+ _inputs.add(node);
+ return asset;
+ }).catchError((error) {
+ if (error is! AssetNotFoundException || error.id != id) throw error;
+ // If the node was removed before it could be loaded, treat it as though
+ // it never existed and throw a MissingInputException.
+ throw new MissingInputException(id);
+ });
});
}
« no previous file with comments | « pkg/barback/lib/src/phase.dart ('k') | pkg/barback/lib/src/transform_node.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698