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

Unified Diff: sdk/lib/io/io_sink.dart

Issue 14261003: Don't delay IOSink.close() with no subscription to the next instance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 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 | « no previous file | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/io_sink.dart
diff --git a/sdk/lib/io/io_sink.dart b/sdk/lib/io/io_sink.dart
index 802486551935911386fd5440008f7801ad0ae267..dcdaf1ab4262d1fe977433a23ba546c7e70251cd 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -134,19 +134,16 @@ class _IOSinkImpl implements IOSink {
}
_isBound = true;
// Wait for any sync operations to complete.
- return _closeController().then((_) {
+ Future targetAddStream() {
return _target.addStream(stream)
.whenComplete(() {
_isBound = false;
});
- });
- }
-
- Future _closeController() {
- if (_controllerInstance == null) return new Future.immediate(null);
+ }
+ if (_controllerInstance == null) return targetAddStream();
var future = _controllerCompleter.future;
_controllerInstance.close();
- return future;
+ return future.then((_) => targetAddStream());
}
Future close() {
« no previous file with comments | « no previous file | utils/pub/io.dart » ('j') | utils/pub/io.dart » ('J')

Powered by Google App Engine
This is Rietveld 408576698