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

Unified Diff: sdk/lib/async/merge_stream.dart

Issue 11953103: Add public-facing method and class that allows intercepting stream events. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments Created 7 years, 11 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 | « sdk/lib/async/future.dart ('k') | sdk/lib/async/stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/merge_stream.dart
diff --git a/sdk/lib/async/merge_stream.dart b/sdk/lib/async/merge_stream.dart
index 05f5b0611703dd9a9f35ed4a94d21f296b7cd14f..4625b4f8aa9db65d322048b97fc3a60a381a6770 100644
--- a/sdk/lib/async/merge_stream.dart
+++ b/sdk/lib/async/merge_stream.dart
@@ -159,29 +159,34 @@ class _CycleEntry<T> {
Stream source;
/** The active subscription, if any. */
StreamSubscription subscription = null;
+ /** Whether the subscription is currently paused. */
+ bool isPaused = false;
/** Next entry in a linked list of entries. */
_CycleEntry next;
_CycleEntry(this.stream, this.source);
void cancel() {
- // This method may be called event if this entry has never been activated.
+ // This method may be called even if this entry has never been activated.
if (subscription != null) {
subscription.cancel();
subscription = null;
+ isPaused = false;
}
}
void pause() {
ensureSubscribed();
- if (!subscription.isPaused) {
+ if (!isPaused) {
subscription.pause();
+ isPaused = true;
}
}
void activate() {
ensureSubscribed();
- if (subscription.isPaused) {
+ if (isPaused) {
+ isPaused = false;
subscription.resume();
}
}
« no previous file with comments | « sdk/lib/async/future.dart ('k') | sdk/lib/async/stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698