| OLD | NEW |
| 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 218 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 229 if (_bindSubscription != null) { | 229 if (_bindSubscription != null) { |
| 230 try { | 230 try { |
| 231 // The subscription can be canceled at this point. | 231 // The subscription can be canceled at this point. |
| 232 _bindSubscription.resume(); | 232 _bindSubscription.resume(); |
| 233 } catch (e) { | 233 } catch (e) { |
| 234 } | 234 } |
| 235 } | 235 } |
| 236 } | 236 } |
| 237 | 237 |
| 238 void _onSubscriptionStateChange() { | 238 void _onSubscriptionStateChange() { |
| 239 if (_controller.hasSubscribers) { | 239 if (_controller.hasListener) { |
| 240 _paused = false; | 240 _paused = false; |
| 241 _resume(); | 241 _resume(); |
| 242 } else { | 242 } else { |
| 243 if (_bindSubscription != null) { | 243 if (_bindSubscription != null) { |
| 244 _bindSubscription.cancel(); | 244 _bindSubscription.cancel(); |
| 245 _bindSubscription = null; | 245 _bindSubscription = null; |
| 246 } | 246 } |
| 247 } | 247 } |
| 248 } | 248 } |
| 249 | 249 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 264 }, | 264 }, |
| 265 onError: _controller.addError); | 265 onError: _controller.addError); |
| 266 if (_paused) _pause(); | 266 if (_paused) _pause(); |
| 267 if (unbind) { | 267 if (unbind) { |
| 268 return _writeStreamCompleter.future; | 268 return _writeStreamCompleter.future; |
| 269 } else { | 269 } else { |
| 270 return _pipeFuture; | 270 return _pipeFuture; |
| 271 } | 271 } |
| 272 } | 272 } |
| 273 } | 273 } |
| OLD | NEW |