| 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_output; | 5 library barback.phase_output; |
| 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 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 98 | 98 |
| 99 // If there was more than one asset, we're resolving a collision -- | 99 // If there was more than one asset, we're resolving a collision -- |
| 100 // possibly partially. | 100 // possibly partially. |
| 101 var wasFirst = _assets.first == node; | 101 var wasFirst = _assets.first == node; |
| 102 _assets.remove(node); | 102 _assets.remove(node); |
| 103 | 103 |
| 104 // If this was the first asset, we replace it with the next asset | 104 // If this was the first asset, we replace it with the next asset |
| 105 // (chronologically). | 105 // (chronologically). |
| 106 if (wasFirst) { | 106 if (wasFirst) { |
| 107 var newOutput = _assets.first; | 107 var newOutput = _assets.first; |
| 108 _outputController.setTransform(newOutput.transform); | 108 _outputController.setOrigin(newOutput.origin); |
| 109 if (newOutput.state.isAvailable) { | 109 if (newOutput.state.isAvailable) { |
| 110 if (output.state.isAvailable) _outputController.setDirty(); | 110 if (output.state.isAvailable) _outputController.setDirty(); |
| 111 _outputController.setAvailable(newOutput.asset); | 111 _outputController.setAvailable(newOutput.asset); |
| 112 } else { | 112 } else { |
| 113 assert(newOutput.isDirty); | 113 assert(newOutput.isDirty); |
| 114 if (!output.state.isDirty) _outputController.setDirty(); | 114 if (!output.state.isDirty) _outputController.setDirty(); |
| 115 } | 115 } |
| 116 } | 116 } |
| 117 | 117 |
| 118 // If there's still a collision, report it. This lets the user know | 118 // If there's still a collision, report it. This lets the user know |
| 119 // if they've successfully resolved the collision or not. | 119 // if they've successfully resolved the collision or not. |
| 120 if (_assets.length > 1) { | 120 if (_assets.length > 1) { |
| 121 // Pump the event queue to ensure that the removal of the input triggers | 121 // Pump the event queue to ensure that the removal of the input triggers |
| 122 // a new build to which we can attach the error. | 122 // a new build to which we can attach the error. |
| 123 // TODO(nweiz): report this through the output asset. | 123 // TODO(nweiz): report this through the output asset. |
| 124 newFuture(() => _phase.cascade.reportError(collisionException)); | 124 newFuture(() => _phase.cascade.reportError(collisionException)); |
| 125 } | 125 } |
| 126 } | 126 } |
| 127 } | 127 } |
| OLD | NEW |