| 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 12 matching lines...) Expand all Loading... |
| 23 /// | 23 /// |
| 24 /// When the asset being forwarding changes, the old value of [output] will be | 24 /// When the asset being forwarding changes, the old value of [output] will be |
| 25 /// marked as removed and a new value will replace it. Users of this class can | 25 /// marked as removed and a new value will replace it. Users of this class can |
| 26 /// be notified of this using [onAsset]. | 26 /// be notified of this using [onAsset]. |
| 27 class PhaseOutput { | 27 class PhaseOutput { |
| 28 /// The phase for which this is an output. | 28 /// The phase for which this is an output. |
| 29 final Phase _phase; | 29 final Phase _phase; |
| 30 | 30 |
| 31 /// The asset node for this output. | 31 /// The asset node for this output. |
| 32 AssetNode get output => _outputForwarder.node; | 32 AssetNode get output => _outputForwarder.node; |
| 33 AssetNodeForwarder _outputForwarder; | 33 AssetForwarder _outputForwarder; |
| 34 | 34 |
| 35 /// A stream that emits an [AssetNode] each time this output starts forwarding | 35 /// A stream that emits an [AssetNode] each time this output starts forwarding |
| 36 /// a new asset. | 36 /// a new asset. |
| 37 Stream<AssetNode> get onAsset => _onAssetController.stream; | 37 Stream<AssetNode> get onAsset => _onAssetController.stream; |
| 38 final _onAssetController = new StreamController<AssetNode>(); | 38 final _onAssetController = new StreamController<AssetNode>(); |
| 39 | 39 |
| 40 /// The assets for this output. | 40 /// The assets for this output. |
| 41 /// | 41 /// |
| 42 /// If there's no collision, this will only have one element. Otherwise, it | 42 /// If there's no collision, this will only have one element. Otherwise, it |
| 43 /// will be ordered by which asset was added first. | 43 /// will be ordered by which asset was added first. |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 // they've successfully resolved the collision or not. | 103 // they've successfully resolved the collision or not. |
| 104 if (_assets.length > 1) { | 104 if (_assets.length > 1) { |
| 105 // Pump the event queue to ensure that the removal of the input triggers | 105 // Pump the event queue to ensure that the removal of the input triggers |
| 106 // a new build to which we can attach the error. | 106 // a new build to which we can attach the error. |
| 107 // TODO(nweiz): report this through the output asset. | 107 // TODO(nweiz): report this through the output asset. |
| 108 newFuture(() => _phase.cascade.reportError(collisionException)); | 108 newFuture(() => _phase.cascade.reportError(collisionException)); |
| 109 } | 109 } |
| 110 }); | 110 }); |
| 111 } | 111 } |
| 112 } | 112 } |
| OLD | NEW |