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

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

Issue 15680002: Remove explicit delayed futures in dart:io. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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/io/http_parser.dart ('k') | sdk/lib/io/websocket_impl.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 c6a82f00338e7fefc4fac78a7828f22c85471c41..8e8b71f2cf63468a47c03b0d8007e75db9183cbd 100644
--- a/sdk/lib/io/io_sink.dart
+++ b/sdk/lib/io/io_sink.dart
@@ -116,13 +116,12 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
void _completeDone({value, error}) {
if (_doneCompleter == null) return;
- var tmp = _doneCompleter;
- _doneCompleter = null;
if (error == null) {
- tmp.complete(value);
+ _doneCompleter.complete(value);
} else {
- tmp.completeError(error);
+ _doneCompleter.completeError(error);
}
+ _doneCompleter = null;
}
StreamController<T> get _controller {
@@ -140,10 +139,9 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
(_) {
if (_isBound) {
// A new stream takes over - forward values to that stream.
- var completer = _controllerCompleter;
+ _controllerCompleter.complete();
_controllerCompleter = null;
_controllerInstance = null;
- completer.complete();
} else {
// No new stream, .close was called. Close _target.
_closeTarget();
@@ -152,10 +150,9 @@ class _StreamSinkImpl<T> implements StreamSink<T> {
onError: (error) {
if (_isBound) {
// A new stream takes over - forward errors to that stream.
- var completer = _controllerCompleter;
+ _controllerCompleter.completeError(error);
_controllerCompleter = null;
_controllerInstance = null;
- completer.completeError(error);
} else {
// No new stream. No need to close target, as it have already
// failed.
« no previous file with comments | « sdk/lib/io/http_parser.dart ('k') | sdk/lib/io/websocket_impl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698