| Index: third_party/pkg/barback-0.13.0/lib/src/asset_cascade.dart
|
| diff --git a/pkg/barback/lib/src/graph/asset_cascade.dart b/third_party/pkg/barback-0.13.0/lib/src/asset_cascade.dart
|
| similarity index 84%
|
| copy from pkg/barback/lib/src/graph/asset_cascade.dart
|
| copy to third_party/pkg/barback-0.13.0/lib/src/asset_cascade.dart
|
| index ca087857311d0197562301fec645e468ecba74a7..74db0d9766e3976eab56010cc94ef20d89957a3d 100644
|
| --- a/pkg/barback/lib/src/graph/asset_cascade.dart
|
| +++ b/third_party/pkg/barback-0.13.0/lib/src/asset_cascade.dart
|
| @@ -2,22 +2,21 @@
|
| // for details. All rights reserved. Use of this source code is governed by a
|
| // BSD-style license that can be found in the LICENSE file.
|
|
|
| -library barback.graph.asset_cascade;
|
| +library barback.asset_cascade;
|
|
|
| import 'dart:async';
|
|
|
| -import '../asset/asset.dart';
|
| -import '../asset/asset_id.dart';
|
| -import '../asset/asset_node.dart';
|
| -import '../asset/asset_set.dart';
|
| -import '../errors.dart';
|
| -import '../log.dart';
|
| -import '../transformer/transformer.dart';
|
| -import '../utils/cancelable_future.dart';
|
| -import 'node_status.dart';
|
| -import 'node_streams.dart';
|
| +import 'asset.dart';
|
| +import 'asset_id.dart';
|
| +import 'asset_node.dart';
|
| +import 'asset_set.dart';
|
| +import 'log.dart';
|
| +import 'cancelable_future.dart';
|
| +import 'errors.dart';
|
| import 'package_graph.dart';
|
| import 'phase.dart';
|
| +import 'stream_pool.dart';
|
| +import 'transformer.dart';
|
|
|
| /// The asset cascade for an individual package.
|
| ///
|
| @@ -56,9 +55,9 @@ class AssetCascade {
|
| /// request inputs from a previous phase.
|
| final _phases = <Phase>[];
|
|
|
| - /// The subscription to the [Phase.onStatusChange] stream of the last [Phase]
|
| - /// in [_phases].
|
| - StreamSubscription _phaseStatusSubscription;
|
| + /// The subscription to the [Phase.onDone] stream of the last [Phase] in
|
| + /// [_phases].
|
| + StreamSubscription _phaseOnDoneSubscription;
|
|
|
| /// A stream that emits any errors from the cascade or the transformers.
|
| ///
|
| @@ -68,17 +67,24 @@ class AssetCascade {
|
| final _errorsController =
|
| new StreamController<BarbackException>.broadcast(sync: true);
|
|
|
| - /// How far along [this] is in processing its assets.
|
| - NodeStatus get status {
|
| + /// A stream that emits an event whenever any transforms in this cascade logs
|
| + /// an entry.
|
| + Stream<LogEntry> get onLog => _onLogPool.stream;
|
| + final _onLogPool = new StreamPool<LogEntry>.broadcast();
|
| +
|
| + /// Whether [this] is dirty and still has more processing to do.
|
| + bool get isDirty {
|
| // Just check the last phase, since it will check all the previous phases
|
| // itself.
|
| - return _phases.last.status;
|
| + return _phases.last.isDirty;
|
| }
|
|
|
| - /// The streams exposed by this cascade.
|
| - final _streams = new NodeStreams();
|
| - Stream<LogEntry> get onLog => _streams.onLog;
|
| - Stream<NodeStatus> get onStatusChange => _streams.onStatusChange;
|
| + /// A stream that emits an event whenever [this] is no longer dirty.
|
| + ///
|
| + /// This is synchronous in order to guarantee that it will emit an event as
|
| + /// soon as [isDirty] flips from `true` to `false`.
|
| + Stream get onDone => _onDoneController.stream;
|
| + final _onDoneController = new StreamController.broadcast(sync: true);
|
|
|
| /// Returns all currently-available output assets from this cascade.
|
| AssetSet get availableOutputs =>
|
| @@ -191,9 +197,9 @@ class AssetCascade {
|
| }
|
| _phases.removeRange(transformers.length + 1, _phases.length);
|
|
|
| - _phaseStatusSubscription.cancel();
|
| - _phaseStatusSubscription = _phases.last.onStatusChange
|
| - .listen(_streams.changeStatus);
|
| + _phaseOnDoneSubscription.cancel();
|
| + _phaseOnDoneSubscription = _phases.last.onDone
|
| + .listen(_onDoneController.add);
|
| }
|
|
|
| /// Force all [LazyTransformer]s' transforms in this cascade to begin
|
| @@ -210,10 +216,9 @@ class AssetCascade {
|
|
|
| /// Add [phase] to the end of [_phases] and watch its streams.
|
| void _addPhase(Phase phase) {
|
| - _streams.onLogPool.add(phase.onLog);
|
| - if (_phaseStatusSubscription != null) _phaseStatusSubscription.cancel();
|
| - _phaseStatusSubscription =
|
| - phase.onStatusChange.listen(_streams.changeStatus);
|
| + _onLogPool.add(phase.onLog);
|
| + if (_phaseOnDoneSubscription != null) _phaseOnDoneSubscription.cancel();
|
| + _phaseOnDoneSubscription = phase.onDone.listen(_onDoneController.add);
|
|
|
| _phases.add(phase);
|
| }
|
|
|