| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 library barback.asset_node; | 5 library barback.asset_node; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 Asset _asset; | 51 Asset _asset; |
| 52 | 52 |
| 53 /// The callback to be called to notify this asset node's creator that the | 53 /// The callback to be called to notify this asset node's creator that the |
| 54 /// concrete asset should be generated. | 54 /// concrete asset should be generated. |
| 55 /// | 55 /// |
| 56 /// This is null for non-lazy asset nodes (see [AssetNodeController.lazy]). | 56 /// This is null for non-lazy asset nodes (see [AssetNodeController.lazy]). |
| 57 /// Once this is called, it's set to null and [this] is no longer considered | 57 /// Once this is called, it's set to null and [this] is no longer considered |
| 58 /// lazy. | 58 /// lazy. |
| 59 Function _lazyCallback; | 59 Function _lazyCallback; |
| 60 | 60 |
| 61 /// Whether this is lazy and needs [force] to be called before it will be | |
| 62 /// marked available. | |
| 63 bool get isLazy => _lazyCallback != null; | |
| 64 | |
| 65 /// A broadcast stream that emits an event whenever the node changes state. | 61 /// A broadcast stream that emits an event whenever the node changes state. |
| 66 /// | 62 /// |
| 67 /// This stream is synchronous to ensure that when a source asset is modified | 63 /// This stream is synchronous to ensure that when a source asset is modified |
| 68 /// or removed, the appropriate portion of the asset graph is dirtied before | 64 /// or removed, the appropriate portion of the asset graph is dirtied before |
| 69 /// any [Barback.getAssetById] calls emit newly-incorrect values. | 65 /// any [Barback.getAssetById] calls emit newly-incorrect values. |
| 70 Stream<AssetState> get onStateChange => _stateChangeController.stream; | 66 Stream<AssetState> get onStateChange => _stateChangeController.stream; |
| 71 | 67 |
| 72 /// This is synchronous so that a source being updated will always be | 68 /// This is synchronous so that a source being updated will always be |
| 73 /// propagated through the build graph before anything that depends on it is | 69 /// propagated through the build graph before anything that depends on it is |
| 74 /// requested. | 70 /// requested. |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 269 | 265 |
| 270 /// Whether this state is [AssetState.DIRTY]. | 266 /// Whether this state is [AssetState.DIRTY]. |
| 271 bool get isDirty => this == AssetState.DIRTY; | 267 bool get isDirty => this == AssetState.DIRTY; |
| 272 | 268 |
| 273 final String name; | 269 final String name; |
| 274 | 270 |
| 275 const AssetState._(this.name); | 271 const AssetState._(this.name); |
| 276 | 272 |
| 277 String toString() => name; | 273 String toString() => name; |
| 278 } | 274 } |
| OLD | NEW |