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

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

Issue 188673004: Roll forward commits r33138, r33135, and r33134. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: code review Created 6 years, 9 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/phase_input.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/barback/lib/src/transform_node.dart
diff --git a/pkg/barback/lib/src/transform_node.dart b/pkg/barback/lib/src/transform_node.dart
index bfa62310f7b6e20a3d4b5a0007e3a8138700cc20..2fa826e2f9e10030b9f980fbeff53a8d07e83b6d 100644
--- a/pkg/barback/lib/src/transform_node.dart
+++ b/pkg/barback/lib/src/transform_node.dart
@@ -65,12 +65,16 @@ class TransformNode {
/// The controllers for the asset nodes emitted by this node.
var _outputControllers = new Map<AssetId, AssetNodeController>();
- /// A stream that emits an event whenever [this] is no longer dirty.
+ // TODO(nweiz): It's weird that this is different than the [onDone] stream the
+ // other nodes emit. See if we can make that more consistent.
+ /// A stream that emits an event whenever [onDirty] changes its value.
///
/// 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);
+ /// soon as [isDirty] changes. It's possible for this to emit multiple events
+ /// while [isDirty] is `true`. However, it will only emit a single event each
+ /// time [isDirty] becomes `false`.
+ Stream get onStateChange => _onStateChangeController.stream;
+ final _onStateChangeController = new StreamController.broadcast(sync: true);
/// A stream that emits any new assets emitted by [this].
///
@@ -118,7 +122,7 @@ class TransformNode {
void remove() {
_hasBecomeDirty = false;
_onAssetController.close();
- _onDoneController.close();
+ _onStateChangeController.close();
_primarySubscription.cancel();
for (var subscription in _inputSubscriptions.values) {
subscription.cancel();
@@ -156,6 +160,7 @@ class TransformNode {
}
_hasBecomeDirty = true;
+ _onStateChangeController.add(null);
if (!_isApplying && !_pendingIsPrimary) _apply();
}
@@ -171,6 +176,7 @@ class TransformNode {
_inputSubscriptions.clear();
_isApplying = true;
+ _onStateChangeController.add(null);
primary.whenAvailable((_) {
_hasBecomeDirty = false;
@@ -207,7 +213,7 @@ class TransformNode {
} else {
assert(!isDirty);
// Otherwise, notify the parent nodes that it's no longer dirty.
- _onDoneController.add(null);
+ _onStateChangeController.add(null);
}
});
}
« no previous file with comments | « pkg/barback/lib/src/phase_input.dart ('k') | pkg/barback/pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698