| 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 'package:async/async.dart'; | 9 import 'package:async/async.dart'; |
| 10 | 10 |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 190 _addPhase(phase); | 190 _addPhase(phase); |
| 191 phase.updateTransformers(transformers[i]); | 191 phase.updateTransformers(transformers[i]); |
| 192 } | 192 } |
| 193 | 193 |
| 194 for (var i = transformers.length + 1; i < _phases.length; i++) { | 194 for (var i = transformers.length + 1; i < _phases.length; i++) { |
| 195 _phases[i].remove(); | 195 _phases[i].remove(); |
| 196 } | 196 } |
| 197 _phases.removeRange(transformers.length + 1, _phases.length); | 197 _phases.removeRange(transformers.length + 1, _phases.length); |
| 198 | 198 |
| 199 _phaseStatusSubscription.cancel(); | 199 _phaseStatusSubscription.cancel(); |
| 200 _phaseStatusSubscription = _phases.last.onStatusChange | 200 _phaseStatusSubscription = |
| 201 .listen(_streams.changeStatus); | 201 _phases.last.onStatusChange.listen(_streams.changeStatus); |
| 202 | 202 |
| 203 _streams.onAssetPool.add(_phases.last.onAsset); | 203 _streams.onAssetPool.add(_phases.last.onAsset); |
| 204 } | 204 } |
| 205 | 205 |
| 206 /// Force all [LazyTransformer]s' transforms in this cascade to begin | 206 /// Force all [LazyTransformer]s' transforms in this cascade to begin |
| 207 /// producing concrete assets. | 207 /// producing concrete assets. |
| 208 void forceAllTransforms() { | 208 void forceAllTransforms() { |
| 209 for (var phase in _phases) { | 209 for (var phase in _phases) { |
| 210 phase.forceAllTransforms(); | 210 phase.forceAllTransforms(); |
| 211 } | 211 } |
| 212 } | 212 } |
| 213 | 213 |
| 214 void reportError(BarbackException error) { | 214 void reportError(BarbackException error) { |
| 215 _errorsController.add(error); | 215 _errorsController.add(error); |
| 216 } | 216 } |
| 217 | 217 |
| 218 /// Add [phase] to the end of [_phases] and watch its streams. | 218 /// Add [phase] to the end of [_phases] and watch its streams. |
| 219 void _addPhase(Phase phase) { | 219 void _addPhase(Phase phase) { |
| 220 _streams.onLogPool.add(phase.onLog); | 220 _streams.onLogPool.add(phase.onLog); |
| 221 if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel(); | 221 if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel(); |
| 222 _phaseStatusSubscription = | 222 _phaseStatusSubscription = |
| 223 phase.onStatusChange.listen(_streams.changeStatus); | 223 phase.onStatusChange.listen(_streams.changeStatus); |
| 224 | 224 |
| 225 _phases.add(phase); | 225 _phases.add(phase); |
| 226 } | 226 } |
| 227 | 227 |
| 228 String toString() => "cascade for $package"; | 228 String toString() => "cascade for $package"; |
| 229 } | 229 } |
| OLD | NEW |