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