| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <set> | 9 #include <set> |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 | 28 |
| 29 class CertVerifier; | 29 class CertVerifier; |
| 30 class ClientSocketFactory; | 30 class ClientSocketFactory; |
| 31 class DnsCertProvenanceChecker; | 31 class DnsCertProvenanceChecker; |
| 32 class DnsRRResolver; | 32 class DnsRRResolver; |
| 33 class HostResolver; | 33 class HostResolver; |
| 34 class HttpAuthHandlerFactory; | 34 class HttpAuthHandlerFactory; |
| 35 class HttpNetworkSessionPeer; | 35 class HttpNetworkSessionPeer; |
| 36 class HttpProxyClientSocketPool; | 36 class HttpProxyClientSocketPool; |
| 37 class HttpResponseBodyDrainer; | 37 class HttpResponseBodyDrainer; |
| 38 class HttpServerProperties; |
| 38 class NetLog; | 39 class NetLog; |
| 39 class NetworkDelegate; | 40 class NetworkDelegate; |
| 40 class ProxyService; | 41 class ProxyService; |
| 41 class SSLConfigService; | 42 class SSLConfigService; |
| 42 class SSLHostInfoFactory; | 43 class SSLHostInfoFactory; |
| 43 | 44 |
| 44 // This class holds session objects used by HttpNetworkTransaction objects. | 45 // This class holds session objects used by HttpNetworkTransaction objects. |
| 45 class NET_EXPORT HttpNetworkSession | 46 class NET_EXPORT HttpNetworkSession |
| 46 : public base::RefCounted<HttpNetworkSession>, | 47 : public base::RefCounted<HttpNetworkSession>, |
| 47 NON_EXPORTED_BASE(public base::NonThreadSafe) { | 48 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
| 48 public: | 49 public: |
| 49 struct NET_EXPORT Params { | 50 struct NET_EXPORT Params { |
| 50 Params() | 51 Params() |
| 51 : client_socket_factory(NULL), | 52 : client_socket_factory(NULL), |
| 52 host_resolver(NULL), | 53 host_resolver(NULL), |
| 53 cert_verifier(NULL), | 54 cert_verifier(NULL), |
| 54 origin_bound_cert_service(NULL), | 55 origin_bound_cert_service(NULL), |
| 55 dnsrr_resolver(NULL), | 56 dnsrr_resolver(NULL), |
| 56 dns_cert_checker(NULL), | 57 dns_cert_checker(NULL), |
| 57 proxy_service(NULL), | 58 proxy_service(NULL), |
| 58 ssl_host_info_factory(NULL), | 59 ssl_host_info_factory(NULL), |
| 59 ssl_config_service(NULL), | 60 ssl_config_service(NULL), |
| 60 http_auth_handler_factory(NULL), | 61 http_auth_handler_factory(NULL), |
| 61 network_delegate(NULL), | 62 network_delegate(NULL), |
| 63 http_server_properties(NULL), |
| 62 net_log(NULL) {} | 64 net_log(NULL) {} |
| 63 | 65 |
| 64 ClientSocketFactory* client_socket_factory; | 66 ClientSocketFactory* client_socket_factory; |
| 65 HostResolver* host_resolver; | 67 HostResolver* host_resolver; |
| 66 CertVerifier* cert_verifier; | 68 CertVerifier* cert_verifier; |
| 67 OriginBoundCertService* origin_bound_cert_service; | 69 OriginBoundCertService* origin_bound_cert_service; |
| 68 DnsRRResolver* dnsrr_resolver; | 70 DnsRRResolver* dnsrr_resolver; |
| 69 DnsCertProvenanceChecker* dns_cert_checker; | 71 DnsCertProvenanceChecker* dns_cert_checker; |
| 70 ProxyService* proxy_service; | 72 ProxyService* proxy_service; |
| 71 SSLHostInfoFactory* ssl_host_info_factory; | 73 SSLHostInfoFactory* ssl_host_info_factory; |
| 72 SSLConfigService* ssl_config_service; | 74 SSLConfigService* ssl_config_service; |
| 73 HttpAuthHandlerFactory* http_auth_handler_factory; | 75 HttpAuthHandlerFactory* http_auth_handler_factory; |
| 74 NetworkDelegate* network_delegate; | 76 NetworkDelegate* network_delegate; |
| 77 HttpServerProperties* http_server_properties; |
| 75 NetLog* net_log; | 78 NetLog* net_log; |
| 76 }; | 79 }; |
| 77 | 80 |
| 78 explicit HttpNetworkSession(const Params& params); | 81 explicit HttpNetworkSession(const Params& params); |
| 79 | 82 |
| 80 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; } | 83 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; } |
| 81 SSLClientAuthCache* ssl_client_auth_cache() { | 84 SSLClientAuthCache* ssl_client_auth_cache() { |
| 82 return &ssl_client_auth_cache_; | 85 return &ssl_client_auth_cache_; |
| 83 } | 86 } |
| 84 | 87 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 113 CertVerifier* cert_verifier() { return cert_verifier_; } | 116 CertVerifier* cert_verifier() { return cert_verifier_; } |
| 114 ProxyService* proxy_service() { return proxy_service_; } | 117 ProxyService* proxy_service() { return proxy_service_; } |
| 115 SSLConfigService* ssl_config_service() { return ssl_config_service_; } | 118 SSLConfigService* ssl_config_service() { return ssl_config_service_; } |
| 116 SpdySessionPool* spdy_session_pool() { return &spdy_session_pool_; } | 119 SpdySessionPool* spdy_session_pool() { return &spdy_session_pool_; } |
| 117 HttpAuthHandlerFactory* http_auth_handler_factory() { | 120 HttpAuthHandlerFactory* http_auth_handler_factory() { |
| 118 return http_auth_handler_factory_; | 121 return http_auth_handler_factory_; |
| 119 } | 122 } |
| 120 NetworkDelegate* network_delegate() { | 123 NetworkDelegate* network_delegate() { |
| 121 return network_delegate_; | 124 return network_delegate_; |
| 122 } | 125 } |
| 126 HttpServerProperties* http_server_properties() { |
| 127 return http_server_properties_; |
| 128 } |
| 123 | 129 |
| 124 HttpStreamFactory* http_stream_factory() { | 130 HttpStreamFactory* http_stream_factory() { |
| 125 return http_stream_factory_.get(); | 131 return http_stream_factory_.get(); |
| 126 } | 132 } |
| 127 | 133 |
| 128 NetLog* net_log() { | 134 NetLog* net_log() { |
| 129 return net_log_; | 135 return net_log_; |
| 130 } | 136 } |
| 131 | 137 |
| 132 // Creates a Value summary of the state of the socket pools. The caller is | 138 // Creates a Value summary of the state of the socket pools. The caller is |
| 133 // responsible for deleting the returned value. | 139 // responsible for deleting the returned value. |
| 134 base::Value* SocketPoolInfoToValue() const; | 140 base::Value* SocketPoolInfoToValue() const; |
| 135 | 141 |
| 136 // Creates a Value summary of the state of the SPDY sessions. The caller is | 142 // Creates a Value summary of the state of the SPDY sessions. The caller is |
| 137 // responsible for deleting the returned value. | 143 // responsible for deleting the returned value. |
| 138 base::Value* SpdySessionPoolInfoToValue() const; | 144 base::Value* SpdySessionPoolInfoToValue() const; |
| 139 | 145 |
| 140 void CloseAllConnections(); | 146 void CloseAllConnections(); |
| 141 void CloseIdleConnections(); | 147 void CloseIdleConnections(); |
| 142 | 148 |
| 143 private: | 149 private: |
| 144 friend class base::RefCounted<HttpNetworkSession>; | 150 friend class base::RefCounted<HttpNetworkSession>; |
| 145 friend class HttpNetworkSessionPeer; | 151 friend class HttpNetworkSessionPeer; |
| 146 | 152 |
| 147 ~HttpNetworkSession(); | 153 ~HttpNetworkSession(); |
| 148 | 154 |
| 149 NetLog* const net_log_; | 155 NetLog* const net_log_; |
| 150 NetworkDelegate* const network_delegate_; | 156 NetworkDelegate* const network_delegate_; |
| 157 HttpServerProperties* const http_server_properties_; |
| 151 CertVerifier* const cert_verifier_; | 158 CertVerifier* const cert_verifier_; |
| 152 HttpAuthHandlerFactory* const http_auth_handler_factory_; | 159 HttpAuthHandlerFactory* const http_auth_handler_factory_; |
| 153 | 160 |
| 154 // Not const since it's modified by HttpNetworkSessionPeer for testing. | 161 // Not const since it's modified by HttpNetworkSessionPeer for testing. |
| 155 ProxyService* proxy_service_; | 162 ProxyService* proxy_service_; |
| 156 const scoped_refptr<SSLConfigService> ssl_config_service_; | 163 const scoped_refptr<SSLConfigService> ssl_config_service_; |
| 157 | 164 |
| 158 HttpAuthCache http_auth_cache_; | 165 HttpAuthCache http_auth_cache_; |
| 159 SSLClientAuthCache ssl_client_auth_cache_; | 166 SSLClientAuthCache ssl_client_auth_cache_; |
| 160 HttpAlternateProtocols alternate_protocols_; | 167 HttpAlternateProtocols alternate_protocols_; |
| 161 ClientSocketPoolManager socket_pool_manager_; | 168 ClientSocketPoolManager socket_pool_manager_; |
| 162 SpdySessionPool spdy_session_pool_; | 169 SpdySessionPool spdy_session_pool_; |
| 163 scoped_ptr<HttpStreamFactory> http_stream_factory_; | 170 scoped_ptr<HttpStreamFactory> http_stream_factory_; |
| 164 std::set<HttpResponseBodyDrainer*> response_drainers_; | 171 std::set<HttpResponseBodyDrainer*> response_drainers_; |
| 165 }; | 172 }; |
| 166 | 173 |
| 167 } // namespace net | 174 } // namespace net |
| 168 | 175 |
| 169 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ | 176 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ |
| OLD | NEW |