OLD | NEW |
1 // Copyright (c) 2006-2008 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/ssl_client_auth_cache.h" |
9 #include "net/base/ssl_config_service.h" | 10 #include "net/base/ssl_config_service.h" |
10 #include "net/base/tcp_client_socket_pool.h" | 11 #include "net/base/tcp_client_socket_pool.h" |
11 #include "net/http/http_auth_cache.h" | 12 #include "net/http/http_auth_cache.h" |
12 | 13 |
13 namespace net { | 14 namespace net { |
14 | 15 |
15 class ClientSocketFactory; | 16 class ClientSocketFactory; |
16 class HostResolver; | 17 class HostResolver; |
17 class ProxyService; | 18 class ProxyService; |
18 | 19 |
19 // This class holds session objects used by HttpNetworkTransaction objects. | 20 // This class holds session objects used by HttpNetworkTransaction objects. |
20 class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { | 21 class HttpNetworkSession : public base::RefCounted<HttpNetworkSession> { |
21 public: | 22 public: |
22 HttpNetworkSession(HostResolver* host_resolver, ProxyService* proxy_service, | 23 HttpNetworkSession(HostResolver* host_resolver, ProxyService* proxy_service, |
23 ClientSocketFactory* client_socket_factory) | 24 ClientSocketFactory* client_socket_factory) |
24 : connection_pool_(new TCPClientSocketPool( | 25 : connection_pool_(new TCPClientSocketPool( |
25 max_sockets_per_group_, host_resolver, client_socket_factory)), | 26 max_sockets_per_group_, host_resolver, client_socket_factory)), |
26 host_resolver_(host_resolver), | 27 host_resolver_(host_resolver), |
27 proxy_service_(proxy_service) { | 28 proxy_service_(proxy_service) { |
28 DCHECK(proxy_service); | 29 DCHECK(proxy_service); |
29 } | 30 } |
30 | 31 |
31 HttpAuthCache* auth_cache() { return &auth_cache_; } | 32 HttpAuthCache* auth_cache() { return &auth_cache_; } |
| 33 SSLClientAuthCache* ssl_client_auth_cache() { |
| 34 return &ssl_client_auth_cache_; |
| 35 } |
32 ClientSocketPool* connection_pool() { return connection_pool_; } | 36 ClientSocketPool* connection_pool() { return connection_pool_; } |
33 HostResolver* host_resolver() { return host_resolver_; } | 37 HostResolver* host_resolver() { return host_resolver_; } |
34 ProxyService* proxy_service() { return proxy_service_; } | 38 ProxyService* proxy_service() { return proxy_service_; } |
35 #if defined(OS_WIN) | 39 #if defined(OS_WIN) |
36 SSLConfigService* ssl_config_service() { return &ssl_config_service_; } | 40 SSLConfigService* ssl_config_service() { return &ssl_config_service_; } |
37 #endif | 41 #endif |
38 | 42 |
39 static void set_max_sockets_per_group(int socket_count); | 43 static void set_max_sockets_per_group(int socket_count); |
40 | 44 |
41 private: | 45 private: |
42 // Default to allow up to 6 connections per host. Experiment and tuning may | 46 // Default to allow up to 6 connections per host. Experiment and tuning may |
43 // try other values (greater than 0). Too large may cause many problems, such | 47 // try other values (greater than 0). Too large may cause many problems, such |
44 // as home routers blocking the connections!?!? | 48 // as home routers blocking the connections!?!? |
45 static int max_sockets_per_group_; | 49 static int max_sockets_per_group_; |
46 | 50 |
47 HttpAuthCache auth_cache_; | 51 HttpAuthCache auth_cache_; |
| 52 SSLClientAuthCache ssl_client_auth_cache_; |
48 scoped_refptr<ClientSocketPool> connection_pool_; | 53 scoped_refptr<ClientSocketPool> connection_pool_; |
49 HostResolver* host_resolver_; | 54 HostResolver* host_resolver_; |
50 ProxyService* proxy_service_; | 55 ProxyService* proxy_service_; |
51 #if defined(OS_WIN) | 56 #if defined(OS_WIN) |
52 // TODO(port): Port the SSLConfigService class to Linux and Mac OS X. | 57 // TODO(port): Port the SSLConfigService class to Linux and Mac OS X. |
53 SSLConfigService ssl_config_service_; | 58 SSLConfigService ssl_config_service_; |
54 #endif | 59 #endif |
55 }; | 60 }; |
56 | 61 |
57 } // namespace net | 62 } // namespace net |
58 | 63 |
59 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ | 64 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ |
OLD | NEW |