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