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

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

Issue 12545056: Make stream subscription more lax wrt. calling methods on it after it's completed. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « sdk/lib/async/stream_impl.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/async/stream_pipe.dart
diff --git a/sdk/lib/async/stream_pipe.dart b/sdk/lib/async/stream_pipe.dart
index 69210ecabd1f2259571bfe6db85f32fc8942bd19..f3a8ea119ecbfdeb6d8294034ffc0648c835f7da 100644
--- a/sdk/lib/async/stream_pipe.dart
+++ b/sdk/lib/async/stream_pipe.dart
@@ -158,25 +158,20 @@ class _ForwardingStreamSubscription<S, T>
// StreamSubscription interface.
void pause([Future resumeSignal]) {
- if (_subscription == null) {
- throw new StateError("Subscription has been unsubscribed");
- }
+ if (_subscription == null) return;
_subscription.pause(resumeSignal);
}
void resume() {
- if (_subscription == null) {
- throw new StateError("Subscription has been unsubscribed");
- }
+ if (_subscription == null) return;
_subscription.resume();
}
void cancel() {
- if (_subscription == null) {
- throw new StateError("Subscription has been unsubscribed");
+ if (_subscription != null) {
+ _subscription.cancel();
+ _subscription = null;
}
- _subscription.cancel();
- _subscription = null;
}
// _EventOutputSink interface. Sends data to this subscription.
« no previous file with comments | « sdk/lib/async/stream_impl.dart ('k') | sdk/lib/html/dart2js/html_dart2js.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698