| 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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 45 | 45 |
| 46 PhaseOutput(this._phase, AssetNode output) | 46 PhaseOutput(this._phase, AssetNode output) |
| 47 : _outputController = new AssetNodeController.from(output) { | 47 : _outputController = new AssetNodeController.from(output) { |
| 48 assert(!output.state.isRemoved); | 48 assert(!output.state.isRemoved); |
| 49 add(output); | 49 add(output); |
| 50 } | 50 } |
| 51 | 51 |
| 52 /// Adds an asset node as an output with this id. | 52 /// Adds an asset node as an output with this id. |
| 53 void add(AssetNode node) { | 53 void add(AssetNode node) { |
| 54 assert(node.id == output.id); | 54 assert(node.id == output.id); |
| 55 assert(!output.state.isRemoved); |
| 55 _assets.add(node); | 56 _assets.add(node); |
| 56 _watchAsset(node); | 57 _watchAsset(node); |
| 57 } | 58 } |
| 58 | 59 |
| 59 /// Removes all existing listeners on [output] without actually closing | 60 /// Removes all existing listeners on [output] without actually closing |
| 60 /// [this]. | 61 /// [this]. |
| 61 /// | 62 /// |
| 62 /// This marks [output] as removed, but immediately replaces it with a new | 63 /// This marks [output] as removed, but immediately replaces it with a new |
| 63 /// [AssetNode] in the same state as the old output. This is used when adding | 64 /// [AssetNode] in the same state as the old output. This is used when adding |
| 64 /// a new [Phase] to cause consumers of the prior phase's outputs to be to | 65 /// a new [Phase] to cause consumers of the prior phase's outputs to be to |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // 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 |
| 118 // if they've successfully resolved the collision or not. | 119 // if they've successfully resolved the collision or not. |
| 119 if (_assets.length > 1) { | 120 if (_assets.length > 1) { |
| 120 // 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 |
| 121 // a new build to which we can attach the error. | 122 // a new build to which we can attach the error. |
| 122 // TODO(nweiz): report this through the output asset. | 123 // TODO(nweiz): report this through the output asset. |
| 123 newFuture(() => _phase.cascade.reportError(collisionException)); | 124 newFuture(() => _phase.cascade.reportError(collisionException)); |
| 124 } | 125 } |
| 125 } | 126 } |
| 126 } | 127 } |
| OLD | NEW |