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

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: Fix typo. 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') | no next file with comments »
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 f47b639a8c8729755154cd3500ad145676919f09..1dc624d9d30fa8b9fbbddae57d05cac1ac0ccb53 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698