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

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

Issue 75033003: Don't use linked maps/sets in http internals. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « sdk/lib/io/http_headers.dart ('k') | sdk/lib/io/http_session.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 const int _HEADERS_BUFFER_SIZE = 8 * 1024; 7 const int _HEADERS_BUFFER_SIZE = 8 * 1024;
8 8
9 class _HttpIncoming extends Stream<List<int>> { 9 class _HttpIncoming extends Stream<List<int>> {
10 final int _transferLength; 10 final int _transferLength;
(...skipping 1470 matching lines...) Expand 10 before | Expand all | Expand 10 after
1481 final _HttpClientConnection connection; 1481 final _HttpClientConnection connection;
1482 final _Proxy proxy; 1482 final _Proxy proxy;
1483 } 1483 }
1484 1484
1485 1485
1486 class _HttpClient implements HttpClient { 1486 class _HttpClient implements HttpClient {
1487 // TODO(ajohnsen): Use eviction timeout. 1487 // TODO(ajohnsen): Use eviction timeout.
1488 bool _closing = false; 1488 bool _closing = false;
1489 1489
1490 final Map<String, Set<_HttpClientConnection>> _idleConnections 1490 final Map<String, Set<_HttpClientConnection>> _idleConnections
1491 = new Map<String, Set<_HttpClientConnection>>(); 1491 = new HashMap<String, Set<_HttpClientConnection>>();
1492 final Set<_HttpClientConnection> _activeConnections 1492 final Set<_HttpClientConnection> _activeConnections
1493 = new Set<_HttpClientConnection>(); 1493 = new HashSet<_HttpClientConnection>();
1494 final List<_Credentials> _credentials = []; 1494 final List<_Credentials> _credentials = [];
1495 final List<_ProxyCredentials> _proxyCredentials = []; 1495 final List<_ProxyCredentials> _proxyCredentials = [];
1496 Function _authenticate; 1496 Function _authenticate;
1497 Function _authenticateProxy; 1497 Function _authenticateProxy;
1498 Function _findProxy = HttpClient.findProxyFromEnvironment; 1498 Function _findProxy = HttpClient.findProxyFromEnvironment;
1499 Duration _idleTimeout = const Duration(seconds: 15); 1499 Duration _idleTimeout = const Duration(seconds: 15);
1500 Function _badCertificateCallback; 1500 Function _badCertificateCallback;
1501 1501
1502 Timer _noActiveTimer; 1502 Timer _noActiveTimer;
1503 1503
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
1674 } 1674 }
1675 1675
1676 // Return a live connection to the idle pool. 1676 // Return a live connection to the idle pool.
1677 void _returnConnection(_HttpClientConnection connection) { 1677 void _returnConnection(_HttpClientConnection connection) {
1678 _activeConnections.remove(connection); 1678 _activeConnections.remove(connection);
1679 if (_closing) { 1679 if (_closing) {
1680 connection.close(); 1680 connection.close();
1681 return; 1681 return;
1682 } 1682 }
1683 if (!_idleConnections.containsKey(connection.key)) { 1683 if (!_idleConnections.containsKey(connection.key)) {
1684 _idleConnections[connection.key] = new LinkedHashSet(); 1684 _idleConnections[connection.key] = new HashSet();
1685 } 1685 }
1686 _idleConnections[connection.key].add(connection); 1686 _idleConnections[connection.key].add(connection);
1687 connection.startTimer(); 1687 connection.startTimer();
1688 _updateTimers(); 1688 _updateTimers();
1689 } 1689 }
1690 1690
1691 // Remove a closed connnection from the active set. 1691 // Remove a closed connnection from the active set.
1692 void _connectionClosed(_HttpClientConnection connection) { 1692 void _connectionClosed(_HttpClientConnection connection) {
1693 connection.stopTimer(); 1693 connection.stopTimer();
1694 _activeConnections.remove(connection); 1694 _activeConnections.remove(connection);
(...skipping 857 matching lines...) Expand 10 before | Expand all | Expand 10 after
2552 2552
2553 String _getHttpVersion() { 2553 String _getHttpVersion() {
2554 var version = Platform.version; 2554 var version = Platform.version;
2555 // Only include major and minor version numbers. 2555 // Only include major and minor version numbers.
2556 int index = version.indexOf('.', version.indexOf('.') + 1); 2556 int index = version.indexOf('.', version.indexOf('.') + 1);
2557 version = version.substring(0, index); 2557 version = version.substring(0, index);
2558 return 'Dart/$version (dart:io)'; 2558 return 'Dart/$version (dart:io)';
2559 } 2559 }
2560 2560
2561 2561
OLDNEW
« no previous file with comments | « sdk/lib/io/http_headers.dart ('k') | sdk/lib/io/http_session.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698