| 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.asset_cascade; | 5 library barback.asset_cascade; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 | 8 |
| 9 import 'asset.dart'; | 9 import 'asset.dart'; |
| 10 import 'asset_id.dart'; | 10 import 'asset_id.dart'; |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 Stream<BarbackException> get errors => _errorsController.stream; | 57 Stream<BarbackException> get errors => _errorsController.stream; |
| 58 final _errorsController = | 58 final _errorsController = |
| 59 new StreamController<BarbackException>.broadcast(sync: true); | 59 new StreamController<BarbackException>.broadcast(sync: true); |
| 60 | 60 |
| 61 /// A stream that emits an event whenever any transforms in this cascade logs | 61 /// A stream that emits an event whenever any transforms in this cascade logs |
| 62 /// an entry. | 62 /// an entry. |
| 63 Stream<LogEntry> get onLog => _onLogPool.stream; | 63 Stream<LogEntry> get onLog => _onLogPool.stream; |
| 64 final _onLogPool = new StreamPool<LogEntry>.broadcast(); | 64 final _onLogPool = new StreamPool<LogEntry>.broadcast(); |
| 65 | 65 |
| 66 /// Whether [this] is dirty and still has more processing to do. | 66 /// Whether [this] is dirty and still has more processing to do. |
| 67 bool get isDirty => _phases.any((phase) => phase.isDirty); | 67 bool get isDirty { |
| 68 // Just check the last phase, since it will check all the previous phases |
| 69 // itself. |
| 70 return _phases.last.isDirty; |
| 71 } |
| 68 | 72 |
| 69 /// A stream that emits an event whenever [this] is no longer dirty. | 73 /// A stream that emits an event whenever [this] is no longer dirty. |
| 70 /// | 74 /// |
| 71 /// This is synchronous in order to guarantee that it will emit an event as | 75 /// This is synchronous in order to guarantee that it will emit an event as |
| 72 /// soon as [isDirty] flips from `true` to `false`. | 76 /// soon as [isDirty] flips from `true` to `false`. |
| 73 Stream get onDone => _onDoneController.stream; | 77 Stream get onDone => _onDoneController.stream; |
| 74 final _onDoneController = new StreamController.broadcast(sync: true); | 78 final _onDoneController = new StreamController.broadcast(sync: true); |
| 75 | 79 |
| 76 /// Returns all currently-available output assets from this cascade. | 80 /// Returns all currently-available output assets from this cascade. |
| 77 AssetSet get availableOutputs => | 81 AssetSet get availableOutputs => |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 201 _onLogPool.add(phase.onLog); | 205 _onLogPool.add(phase.onLog); |
| 202 phase.onDone.listen((_) { | 206 phase.onDone.listen((_) { |
| 203 if (!isDirty) _onDoneController.add(null); | 207 if (!isDirty) _onDoneController.add(null); |
| 204 }); | 208 }); |
| 205 | 209 |
| 206 _phases.add(phase); | 210 _phases.add(phase); |
| 207 } | 211 } |
| 208 | 212 |
| 209 String toString() => "cascade for $package"; | 213 String toString() => "cascade for $package"; |
| 210 } | 214 } |
| OLD | NEW |