| Index: third_party/pkg/barback-0.13.0/lib/src/asset_node.dart
|
| diff --git a/pkg/barback/lib/src/asset/asset_node.dart b/third_party/pkg/barback-0.13.0/lib/src/asset_node.dart
|
| similarity index 88%
|
| copy from pkg/barback/lib/src/asset/asset_node.dart
|
| copy to third_party/pkg/barback-0.13.0/lib/src/asset_node.dart
|
| index 45d1b1771c215f165a2e3c001afb4a7ee5715e00..5e794431a6d283f9f74cad9db38edf3e2b0fa174 100644
|
| --- a/pkg/barback/lib/src/asset/asset_node.dart
|
| +++ b/third_party/pkg/barback-0.13.0/lib/src/asset_node.dart
|
| @@ -2,15 +2,15 @@
|
| // 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.asset_node;
|
| +library barback.asset_node;
|
|
|
| import 'dart:async';
|
|
|
| -import '../errors.dart';
|
| -import '../graph/transform_node.dart';
|
| -import '../utils.dart';
|
| import 'asset.dart';
|
| import 'asset_id.dart';
|
| +import 'errors.dart';
|
| +import 'transform_node.dart';
|
| +import 'utils.dart';
|
|
|
| /// Describes the current state of an asset as part of a transformation graph.
|
| ///
|
| @@ -58,11 +58,6 @@ class AssetNode {
|
| /// lazy.
|
| Function _lazyCallback;
|
|
|
| - /// Whether this node is lazy, meaning that [force] must be called to
|
| - /// guarantee that it will eventually become available.
|
| - bool get isLazy => _lazyCallback != null ||
|
| - (_origin != null && _origin.isLazy);
|
| -
|
| /// A broadcast stream that emits an event whenever the node changes state.
|
| ///
|
| /// This stream is synchronous to ensure that when a source asset is modified
|
| @@ -122,7 +117,7 @@ class AssetNode {
|
| }
|
|
|
| AssetNode._(this.id, this._transform, this._origin)
|
| - : _state = AssetState.RUNNING;
|
| + : _state = AssetState.DIRTY;
|
|
|
| AssetNode._available(Asset asset, this._transform, this._origin)
|
| : id = asset.id,
|
| @@ -130,7 +125,7 @@ class AssetNode {
|
| _state = AssetState.AVAILABLE;
|
|
|
| AssetNode._lazy(this.id, this._transform, this._origin, this._lazyCallback)
|
| - : _state = AssetState.RUNNING;
|
| + : _state = AssetState.DIRTY;
|
|
|
| /// If [this] is lazy, force it to generate a concrete asset; otherwise, do
|
| /// nothing.
|
| @@ -145,7 +140,8 @@ class AssetNode {
|
| }
|
| }
|
|
|
| - String toString() => "${isLazy ? 'lazy' : state} asset $id";
|
| + String toString() =>
|
| + "$state${_lazyCallback == null ? '' : ' lazy'} asset $id";
|
| }
|
|
|
| /// The controller for an [AssetNode].
|
| @@ -192,18 +188,13 @@ class AssetNodeController {
|
| }
|
| }
|
|
|
| - /// Marks the node as [AssetState.RUNNING].
|
| + /// 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.RUNNING;
|
| - node._stateChangeController.add(AssetState.RUNNING);
|
| + node._stateChangeController.add(AssetState.DIRTY);
|
| }
|
|
|
| /// Marks the node as [AssetState.REMOVED].
|
| @@ -232,7 +223,7 @@ class AssetNodeController {
|
| node._stateChangeController.add(AssetState.AVAILABLE);
|
| }
|
|
|
| - /// Marks the node as [AssetState.RUNNING] and lazy.
|
| + /// Marks the node as [AssetState.DIRTY] and lazy.
|
| ///
|
| /// Lazy nodes aren't expected to have their values generated until needed.
|
| /// Once it's necessary, [callback] will be called. [callback] is guaranteed
|
| @@ -241,10 +232,10 @@ class AssetNodeController {
|
| /// See also [AssetNodeController.lazy].
|
| void setLazy(void callback()) {
|
| assert(node._state != AssetState.REMOVED);
|
| - node._state = AssetState.RUNNING;
|
| + node._state = AssetState.DIRTY;
|
| node._asset = null;
|
| node._lazyCallback = callback;
|
| - node._stateChangeController.add(AssetState.RUNNING);
|
| + node._stateChangeController.add(AssetState.DIRTY);
|
| }
|
|
|
| String toString() => "controller for $node";
|
| @@ -255,7 +246,7 @@ class AssetNodeController {
|
| class AssetState {
|
| /// The node has a concrete asset loaded, available, and up-to-date. The asset
|
| /// is accessible via [AssetNode.asset]. An asset can only be marked available
|
| - /// again from the [AssetState.RUNNING] state.
|
| + /// again from the [AssetState.DIRTY] state.
|
| static final AVAILABLE = const AssetState._("available");
|
|
|
| /// The asset is no longer available, possibly for good. A removed asset will
|
| @@ -264,7 +255,7 @@ class AssetState {
|
|
|
| /// The asset will exist in the future (unless it's removed), but the concrete
|
| /// asset is not yet available.
|
| - static final RUNNING = const AssetState._("dirty");
|
| + static final DIRTY = const AssetState._("dirty");
|
|
|
| /// Whether this state is [AssetState.AVAILABLE].
|
| bool get isAvailable => this == AssetState.AVAILABLE;
|
| @@ -272,8 +263,8 @@ class AssetState {
|
| /// Whether this state is [AssetState.REMOVED].
|
| bool get isRemoved => this == AssetState.REMOVED;
|
|
|
| - /// Whether this state is [AssetState.RUNNING].
|
| - bool get isDirty => this == AssetState.RUNNING;
|
| + /// Whether this state is [AssetState.DIRTY].
|
| + bool get isDirty => this == AssetState.DIRTY;
|
|
|
| final String name;
|
|
|
|
|