| 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.graph.phase; | 5 library barback.graph.phase; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import '../asset/asset_id.dart'; | 9 import '../asset/asset_id.dart'; |
| 10 import '../asset/asset_node.dart'; | 10 import '../asset/asset_node.dart'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 80 /// The streams exposed by this phase. | 80 /// The streams exposed by this phase. |
| 81 final _streams = new NodeStreams(); | 81 final _streams = new NodeStreams(); |
| 82 Stream<NodeStatus> get onStatusChange => _streams.onStatusChange; | 82 Stream<NodeStatus> get onStatusChange => _streams.onStatusChange; |
| 83 Stream<AssetNode> get onAsset => _streams.onAsset; | 83 Stream<AssetNode> get onAsset => _streams.onAsset; |
| 84 Stream<LogEntry> get onLog => _streams.onLog; | 84 Stream<LogEntry> get onLog => _streams.onLog; |
| 85 | 85 |
| 86 /// How far along [this] is in processing its assets. | 86 /// How far along [this] is in processing its assets. |
| 87 NodeStatus get status { | 87 NodeStatus get status { |
| 88 // Before any transformers are added, the phase should be dirty if and only | 88 // Before any transformers are added, the phase should be dirty if and only |
| 89 // if any input is dirty. | 89 // if any input is dirty. |
| 90 if (_classifiers.isEmpty && _groups.isEmpty) { | 90 if (_classifiers.isEmpty && _groups.isEmpty && previous == null) { |
| 91 return _inputs.any((input) => input.state.isDirty) ? | 91 return _inputs.any((input) => input.state.isDirty) ? |
| 92 NodeStatus.RUNNING : NodeStatus.IDLE; | 92 NodeStatus.RUNNING : NodeStatus.IDLE; |
| 93 } | 93 } |
| 94 | 94 |
| 95 var classifierStatus = NodeStatus.dirtiest( | 95 var classifierStatus = NodeStatus.dirtiest( |
| 96 _classifiers.values.map((classifier) => classifier.status)); | 96 _classifiers.values.map((classifier) => classifier.status)); |
| 97 var groupStatus = NodeStatus.dirtiest( | 97 var groupStatus = NodeStatus.dirtiest( |
| 98 _groups.values.map((group) => group.status)); | 98 _groups.values.map((group) => group.status)); |
| 99 return (previous == null ? NodeStatus.IDLE : previous.status) | 99 return (previous == null ? NodeStatus.IDLE : previous.status) |
| 100 .dirtier(classifierStatus) | 100 .dirtier(classifierStatus) |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 assert(asset.state.isDirty); | 378 assert(asset.state.isDirty); |
| 379 asset.force(); | 379 asset.force(); |
| 380 asset.whenStateChanges().then((state) { | 380 asset.whenStateChanges().then((state) { |
| 381 if (state.isRemoved) return getOutput(asset.id); | 381 if (state.isRemoved) return getOutput(asset.id); |
| 382 return asset; | 382 return asset; |
| 383 }).then(request.complete).catchError(request.completeError); | 383 }).then(request.complete).catchError(request.completeError); |
| 384 } | 384 } |
| 385 | 385 |
| 386 String toString() => "phase $_location.$_index"; | 386 String toString() => "phase $_location.$_index"; |
| 387 } | 387 } |
| OLD | NEW |