Chromium Code Reviews| 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; | 5 library barback.phase; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'asset_cascade.dart'; | 10 import 'asset_cascade.dart'; |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 input.updateTransformers(_transformers); | 132 input.updateTransformers(_transformers); |
| 133 } | 133 } |
| 134 } | 134 } |
| 135 | 135 |
| 136 /// Add a new phase after this one with [transformers]. | 136 /// Add a new phase after this one with [transformers]. |
| 137 /// | 137 /// |
| 138 /// This may only be called on a phase with no phase following it. | 138 /// This may only be called on a phase with no phase following it. |
| 139 Phase addPhase(Iterable<Transformer> transformers) { | 139 Phase addPhase(Iterable<Transformer> transformers) { |
| 140 assert(_next == null); | 140 assert(_next == null); |
| 141 _next = new Phase(cascade, transformers); | 141 _next = new Phase(cascade, transformers); |
| 142 for (var outputs in _outputs.values) { | 142 for (var output in _outputs.values.toList()) { |
| 143 _next.addInput(outputs.output); | 143 output.removeListeners(); |
|
Bob Nystrom
2013/08/22 19:34:19
Document why its listeners are being removed.
| |
| 144 // Removing [output]'s listeners will cause it to be removed from | |
| 145 // [_outputs], so we have to put it back. | |
| 146 _outputs[output.output.id] = output; | |
| 147 _next.addInput(output.output); | |
| 144 } | 148 } |
| 145 return _next; | 149 return _next; |
| 146 } | 150 } |
| 147 | 151 |
| 148 /// Processes this phase. | 152 /// Processes this phase. |
| 149 /// | 153 /// |
| 150 /// Returns a future that completes when processing is done. If there is | 154 /// Returns a future that completes when processing is done. If there is |
| 151 /// nothing to process, returns `null`. | 155 /// nothing to process, returns `null`. |
| 152 Future process() { | 156 Future process() { |
| 153 if (!_inputs.values.any((input) => input.isDirty)) return null; | 157 if (!_inputs.values.any((input) => input.isDirty)) return null; |
| (...skipping 21 matching lines...) Expand all Loading... | |
| 175 for (var id in outputIds) { | 179 for (var id in outputIds) { |
| 176 // It's possible the output was removed before other transforms in this | 180 // It's possible the output was removed before other transforms in this |
| 177 // phase finished. | 181 // phase finished. |
| 178 if (!_outputs.containsKey(id)) continue; | 182 if (!_outputs.containsKey(id)) continue; |
| 179 var exception = _outputs[id].collisionException; | 183 var exception = _outputs[id].collisionException; |
| 180 if (exception != null) cascade.reportError(exception); | 184 if (exception != null) cascade.reportError(exception); |
| 181 } | 185 } |
| 182 }); | 186 }); |
| 183 } | 187 } |
| 184 } | 188 } |
| OLD | NEW |