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

Side by Side Diff: sdk/lib/io/io_sink.dart

Issue 14196003: Change StreamController constructor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix some bugs. 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of dart.io; 5 part of dart.io;
6 6
7 /** 7 /**
8 * Helper class to wrap a [StreamConsumer<List<int>>] and provide 8 * Helper class to wrap a [StreamConsumer<List<int>>] and provide
9 * utility functions for writing to the StreamConsumer directly. The 9 * utility functions for writing to the StreamConsumer directly. The
10 * [IOSink] buffers the input given by [write], [writeAll], [writeln], 10 * [IOSink] buffers the input given by [write], [writeAll], [writeln],
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 _bindSubscription = null; 187 _bindSubscription = null;
188 tmp.complete(); 188 tmp.complete();
189 } else { 189 } else {
190 tmp.completeError(error); 190 tmp.completeError(error);
191 } 191 }
192 } 192 }
193 193
194 StreamController<List<int>> get _controller { 194 StreamController<List<int>> get _controller {
195 if (_controllerInstance == null) { 195 if (_controllerInstance == null) {
196 _controllerInstance = new StreamController<List<int>>( 196 _controllerInstance = new StreamController<List<int>>(
197 onPauseStateChange: _onPauseStateChange, 197 onListen: _onSubscriptionStateChange,
198 onSubscriptionStateChange: _onSubscriptionStateChange); 198 onPause: _onPauseStateChange,
199 onResume: _onPauseStateChange,
200 onCancel: _onSubscriptionStateChange);
199 var future = _controller.stream.pipe(_target); 201 var future = _controller.stream.pipe(_target);
200 future.then((_) => _completeWriteStreamCompleter(), 202 future.then((_) => _completeWriteStreamCompleter(),
201 onError: (error) => _completeWriteStreamCompleter(error)); 203 onError: (error) => _completeWriteStreamCompleter(error));
202 _pipeFuture = future.then((value) => value); 204 _pipeFuture = future.then((value) => value);
203 } 205 }
204 return _controllerInstance; 206 return _controllerInstance;
205 } 207 }
206 208
207 bool get _isBound => _bindSubscription != null; 209 bool get _isBound => _bindSubscription != null;
208 210
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
264 }, 266 },
265 onError: _controller.addError); 267 onError: _controller.addError);
266 if (_paused) _pause(); 268 if (_paused) _pause();
267 if (unbind) { 269 if (unbind) {
268 return _writeStreamCompleter.future; 270 return _writeStreamCompleter.future;
269 } else { 271 } else {
270 return _pipeFuture; 272 return _pipeFuture;
271 } 273 }
272 } 274 }
273 } 275 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698