| 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'; | |
| 9 | 8 |
| 10 import 'asset_cascade.dart'; | 9 import 'asset_cascade.dart'; |
| 11 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| 12 import 'asset_node.dart'; | 11 import 'asset_node.dart'; |
| 13 import 'asset_set.dart'; | |
| 14 import 'barback_logger.dart'; | |
| 15 import 'group_runner.dart'; | 12 import 'group_runner.dart'; |
| 16 import 'errors.dart'; | 13 import 'log.dart'; |
| 17 import 'multiset.dart'; | 14 import 'multiset.dart'; |
| 18 import 'phase_forwarder.dart'; | 15 import 'phase_forwarder.dart'; |
| 19 import 'phase_input.dart'; | 16 import 'phase_input.dart'; |
| 20 import 'phase_output.dart'; | 17 import 'phase_output.dart'; |
| 21 import 'stream_pool.dart'; | 18 import 'stream_pool.dart'; |
| 22 import 'transformer.dart'; | 19 import 'transformer.dart'; |
| 23 import 'transformer_group.dart'; | 20 import 'transformer_group.dart'; |
| 24 import 'utils.dart'; | 21 import 'utils.dart'; |
| 25 | 22 |
| 26 /// One phase in the ordered series of transformations in an [AssetCascade]. | 23 /// One phase in the ordered series of transformations in an [AssetCascade]. |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 | 82 |
| 86 /// A controller whose stream feeds into [_onDirtyPool]. | 83 /// A controller whose stream feeds into [_onDirtyPool]. |
| 87 /// | 84 /// |
| 88 /// This is used whenever an input is added or transforms are changed. | 85 /// This is used whenever an input is added or transforms are changed. |
| 89 final _onDirtyController = new StreamController.broadcast(sync: true); | 86 final _onDirtyController = new StreamController.broadcast(sync: true); |
| 90 | 87 |
| 91 /// Whether this phase is dirty and needs to be run. | 88 /// Whether this phase is dirty and needs to be run. |
| 92 bool get isDirty => _inputs.values.any((input) => input.isDirty) || | 89 bool get isDirty => _inputs.values.any((input) => input.isDirty) || |
| 93 _groups.values.any((group) => group.isDirty); | 90 _groups.values.any((group) => group.isDirty); |
| 94 | 91 |
| 95 /// A stream that emits an event whenever any transforms in this phase log an | 92 /// A stream that emits an event whenever any transforms in this phase logs |
| 96 /// entry. | 93 /// an entry. |
| 97 Stream<LogEntry> get onLog => _onLogPool.stream; | 94 Stream<LogEntry> get onLog => _onLogPool.stream; |
| 98 final _onLogPool = new StreamPool<LogEntry>.broadcast(); | 95 final _onLogPool = new StreamPool<LogEntry>.broadcast(); |
| 99 | 96 |
| 100 /// The phase after this one. | 97 /// The phase after this one. |
| 101 /// | 98 /// |
| 102 /// Outputs from this phase will be passed to it. | 99 /// Outputs from this phase will be passed to it. |
| 103 Phase get next => _next; | 100 Phase get next => _next; |
| 104 Phase _next; | 101 Phase _next; |
| 105 | 102 |
| 106 /// Returns all currently-available output assets for this phase. | 103 /// Returns all currently-available output assets for this phase. |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 306 _outputs[asset.id].add(asset); | 303 _outputs[asset.id].add(asset); |
| 307 } else { | 304 } else { |
| 308 _outputs[asset.id] = new PhaseOutput(this, asset); | 305 _outputs[asset.id] = new PhaseOutput(this, asset); |
| 309 _outputs[asset.id].onAsset.listen((output) { | 306 _outputs[asset.id].onAsset.listen((output) { |
| 310 if (_next != null) _next.addInput(output); | 307 if (_next != null) _next.addInput(output); |
| 311 }, onDone: () => _outputs.remove(asset.id)); | 308 }, onDone: () => _outputs.remove(asset.id)); |
| 312 if (_next != null) _next.addInput(_outputs[asset.id].output); | 309 if (_next != null) _next.addInput(_outputs[asset.id].output); |
| 313 } | 310 } |
| 314 } | 311 } |
| 315 } | 312 } |
| OLD | NEW |