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

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

Issue 16854005: First pass at build dependency graph for barback. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle unprovided sources and errors a bit better. Created 7 years, 6 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/asset_id.dart ('k') | pkg/barback/lib/src/asset_provider.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
new file mode 100644
index 0000000000000000000000000000000000000000..6fd86c622d7fab8058c23f134104e2f02690c719
--- /dev/null
+++ b/pkg/barback/lib/src/asset_node.dart
@@ -0,0 +1,34 @@
+// Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+library barback.asset_node;
+
+import 'dart:async';
+
+import 'asset.dart';
+import 'asset_graph.dart';
+import 'asset_id.dart';
+import 'phase.dart';
+import 'transform_node.dart';
+
+/// Describes an asset and its relationship to the build dependency graph.
+///
+/// Keeps a cache of the last asset that was built for this node (i.e. for this
+/// node's ID and phase) and tracks which transforms depend on it.
+class AssetNode {
+ final AssetId id;
+ Asset asset;
+
+ /// The [TransformNode]s that consume this node's asset as an input.
+ final consumers = new Set<TransformNode>();
+
+ AssetNode(this.id);
+
+ /// Updates this node's generated asset value and marks all transforms that
+ /// use this as dirty.
+ void updateAsset(Asset asset) {
+ this.asset = asset;
+ consumers.forEach((consumer) => consumer.dirty());
+ }
+}
« no previous file with comments | « pkg/barback/lib/src/asset_id.dart ('k') | pkg/barback/lib/src/asset_provider.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698