| 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.asset_cascade; | 5 library barback.asset_cascade; |
| 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 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 205 var controller = _sourceControllerMap.remove(id); | 205 var controller = _sourceControllerMap.remove(id); |
| 206 // Don't choke if an id is double-removed for some reason. | 206 // Don't choke if an id is double-removed for some reason. |
| 207 if (controller != null) controller.setRemoved(); | 207 if (controller != null) controller.setRemoved(); |
| 208 }); | 208 }); |
| 209 } | 209 } |
| 210 | 210 |
| 211 /// Sets this cascade's transformer phases to [transformers]. | 211 /// Sets this cascade's transformer phases to [transformers]. |
| 212 /// | 212 /// |
| 213 /// Elements of the inner iterable of [transformers] must be either | 213 /// Elements of the inner iterable of [transformers] must be either |
| 214 /// [Transformer]s or [TransformerGroup]s. | 214 /// [Transformer]s or [TransformerGroup]s. |
| 215 void updateTransformers(Iterable<Iterable> transformers) { | 215 void updateTransformers(Iterable<Iterable> transformersIterable) { |
| 216 transformers = transformers.toList(); | 216 var transformers = transformersIterable.toList(); |
| 217 | 217 |
| 218 for (var i = 0; i < transformers.length; i++) { | 218 for (var i = 0; i < transformers.length; i++) { |
| 219 if (_phases.length > i) { | 219 if (_phases.length > i) { |
| 220 _phases[i].updateTransformers(transformers[i]); | 220 _phases[i].updateTransformers(transformers[i]); |
| 221 continue; | 221 continue; |
| 222 } | 222 } |
| 223 | 223 |
| 224 _addPhase(_phases.last.addPhase(transformers[i])); | 224 _addPhase(_phases.last.addPhase(transformers[i])); |
| 225 } | 225 } |
| 226 | 226 |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 future = phase.process(); | 293 future = phase.process(); |
| 294 if (future != null) break; | 294 if (future != null) break; |
| 295 } | 295 } |
| 296 | 296 |
| 297 // If all phases are done and no new updates have come in, we're done. | 297 // If all phases are done and no new updates have come in, we're done. |
| 298 if (future == null) { | 298 if (future == null) { |
| 299 // If changes have come in, start over. | 299 // If changes have come in, start over. |
| 300 if (_newChanges) return _process(); | 300 if (_newChanges) return _process(); |
| 301 | 301 |
| 302 // Otherwise, everything is done. | 302 // Otherwise, everything is done. |
| 303 return; | 303 return null; |
| 304 } | 304 } |
| 305 | 305 |
| 306 // Process that phase and then loop onto the next. | 306 // Process that phase and then loop onto the next. |
| 307 return future.then((_) => _process()); | 307 return future.then((_) => _process()); |
| 308 }); | 308 }); |
| 309 } | 309 } |
| 310 } | 310 } |
| OLD | NEW |