| 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_input; | 5 library barback.phase_input; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'asset.dart'; | 10 import 'asset.dart'; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 _passThroughController == null) { | 129 _passThroughController == null) { |
| 130 _passThroughController = | 130 _passThroughController = |
| 131 new AssetNodeController.available(input.asset, input.transform); | 131 new AssetNodeController.available(input.asset, input.transform); |
| 132 _newPassThrough = true; | 132 _newPassThrough = true; |
| 133 } | 133 } |
| 134 | 134 |
| 135 var brandNewTransformers = newTransformers.difference(oldTransformers); | 135 var brandNewTransformers = newTransformers.difference(oldTransformers); |
| 136 if (brandNewTransformers.isEmpty) return; | 136 if (brandNewTransformers.isEmpty) return; |
| 137 | 137 |
| 138 brandNewTransformers.forEach(_transformers.add); | 138 brandNewTransformers.forEach(_transformers.add); |
| 139 _adjustTransformers(); | 139 if (_adjustTransformersFuture == null) _adjustTransformers(); |
| 140 } | 140 } |
| 141 | 141 |
| 142 /// Asynchronously determines which transformers can consume [input] as a | 142 /// Asynchronously determines which transformers can consume [input] as a |
| 143 /// primary input and creates transforms for them. | 143 /// primary input and creates transforms for them. |
| 144 /// | 144 /// |
| 145 /// This ensures that if [input] is modified or removed during or after the | 145 /// This ensures that if [input] is modified or removed during or after the |
| 146 /// time it takes to adjust its transformers, they're appropriately | 146 /// time it takes to adjust its transformers, they're appropriately |
| 147 /// re-adjusted. Its progress can be tracked in [_adjustTransformersFuture]. | 147 /// re-adjusted. Its progress can be tracked in [_adjustTransformersFuture]. |
| 148 void _adjustTransformers() { | 148 void _adjustTransformers() { |
| 149 // Mark the input as dirty. This may not actually end up creating any new | 149 // Mark the input as dirty. This may not actually end up creating any new |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 return new Future.value( | 288 return new Future.value( |
| 289 new Set<AssetNode>.from([_passThroughController.node])); | 289 new Set<AssetNode>.from([_passThroughController.node])); |
| 290 } | 290 } |
| 291 | 291 |
| 292 return Future.wait(_transforms.map((transform) { | 292 return Future.wait(_transforms.map((transform) { |
| 293 if (!transform.isDirty) return new Future.value(new Set()); | 293 if (!transform.isDirty) return new Future.value(new Set()); |
| 294 return transform.apply(); | 294 return transform.apply(); |
| 295 })).then((outputs) => unionAll(outputs)); | 295 })).then((outputs) => unionAll(outputs)); |
| 296 } | 296 } |
| 297 } | 297 } |
| OLD | NEW |