Chromium Code Reviews| 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..06b2952a90040cba2f058d2f208617019a1f01f9 |
| --- /dev/null |
| +++ b/pkg/barback/lib/src/asset_node.dart |
| @@ -0,0 +1,32 @@ |
| +// 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 '../barback.dart'; |
| +import 'asset_graph.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 built asset and tracks which transforms depend |
|
nweiz
2013/06/18 23:14:46
I don't understand what "last built asset" means.
Bob Nystrom
2013/06/20 00:23:59
Clarified.
|
| +/// on it. |
| +class AssetNode { |
| + final AssetId id; |
| + Asset asset; |
| + |
| + /// The [_TransformNode]s that consume this node's asset as an input. |
|
nweiz
2013/06/18 23:14:46
Remove "_"
Bob Nystrom
2013/06/20 00:23:59
Done.
|
| + 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.isDirty = true); |
| + } |
| +} |