| 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.phase; | 5 library barback.phase; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset_cascade.dart'; | 9 import 'asset_cascade.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 /// will automatically begin determining which transforms can consume it as a | 163 /// will automatically begin determining which transforms can consume it as a |
| 164 /// primary input. The transforms themselves won't be applied until [process] | 164 /// primary input. The transforms themselves won't be applied until [process] |
| 165 /// is called, however. | 165 /// is called, however. |
| 166 /// | 166 /// |
| 167 /// This should only be used for brand-new assets or assets that have been | 167 /// This should only be used for brand-new assets or assets that have been |
| 168 /// removed and re-created. The phase will automatically handle updated assets | 168 /// removed and re-created. The phase will automatically handle updated assets |
| 169 /// using the [AssetNode.onStateChange] stream. | 169 /// using the [AssetNode.onStateChange] stream. |
| 170 void addInput(AssetNode node) { | 170 void addInput(AssetNode node) { |
| 171 if (_inputs.containsKey(node.id)) _inputs[node.id].remove(); | 171 if (_inputs.containsKey(node.id)) _inputs[node.id].remove(); |
| 172 | 172 |
| 173 node.force(); | |
| 174 | |
| 175 // Each group is one channel along which an asset may be forwarded, as is | 173 // Each group is one channel along which an asset may be forwarded, as is |
| 176 // each transformer. | 174 // each transformer. |
| 177 var forwarder = new PhaseForwarder( | 175 var forwarder = new PhaseForwarder( |
| 178 node, _transformers.length, _groups.length); | 176 node, _transformers.length, _groups.length); |
| 179 _forwarders[node.id] = forwarder; | 177 _forwarders[node.id] = forwarder; |
| 180 forwarder.onAsset.listen(_handleOutputWithoutForwarder); | 178 forwarder.onAsset.listen(_handleOutputWithoutForwarder); |
| 181 if (forwarder.output != null) { | 179 if (forwarder.output != null) { |
| 182 _handleOutputWithoutForwarder(forwarder.output); | 180 _handleOutputWithoutForwarder(forwarder.output); |
| 183 } | 181 } |
| 184 | 182 |
| (...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 assert(asset.state.isDirty); | 376 assert(asset.state.isDirty); |
| 379 asset.force(); | 377 asset.force(); |
| 380 asset.whenStateChanges().then((state) { | 378 asset.whenStateChanges().then((state) { |
| 381 if (state.isRemoved) return getOutput(asset.id); | 379 if (state.isRemoved) return getOutput(asset.id); |
| 382 return asset; | 380 return asset; |
| 383 }).then(request.complete).catchError(request.completeError); | 381 }).then(request.complete).catchError(request.completeError); |
| 384 } | 382 } |
| 385 | 383 |
| 386 String toString() => "phase $_location.$_index"; | 384 String toString() => "phase $_location.$_index"; |
| 387 } | 385 } |
| OLD | NEW |