OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 class QuicServerInfoFactory; | 50 class QuicServerInfoFactory; |
51 class SocketPerformanceWatcherFactory; | 51 class SocketPerformanceWatcherFactory; |
52 class SOCKSClientSocketPool; | 52 class SOCKSClientSocketPool; |
53 class SSLClientSocketPool; | 53 class SSLClientSocketPool; |
54 class SSLConfigService; | 54 class SSLConfigService; |
55 class TransportClientSocketPool; | 55 class TransportClientSocketPool; |
56 class TransportSecurityState; | 56 class TransportSecurityState; |
57 | 57 |
58 // This class holds session objects used by HttpNetworkTransaction objects. | 58 // This class holds session objects used by HttpNetworkTransaction objects. |
59 class NET_EXPORT HttpNetworkSession | 59 class NET_EXPORT HttpNetworkSession |
60 : NON_EXPORTED_BASE(public base::NonThreadSafe) { | 60 : public base::RefCounted<HttpNetworkSession>, |
| 61 NON_EXPORTED_BASE(public base::NonThreadSafe) { |
61 public: | 62 public: |
62 struct NET_EXPORT Params { | 63 struct NET_EXPORT Params { |
63 Params(); | 64 Params(); |
64 ~Params(); | 65 ~Params(); |
65 | 66 |
66 ClientSocketFactory* client_socket_factory; | 67 ClientSocketFactory* client_socket_factory; |
67 HostResolver* host_resolver; | 68 HostResolver* host_resolver; |
68 CertVerifier* cert_verifier; | 69 CertVerifier* cert_verifier; |
69 CertPolicyEnforcer* cert_policy_enforcer; | 70 CertPolicyEnforcer* cert_policy_enforcer; |
70 ChannelIDService* channel_id_service; | 71 ChannelIDService* channel_id_service; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 ProxyDelegate* proxy_delegate; | 133 ProxyDelegate* proxy_delegate; |
133 }; | 134 }; |
134 | 135 |
135 enum SocketPoolType { | 136 enum SocketPoolType { |
136 NORMAL_SOCKET_POOL, | 137 NORMAL_SOCKET_POOL, |
137 WEBSOCKET_SOCKET_POOL, | 138 WEBSOCKET_SOCKET_POOL, |
138 NUM_SOCKET_POOL_TYPES | 139 NUM_SOCKET_POOL_TYPES |
139 }; | 140 }; |
140 | 141 |
141 explicit HttpNetworkSession(const Params& params); | 142 explicit HttpNetworkSession(const Params& params); |
142 ~HttpNetworkSession(); | |
143 | 143 |
144 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; } | 144 HttpAuthCache* http_auth_cache() { return &http_auth_cache_; } |
145 SSLClientAuthCache* ssl_client_auth_cache() { | 145 SSLClientAuthCache* ssl_client_auth_cache() { |
146 return &ssl_client_auth_cache_; | 146 return &ssl_client_auth_cache_; |
147 } | 147 } |
148 | 148 |
149 void AddResponseDrainer(HttpResponseBodyDrainer* drainer); | 149 void AddResponseDrainer(HttpResponseBodyDrainer* drainer); |
150 | 150 |
151 void RemoveResponseDrainer(HttpResponseBodyDrainer* drainer); | 151 void RemoveResponseDrainer(HttpResponseBodyDrainer* drainer); |
152 | 152 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool IsProtocolEnabled(AlternateProtocol protocol) const; | 205 bool IsProtocolEnabled(AlternateProtocol protocol) const; |
206 | 206 |
207 // Populates |*next_protos| with protocols. | 207 // Populates |*next_protos| with protocols. |
208 void GetNextProtos(NextProtoVector* next_protos) const; | 208 void GetNextProtos(NextProtoVector* next_protos) const; |
209 | 209 |
210 // Convenience function for searching through |params_| for | 210 // Convenience function for searching through |params_| for |
211 // |forced_spdy_exclusions|. | 211 // |forced_spdy_exclusions|. |
212 bool HasSpdyExclusion(HostPortPair host_port_pair) const; | 212 bool HasSpdyExclusion(HostPortPair host_port_pair) const; |
213 | 213 |
214 private: | 214 private: |
| 215 friend class base::RefCounted<HttpNetworkSession>; |
215 friend class HttpNetworkSessionPeer; | 216 friend class HttpNetworkSessionPeer; |
216 | 217 |
| 218 ~HttpNetworkSession(); |
| 219 |
217 ClientSocketPoolManager* GetSocketPoolManager(SocketPoolType pool_type); | 220 ClientSocketPoolManager* GetSocketPoolManager(SocketPoolType pool_type); |
218 | 221 |
219 NetLog* const net_log_; | 222 NetLog* const net_log_; |
220 NetworkDelegate* const network_delegate_; | 223 NetworkDelegate* const network_delegate_; |
221 const base::WeakPtr<HttpServerProperties> http_server_properties_; | 224 const base::WeakPtr<HttpServerProperties> http_server_properties_; |
222 CertVerifier* const cert_verifier_; | 225 CertVerifier* const cert_verifier_; |
223 HttpAuthHandlerFactory* const http_auth_handler_factory_; | 226 HttpAuthHandlerFactory* const http_auth_handler_factory_; |
224 | 227 |
225 // Not const since it's modified by HttpNetworkSessionPeer for testing. | 228 // Not const since it's modified by HttpNetworkSessionPeer for testing. |
226 ProxyService* proxy_service_; | 229 ProxyService* proxy_service_; |
(...skipping 11 matching lines...) Expand all Loading... |
238 | 241 |
239 NextProtoVector next_protos_; | 242 NextProtoVector next_protos_; |
240 bool enabled_protocols_[NUM_VALID_ALTERNATE_PROTOCOLS]; | 243 bool enabled_protocols_[NUM_VALID_ALTERNATE_PROTOCOLS]; |
241 | 244 |
242 Params params_; | 245 Params params_; |
243 }; | 246 }; |
244 | 247 |
245 } // namespace net | 248 } // namespace net |
246 | 249 |
247 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ | 250 #endif // NET_HTTP_HTTP_NETWORK_SESSION_H_ |
OLD | NEW |