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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
91 | 91 |
92 TransportClientSocketPool* transport_socket_pool() { | 92 TransportClientSocketPool* transport_socket_pool() { |
93 return socket_pool_manager_.transport_socket_pool(); | 93 return socket_pool_manager_.transport_socket_pool(); |
94 } | 94 } |
95 | 95 |
96 SSLClientSocketPool* ssl_socket_pool() { | 96 SSLClientSocketPool* ssl_socket_pool() { |
97 return socket_pool_manager_.ssl_socket_pool(); | 97 return socket_pool_manager_.ssl_socket_pool(); |
98 } | 98 } |
99 | 99 |
100 SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy( | 100 SOCKSClientSocketPool* GetSocketPoolForSOCKSProxy( |
101 const HostPortPair& socks_proxy) { | 101 const HostPortPair& socks_proxy); |
102 return socket_pool_manager_.GetSocketPoolForSOCKSProxy(socks_proxy); | |
103 } | |
104 | 102 |
105 HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy( | 103 HttpProxyClientSocketPool* GetSocketPoolForHTTPProxy( |
106 const HostPortPair& http_proxy) { | 104 const HostPortPair& http_proxy); |
107 return socket_pool_manager_.GetSocketPoolForHTTPProxy(http_proxy); | |
108 } | |
109 | 105 |
110 SSLClientSocketPool* GetSocketPoolForSSLWithProxy( | 106 SSLClientSocketPool* GetSocketPoolForSSLWithProxy( |
111 const HostPortPair& proxy_server) { | 107 const HostPortPair& proxy_server); |
112 return socket_pool_manager_.GetSocketPoolForSSLWithProxy(proxy_server); | |
113 } | |
114 | 108 |
115 CertVerifier* cert_verifier() { return cert_verifier_; } | 109 CertVerifier* cert_verifier() { return cert_verifier_; } |
116 ProxyService* proxy_service() { return proxy_service_; } | 110 ProxyService* proxy_service() { return proxy_service_; } |
117 SSLConfigService* ssl_config_service() { return ssl_config_service_; } | 111 SSLConfigService* ssl_config_service() { return ssl_config_service_; } |
118 SpdySessionPool* spdy_session_pool() { return &spdy_session_pool_; } | 112 SpdySessionPool* spdy_session_pool() { return &spdy_session_pool_; } |
119 HttpAuthHandlerFactory* http_auth_handler_factory() { | 113 HttpAuthHandlerFactory* http_auth_handler_factory() { |
120 return http_auth_handler_factory_; | 114 return http_auth_handler_factory_; |
121 } | 115 } |
122 NetworkDelegate* network_delegate() { | 116 NetworkDelegate* network_delegate() { |
123 return network_delegate_; | 117 return network_delegate_; |
124 } | 118 } |
125 | 119 |
126 HttpStreamFactory* http_stream_factory() { | 120 HttpStreamFactory* http_stream_factory() { |
127 return http_stream_factory_.get(); | 121 return http_stream_factory_.get(); |
128 } | 122 } |
129 | 123 |
130 NetLog* net_log() { | 124 NetLog* net_log() { |
131 return net_log_; | 125 return net_log_; |
132 } | 126 } |
133 | 127 |
134 // Creates a Value summary of the state of the socket pools. The caller is | 128 // Creates a Value summary of the state of the socket pools. The caller is |
135 // responsible for deleting the returned value. | 129 // responsible for deleting the returned value. |
136 Value* SocketPoolInfoToValue() const { | 130 Value* SocketPoolInfoToValue() const; |
137 return socket_pool_manager_.SocketPoolInfoToValue(); | |
138 } | |
139 | 131 |
140 // Creates a Value summary of the state of the SPDY sessions. The caller is | 132 // Creates a Value summary of the state of the SPDY sessions. The caller is |
141 // responsible for deleting the returned value. | 133 // responsible for deleting the returned value. |
142 Value* SpdySessionPoolInfoToValue() const; | 134 Value* SpdySessionPoolInfoToValue() const; |
143 | 135 |
144 void CloseAllConnections() { | 136 void CloseAllConnections(); |
145 socket_pool_manager_.FlushSocketPools(); | 137 void CloseIdleConnections(); |
146 spdy_session_pool_.CloseCurrentSessions(); | |
147 } | |
148 | |
149 void CloseIdleConnections() { | |
150 socket_pool_manager_.CloseIdleSockets(); | |
151 } | |
152 | |
153 | 138 |
154 private: | 139 private: |
155 friend class base::RefCounted<HttpNetworkSession>; | 140 friend class base::RefCounted<HttpNetworkSession>; |
156 friend class HttpNetworkSessionPeer; | 141 friend class HttpNetworkSessionPeer; |
157 | 142 |
158 ~HttpNetworkSession(); | 143 ~HttpNetworkSession(); |
159 | 144 |
160 NetLog* const net_log_; | 145 NetLog* const net_log_; |
161 NetworkDelegate* const network_delegate_; | 146 NetworkDelegate* const network_delegate_; |
162 CertVerifier* const cert_verifier_; | 147 CertVerifier* const cert_verifier_; |
163 HttpAuthHandlerFactory* const http_auth_handler_factory_; | 148 HttpAuthHandlerFactory* const http_auth_handler_factory_; |
164 | 149 |
165 // Not const since it's modified by HttpNetworkSessionPeer for testing. | 150 // Not const since it's modified by HttpNetworkSessionPeer for testing. |
166 ProxyService* proxy_service_; | 151 ProxyService* proxy_service_; |
167 const scoped_refptr<SSLConfigService> ssl_config_service_; | 152 const scoped_refptr<SSLConfigService> ssl_config_service_; |
168 | 153 |
169 HttpAuthCache http_auth_cache_; | 154 HttpAuthCache http_auth_cache_; |
170 SSLClientAuthCache ssl_client_auth_cache_; | 155 SSLClientAuthCache ssl_client_auth_cache_; |
171 HttpAlternateProtocols alternate_protocols_; | 156 HttpAlternateProtocols alternate_protocols_; |
172 ClientSocketPoolManager socket_pool_manager_; | 157 ClientSocketPoolManager socket_pool_manager_; |
173 SpdySessionPool spdy_session_pool_; | 158 SpdySessionPool spdy_session_pool_; |
174 scoped_ptr<HttpStreamFactory> http_stream_factory_; | 159 scoped_ptr<HttpStreamFactory> http_stream_factory_; |
175 std::set<HttpResponseBodyDrainer*> response_drainers_; | 160 std::set<HttpResponseBodyDrainer*> response_drainers_; |
176 }; | 161 }; |
177 | 162 |
178 } // namespace net | 163 } // namespace net |
179 | 164 |
180 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ | 165 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ |
OLD | NEW |