| 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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 if (_loadingSources.containsKey(id)) _loadingSources.remove(id).cancel(); | 160 if (_loadingSources.containsKey(id)) _loadingSources.remove(id).cancel(); |
| 161 | 161 |
| 162 var controller = _sourceControllerMap.remove(id); | 162 var controller = _sourceControllerMap.remove(id); |
| 163 // Don't choke if an id is double-removed for some reason. | 163 // Don't choke if an id is double-removed for some reason. |
| 164 if (controller != null) controller.setRemoved(); | 164 if (controller != null) controller.setRemoved(); |
| 165 }); | 165 }); |
| 166 } | 166 } |
| 167 | 167 |
| 168 /// Sets this cascade's transformer phases to [transformers]. | 168 /// Sets this cascade's transformer phases to [transformers]. |
| 169 /// | 169 /// |
| 170 /// Elements of the inner iterable of [transformers] must be either | 170 /// Elements of the inner iterable of [transformers] must be [Transformer]s, |
| 171 /// [Transformer]s or [TransformerGroup]s. | 171 /// [TransformerGroup]s, or [AggregateTransformer]s. |
| 172 void updateTransformers(Iterable<Iterable> transformersIterable) { | 172 void updateTransformers(Iterable<Iterable> transformersIterable) { |
| 173 var transformers = transformersIterable.toList(); | 173 var transformers = transformersIterable.toList(); |
| 174 | 174 |
| 175 // Always preserve a single phase with no transformers at the beginning of | 175 // Always preserve a single phase with no transformers at the beginning of |
| 176 // the cascade so that [TransformNode]s in the first populated phase will | 176 // the cascade so that [TransformNode]s in the first populated phase will |
| 177 // have something to request assets from. | 177 // have something to request assets from. |
| 178 for (var i = 0; i < transformers.length; i++) { | 178 for (var i = 0; i < transformers.length; i++) { |
| 179 if (_phases.length > i + 1) { | 179 if (_phases.length > i + 1) { |
| 180 _phases[i + 1].updateTransformers(transformers[i]); | 180 _phases[i + 1].updateTransformers(transformers[i]); |
| 181 continue; | 181 continue; |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 213 _streams.onLogPool.add(phase.onLog); | 213 _streams.onLogPool.add(phase.onLog); |
| 214 if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel(); | 214 if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel(); |
| 215 _phaseStatusSubscription = | 215 _phaseStatusSubscription = |
| 216 phase.onStatusChange.listen(_streams.changeStatus); | 216 phase.onStatusChange.listen(_streams.changeStatus); |
| 217 | 217 |
| 218 _phases.add(phase); | 218 _phases.add(phase); |
| 219 } | 219 } |
| 220 | 220 |
| 221 String toString() => "cascade for $package"; | 221 String toString() => "cascade for $package"; |
| 222 } | 222 } |
| OLD | NEW |