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.graph.asset_cascade; | 5 library barback.graph.asset_cascade; |
6 | 6 |
7 import 'dart:async'; | 7 import 'dart:async'; |
8 | 8 |
9 import '../asset/asset.dart'; | 9 import '../asset/asset.dart'; |
10 import '../asset/asset_id.dart'; | 10 import '../asset/asset_id.dart'; |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 // itself. | 75 // itself. |
76 return _phases.last.status; | 76 return _phases.last.status; |
77 } | 77 } |
78 | 78 |
79 /// The streams exposed by this cascade. | 79 /// The streams exposed by this cascade. |
80 final _streams = new NodeStreams(); | 80 final _streams = new NodeStreams(); |
81 Stream<LogEntry> get onLog => _streams.onLog; | 81 Stream<LogEntry> get onLog => _streams.onLog; |
82 Stream<NodeStatus> get onStatusChange => _streams.onStatusChange; | 82 Stream<NodeStatus> get onStatusChange => _streams.onStatusChange; |
83 | 83 |
84 /// Returns all currently-available output assets from this cascade. | 84 /// Returns all currently-available output assets from this cascade. |
85 AssetSet get availableOutputs => | 85 Future<AssetSet> get availableOutputs => new Future.value(new AssetSet.from( |
86 new AssetSet.from(_phases.last.availableOutputs.map((node) => node.asset)); | 86 _phases.last.availableOutputs.map((node) => node.asset))); |
87 | 87 |
88 /// Creates a new [AssetCascade]. | 88 /// Creates a new [AssetCascade]. |
89 /// | 89 /// |
90 /// It loads source assets within [package] using [provider]. | 90 /// It loads source assets within [package] using [provider]. |
91 AssetCascade(this.graph, this.package) { | 91 AssetCascade(this.graph, this.package) { |
92 _addPhase(new Phase(this, package)); | 92 _addPhase(new Phase(this, package)); |
93 } | 93 } |
94 | 94 |
95 /// Gets the asset identified by [id]. | 95 /// Gets the asset identified by [id]. |
96 /// | 96 /// |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 _streams.onLogPool.add(phase.onLog); | 214 _streams.onLogPool.add(phase.onLog); |
215 if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel(); | 215 if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel(); |
216 _phaseStatusSubscription = | 216 _phaseStatusSubscription = |
217 phase.onStatusChange.listen(_streams.changeStatus); | 217 phase.onStatusChange.listen(_streams.changeStatus); |
218 | 218 |
219 _phases.add(phase); | 219 _phases.add(phase); |
220 } | 220 } |
221 | 221 |
222 String toString() => "cascade for $package"; | 222 String toString() => "cascade for $package"; |
223 } | 223 } |
OLD | NEW |