OLD | NEW |
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2009 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/host_resolver.h" | 9 #include "net/base/host_resolver.h" |
10 #include "net/base/ssl_client_auth_cache.h" | 10 #include "net/base/ssl_client_auth_cache.h" |
11 #include "net/base/ssl_config_service.h" | 11 #include "net/base/ssl_config_service.h" |
12 #include "net/http/http_auth_cache.h" | 12 #include "net/http/http_auth_cache.h" |
13 #include "net/proxy/proxy_service.h" | 13 #include "net/proxy/proxy_service.h" |
14 #include "net/socket/tcp_client_socket_pool.h" | 14 #include "net/socket/tcp_client_socket_pool.h" |
15 | 15 |
16 namespace net { | 16 namespace net { |
17 | 17 |
18 class ClientSocketFactory; | 18 class ClientSocketFactory; |
19 class FlipSessionPool; | 19 class FlipSessionPool; |
20 | 20 |
21 // This class holds session objects used by HttpNetworkTransaction objects. | 21 // This class holds session objects used by HttpNetworkTransaction objects. |
22 class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { | 22 class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { |
23 public: | 23 public: |
24 HttpNetworkSession(HostResolver* host_resolver, ProxyService* proxy_service, | 24 HttpNetworkSession(HostResolver* host_resolver, ProxyService* proxy_service, |
25 ClientSocketFactory* client_socket_factory, | 25 ClientSocketFactory* client_socket_factory, |
26 SSLConfigService* ssl_config_service, | 26 SSLConfigService* ssl_config_service, |
27 FlipSessionPool* flip_session_pool); | 27 FlipSessionPool* flip_session_pool); |
28 ~HttpNetworkSession(); | |
29 | 28 |
30 HttpAuthCache* auth_cache() { return &auth_cache_; } | 29 HttpAuthCache* auth_cache() { return &auth_cache_; } |
31 SSLClientAuthCache* ssl_client_auth_cache() { | 30 SSLClientAuthCache* ssl_client_auth_cache() { |
32 return &ssl_client_auth_cache_; | 31 return &ssl_client_auth_cache_; |
33 } | 32 } |
34 | 33 |
35 // TCP sockets come from the tcp_socket_pool(). | 34 // TCP sockets come from the tcp_socket_pool(). |
36 TCPClientSocketPool* tcp_socket_pool() { return tcp_socket_pool_; } | 35 TCPClientSocketPool* tcp_socket_pool() { return tcp_socket_pool_; } |
37 // SSL sockets come frmo the socket_factory(). | 36 // SSL sockets come frmo the socket_factory(). |
38 ClientSocketFactory* socket_factory() { return socket_factory_; } | 37 ClientSocketFactory* socket_factory() { return socket_factory_; } |
39 HostResolver* host_resolver() { return host_resolver_; } | 38 HostResolver* host_resolver() { return host_resolver_; } |
40 ProxyService* proxy_service() { return proxy_service_; } | 39 ProxyService* proxy_service() { return proxy_service_; } |
41 SSLConfigService* ssl_config_service() { return ssl_config_service_; } | 40 SSLConfigService* ssl_config_service() { return ssl_config_service_; } |
42 FlipSessionPool* flip_session_pool() { return flip_session_pool_; } | 41 FlipSessionPool* flip_session_pool() { return flip_session_pool_; } |
43 | 42 |
44 static void set_max_sockets_per_group(int socket_count); | 43 static void set_max_sockets_per_group(int socket_count); |
45 | 44 |
46 private: | 45 private: |
| 46 friend class base::RefCounted<HttpNetworkSession>; |
47 FRIEND_TEST(HttpNetworkTransactionTest, GroupNameForProxyConnections); | 47 FRIEND_TEST(HttpNetworkTransactionTest, GroupNameForProxyConnections); |
48 | 48 |
| 49 ~HttpNetworkSession(); |
| 50 |
49 // Total limit of sockets. Not a constant to allow experiments. | 51 // Total limit of sockets. Not a constant to allow experiments. |
50 static int max_sockets_; | 52 static int max_sockets_; |
51 | 53 |
52 // Default to allow up to 6 connections per host. Experiment and tuning may | 54 // Default to allow up to 6 connections per host. Experiment and tuning may |
53 // try other values (greater than 0). Too large may cause many problems, such | 55 // try other values (greater than 0). Too large may cause many problems, such |
54 // as home routers blocking the connections!?!? | 56 // as home routers blocking the connections!?!? |
55 static int max_sockets_per_group_; | 57 static int max_sockets_per_group_; |
56 | 58 |
57 HttpAuthCache auth_cache_; | 59 HttpAuthCache auth_cache_; |
58 SSLClientAuthCache ssl_client_auth_cache_; | 60 SSLClientAuthCache ssl_client_auth_cache_; |
59 scoped_refptr<TCPClientSocketPool> tcp_socket_pool_; | 61 scoped_refptr<TCPClientSocketPool> tcp_socket_pool_; |
60 ClientSocketFactory* socket_factory_; | 62 ClientSocketFactory* socket_factory_; |
61 scoped_refptr<HostResolver> host_resolver_; | 63 scoped_refptr<HostResolver> host_resolver_; |
62 scoped_refptr<ProxyService> proxy_service_; | 64 scoped_refptr<ProxyService> proxy_service_; |
63 scoped_refptr<SSLConfigService> ssl_config_service_; | 65 scoped_refptr<SSLConfigService> ssl_config_service_; |
64 scoped_refptr<FlipSessionPool> flip_session_pool_; | 66 scoped_refptr<FlipSessionPool> flip_session_pool_; |
65 }; | 67 }; |
66 | 68 |
67 } // namespace net | 69 } // namespace net |
68 | 70 |
69 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ | 71 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ |
OLD | NEW |