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

Side by Side Diff: net/http/http_network_session.h

Issue 118100: Avoid doing concurrent DNS resolves of the same hostname (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Get compiling on mac Created 11 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef NET_HTTP_HTTP_NETWORK_SESSION_H_ 5 #ifndef NET_HTTP_HTTP_NETWORK_SESSION_H_
6 #define NET_HTTP_HTTP_NETWORK_SESSION_H_ 6 #define NET_HTTP_HTTP_NETWORK_SESSION_H_
7 7
8 #include "base/ref_counted.h" 8 #include "base/ref_counted.h"
9 #include "net/base/ssl_config_service.h" 9 #include "net/base/ssl_config_service.h"
10 #include "net/base/tcp_client_socket_pool.h" 10 #include "net/base/tcp_client_socket_pool.h"
11 #include "net/http/http_auth_cache.h" 11 #include "net/http/http_auth_cache.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 class ClientSocketFactory; 15 class ClientSocketFactory;
16 class HostResolver;
16 class ProxyService; 17 class ProxyService;
17 18
18 // This class holds session objects used by HttpNetworkTransaction objects. 19 // This class holds session objects used by HttpNetworkTransaction objects.
19 class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { 20 class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> {
20 public: 21 public:
21 HttpNetworkSession(ProxyService* proxy_service, 22 HttpNetworkSession(HostResolver* host_resolver, ProxyService* proxy_service,
22 ClientSocketFactory* client_socket_factory) 23 ClientSocketFactory* client_socket_factory)
23 : connection_pool_(new TCPClientSocketPool( 24 : connection_pool_(new TCPClientSocketPool(
24 max_sockets_per_group_, client_socket_factory)), 25 max_sockets_per_group_, host_resolver, client_socket_factory)),
26 host_resolver_(host_resolver),
25 proxy_service_(proxy_service) { 27 proxy_service_(proxy_service) {
26 DCHECK(proxy_service); 28 DCHECK(proxy_service);
27 } 29 }
28 30
29 HttpAuthCache* auth_cache() { return &auth_cache_; } 31 HttpAuthCache* auth_cache() { return &auth_cache_; }
30 ClientSocketPool* connection_pool() { return connection_pool_; } 32 ClientSocketPool* connection_pool() { return connection_pool_; }
33 HostResolver* host_resolver() { return host_resolver_; }
31 ProxyService* proxy_service() { return proxy_service_; } 34 ProxyService* proxy_service() { return proxy_service_; }
32 #if defined(OS_WIN) 35 #if defined(OS_WIN)
33 SSLConfigService* ssl_config_service() { return &ssl_config_service_; } 36 SSLConfigService* ssl_config_service() { return &ssl_config_service_; }
34 #endif 37 #endif
35 38
36 static void set_max_sockets_per_group(int socket_count); 39 static void set_max_sockets_per_group(int socket_count);
37 40
38 private: 41 private:
39 // Default to allow up to 6 connections per host. Experiment and tuning may 42 // Default to allow up to 6 connections per host. Experiment and tuning may
40 // try other values (greater than 0). Too large may cause many problems, such 43 // try other values (greater than 0). Too large may cause many problems, such
41 // as home routers blocking the connections!?!? 44 // as home routers blocking the connections!?!?
42 static int max_sockets_per_group_; 45 static int max_sockets_per_group_;
43 46
44 HttpAuthCache auth_cache_; 47 HttpAuthCache auth_cache_;
45 scoped_refptr<ClientSocketPool> connection_pool_; 48 scoped_refptr<ClientSocketPool> connection_pool_;
49 HostResolver* host_resolver_;
46 ProxyService* proxy_service_; 50 ProxyService* proxy_service_;
47 #if defined(OS_WIN) 51 #if defined(OS_WIN)
48 // TODO(port): Port the SSLConfigService class to Linux and Mac OS X. 52 // TODO(port): Port the SSLConfigService class to Linux and Mac OS X.
49 SSLConfigService ssl_config_service_; 53 SSLConfigService ssl_config_service_;
50 #endif 54 #endif
51 }; 55 };
52 56
53 } // namespace net 57 } // namespace net
54 58
55 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ 59 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698