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

Side by Side Diff: sdk/lib/io/http_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: Created 7 years, 6 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 class _HttpIncoming extends Stream<List<int>> { 7 class _HttpIncoming extends Stream<List<int>> {
8 final int _transferLength; 8 final int _transferLength;
9 final Completer _dataCompleter = new Completer(); 9 final Completer _dataCompleter = new Completer();
10 Stream<List<int>> _stream; 10 Stream<List<int>> _stream;
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after
563 void _cancel() { 563 void _cancel() {
564 if (_subscription != null) { 564 if (_subscription != null) {
565 StreamSubscription subscription = _subscription; 565 StreamSubscription subscription = _subscription;
566 _subscription = null; 566 _subscription = null;
567 subscription.cancel(); 567 subscription.cancel();
568 } 568 }
569 } 569 }
570 570
571 _ensureController() { 571 _ensureController() {
572 if (_controller != null) return; 572 if (_controller != null) return;
573 _controller = new StreamController(onPause: () => _subscription.pause(), 573 _controller = new StreamController(sync: true,onPause: () => _subscription.p ause(),
floitsch 2013/05/30 12:13:48 missing new-line.
Lasse Reichstein Nielsen 2013/05/31 05:51:59 Done.
574 onResume: () => _subscription.resume(), 574 onResume: () => _subscription.resume(),
575 onListen: () => _subscription.resume(), 575 onListen: () => _subscription.resume(),
576 onCancel: _cancel); 576 onCancel: _cancel);
577 _outbound._addStream(_controller.stream) 577 _outbound._addStream(_controller.stream)
578 .then((_) { 578 .then((_) {
579 _cancel(); 579 _cancel();
580 _done(); 580 _done();
581 _closeCompleter.complete(_outbound); 581 _closeCompleter.complete(_outbound);
582 }, 582 },
583 onError: (error) { 583 onError: (error) {
(...skipping 1348 matching lines...) Expand 10 before | Expand all | Expand 10 after
1932 // Indicated if the http server has been closed. 1932 // Indicated if the http server has been closed.
1933 bool closed = false; 1933 bool closed = false;
1934 1934
1935 // The server listen socket. 1935 // The server listen socket.
1936 final ServerSocket _serverSocket; 1936 final ServerSocket _serverSocket;
1937 final bool _closeServer; 1937 final bool _closeServer;
1938 1938
1939 // Set of currently connected clients. 1939 // Set of currently connected clients.
1940 final Set<_HttpConnection> _connections = new Set<_HttpConnection>(); 1940 final Set<_HttpConnection> _connections = new Set<_HttpConnection>();
1941 final StreamController<HttpRequest> _controller 1941 final StreamController<HttpRequest> _controller
1942 = new StreamController<HttpRequest>(); 1942 = new StreamController<HttpRequest>(sync: true);
1943 1943
1944 // TODO(ajohnsen): Use close queue? 1944 // TODO(ajohnsen): Use close queue?
1945 } 1945 }
1946 1946
1947 1947
1948 class _ProxyConfiguration { 1948 class _ProxyConfiguration {
1949 static const String PROXY_PREFIX = "PROXY "; 1949 static const String PROXY_PREFIX = "PROXY ";
1950 static const String DIRECT_PREFIX = "DIRECT"; 1950 static const String DIRECT_PREFIX = "DIRECT";
1951 1951
1952 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() { 1952 _ProxyConfiguration(String configuration) : proxies = new List<_Proxy>() {
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
2338 2338
2339 2339
2340 class _RedirectInfo implements RedirectInfo { 2340 class _RedirectInfo implements RedirectInfo {
2341 const _RedirectInfo(int this.statusCode, 2341 const _RedirectInfo(int this.statusCode,
2342 String this.method, 2342 String this.method,
2343 Uri this.location); 2343 Uri this.location);
2344 final int statusCode; 2344 final int statusCode;
2345 final String method; 2345 final String method;
2346 final Uri location; 2346 final Uri location;
2347 } 2347 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698