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/websocket_impl.dart

Issue 16125005: Make new StreamController be async by default. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address review comments 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/string_transformer.dart ('k') | sdk/lib/isolate/isolate_stream.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/websocket_impl.dart
diff --git a/sdk/lib/io/websocket_impl.dart b/sdk/lib/io/websocket_impl.dart
index 77c3456f5f604a727fd3017cddd93a65908d50e8..810808444560813d0015c896a5f72fc35a577786 100644
--- a/sdk/lib/io/websocket_impl.dart
+++ b/sdk/lib/io/websocket_impl.dart
@@ -93,7 +93,7 @@ class _WebSocketProtocolTransformer extends StreamEventTransformer {
throw new WebSocketException("Protocol error");
}
_currentMessageType = _WebSocketMessageType.TEXT;
- _controller = new StreamController();
+ _controller = new StreamController(sync: true);
_controller.stream
.transform(new Utf8DecoderTransformer(null))
.fold(new StringBuffer(), (buffer, str) => buffer..write(str))
@@ -109,7 +109,7 @@ class _WebSocketProtocolTransformer extends StreamEventTransformer {
throw new WebSocketException("Protocol error");
}
_currentMessageType = _WebSocketMessageType.BINARY;
- _controller = new StreamController();
+ _controller = new StreamController(sync: true);
_controller.stream
.fold(new _BufferList(), (buffer, data) => buffer..add(data))
.then((buffer) {
@@ -376,7 +376,7 @@ class _WebSocketPong {
class _WebSocketTransformerImpl implements WebSocketTransformer {
final StreamController<WebSocket> _controller =
- new StreamController<WebSocket>();
+ new StreamController<WebSocket>(sync: true);
Stream<WebSocket> bind(Stream<HttpRequest> stream) {
stream.listen((request) {
@@ -566,7 +566,8 @@ class _WebSocketConsumer implements StreamConsumer {
_ensureController() {
if (_controller != null) return;
- _controller = new StreamController(onPause: () => _subscription.pause(),
+ _controller = new StreamController(sync: true,
+ onPause: () => _subscription.pause(),
onResume: () => _subscription.resume(),
onCancel: _onListen);
var stream = _controller.stream.transform(
@@ -628,7 +629,7 @@ class _WebSocketConsumer implements StreamConsumer {
class _WebSocketImpl extends Stream implements WebSocket {
- final StreamController _controller = new StreamController();
+ final StreamController _controller = new StreamController(sync: true);
StreamSink _sink;
final Socket _socket;
« no previous file with comments | « sdk/lib/io/string_transformer.dart ('k') | sdk/lib/isolate/isolate_stream.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698