Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(538)

Unified Diff: pkg/barback/lib/src/package_graph.dart

Issue 255483002: Expand barback's notion of dirtiness to understand declaredness. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/barback/lib/src/node_streams.dart ('k') | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/package_graph.dart
diff --git a/pkg/barback/lib/src/package_graph.dart b/pkg/barback/lib/src/package_graph.dart
index c503c601c5c774a3448aa28904dc22ed3fbb40ec..bbb480db51e0b975c26c8ef89958fd0d568d94ec 100644
--- a/pkg/barback/lib/src/package_graph.dart
+++ b/pkg/barback/lib/src/package_graph.dart
@@ -14,6 +14,7 @@ import 'asset_set.dart';
import 'build_result.dart';
import 'errors.dart';
import 'log.dart';
+import 'node_status.dart';
import 'package_provider.dart';
import 'transformer.dart';
import 'utils.dart';
@@ -55,8 +56,9 @@ class PackageGraph {
Stream<LogEntry> get log => _logController.stream;
final _logController = new StreamController<LogEntry>.broadcast(sync: true);
- /// Whether [this] is dirty and still has more processing to do.
- bool get _isDirty => _cascades.values.any((cascade) => cascade.isDirty);
+ /// How far along [this] is in processing its assets.
+ NodeStatus get _status => NodeStatus.dirtiest(
+ _cascades.values.map((cascade) => cascade.status));
/// Whether a [BuildResult] is scheduled to be emitted on [results] (see
/// [_tryScheduleResult]).
@@ -89,7 +91,9 @@ class PackageGraph {
var cascade = new AssetCascade(this, package);
_cascades[package] = cascade;
cascade.onLog.listen(_onLog);
- cascade.onDone.listen((_) => _tryScheduleResult());
+ cascade.onStatusChange.listen((status) {
+ if (status == NodeStatus.IDLE) _tryScheduleResult();
+ });
}
_errors = mergeStreams(_cascades.values.map((cascade) => cascade.errors),
@@ -126,7 +130,7 @@ class PackageGraph {
_inErrorZone(() => cascade.forceAllTransforms());
}
- if (_isDirty) {
+ if (_status != NodeStatus.IDLE) {
// A build is still ongoing, so wait for it to complete and try again.
return results.first.then((_) => getAllAssets());
}
@@ -222,13 +226,13 @@ class PackageGraph {
/// [BuildResult]) to ensure that calling multiple functions synchronously
/// produces only a single [BuildResult].
void _tryScheduleResult() {
- if (_isDirty) return;
+ if (_status != NodeStatus.IDLE) return;
if (_resultScheduled) return;
_resultScheduled = true;
newFuture(() {
_resultScheduled = false;
- if (_isDirty) return;
+ if (_status != NodeStatus.IDLE) return;
_lastResult = new BuildResult(_accumulatedErrors);
_accumulatedErrors.clear();
« no previous file with comments | « pkg/barback/lib/src/node_streams.dart ('k') | pkg/barback/lib/src/phase.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698