| 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_input; | 5 library barback.phase_input; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:collection'; | 8 import 'dart:collection'; |
| 9 | 9 |
| 10 import 'asset.dart'; | 10 import 'asset.dart'; |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 /// Whether this input is dirty and needs [process] to be called. | 81 /// Whether this input is dirty and needs [process] to be called. |
| 82 bool get isDirty => _adjustTransformersFuture != null || | 82 bool get isDirty => _adjustTransformersFuture != null || |
| 83 _newPassThrough || _transforms.any((transform) => transform.isDirty); | 83 _newPassThrough || _transforms.any((transform) => transform.isDirty); |
| 84 | 84 |
| 85 /// A stream that emits an event whenever any transforms that use [input] as | 85 /// A stream that emits an event whenever any transforms that use [input] as |
| 86 /// their primary input log an entry. | 86 /// their primary input log an entry. |
| 87 Stream<LogEntry> get onLog => _onLogPool.stream; | 87 Stream<LogEntry> get onLog => _onLogPool.stream; |
| 88 final _onLogPool = new StreamPool<LogEntry>.broadcast(); | 88 final _onLogPool = new StreamPool<LogEntry>.broadcast(); |
| 89 | 89 |
| 90 PhaseInput(this._phase, AssetNode input, Iterable<Transformer> transformers, | 90 PhaseInput(this._phase, AssetNode input, Iterable<Transformer> transformers, |
| 91 this._location) | 91 this._location) |
| 92 : _transformers = transformers.toSet(), | 92 : _transformers = transformers.toSet(), |
| 93 _inputForwarder = new AssetForwarder(input) { | 93 _inputForwarder = new AssetForwarder(input) { |
| 94 _onDirtyPool.add(_onDirtyController.stream); | 94 _onDirtyPool.add(_onDirtyController.stream); |
| 95 | 95 |
| 96 input.onStateChange.listen((state) { | 96 input.onStateChange.listen((state) { |
| 97 if (state.isRemoved) { | 97 if (state.isRemoved) { |
| 98 remove(); | 98 remove(); |
| 99 } else if (_adjustTransformersFuture == null) { | 99 } else if (_adjustTransformersFuture == null) { |
| 100 _adjustTransformers(); | 100 _adjustTransformers(); |
| 101 } | 101 } |
| (...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 } | 313 } |
| 314 | 314 |
| 315 return Future.wait(_transforms.map((transform) { | 315 return Future.wait(_transforms.map((transform) { |
| 316 if (!transform.isDirty) return new Future.value(new Set()); | 316 if (!transform.isDirty) return new Future.value(new Set()); |
| 317 return transform.apply(); | 317 return transform.apply(); |
| 318 })).then((outputs) => unionAll(outputs)); | 318 })).then((outputs) => unionAll(outputs)); |
| 319 } | 319 } |
| 320 | 320 |
| 321 String toString() => "phase input in $_location for $input"; | 321 String toString() => "phase input in $_location for $input"; |
| 322 } | 322 } |
| OLD | NEW |