| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "net/http/http_network_session.h" | 5 #include "net/http/http_network_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/stl_util-inl.h" | 10 #include "base/stl_util-inl.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/values.h" | 12 #include "base/values.h" |
| 13 #include "net/http/http_auth_handler_factory.h" | 13 #include "net/http/http_auth_handler_factory.h" |
| 14 #include "net/http/http_response_body_drainer.h" | 14 #include "net/http/http_response_body_drainer.h" |
| 15 #include "net/http/url_security_manager.h" | 15 #include "net/http/url_security_manager.h" |
| 16 #include "net/spdy/spdy_session_pool.h" | 16 #include "net/spdy/spdy_session_pool.h" |
| 17 | 17 |
| 18 namespace net { | 18 namespace net { |
| 19 | 19 |
| 20 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. | 20 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. |
| 21 HttpNetworkSession::HttpNetworkSession( | 21 HttpNetworkSession::HttpNetworkSession( |
| 22 HostResolver* host_resolver, | 22 HostResolver* host_resolver, |
| 23 DnsRRResolver* dnsrr_resolver, |
| 23 ProxyService* proxy_service, | 24 ProxyService* proxy_service, |
| 24 ClientSocketFactory* client_socket_factory, | 25 ClientSocketFactory* client_socket_factory, |
| 25 SSLConfigService* ssl_config_service, | 26 SSLConfigService* ssl_config_service, |
| 26 SpdySessionPool* spdy_session_pool, | 27 SpdySessionPool* spdy_session_pool, |
| 27 HttpAuthHandlerFactory* http_auth_handler_factory, | 28 HttpAuthHandlerFactory* http_auth_handler_factory, |
| 28 HttpNetworkDelegate* network_delegate, | 29 HttpNetworkDelegate* network_delegate, |
| 29 NetLog* net_log) | 30 NetLog* net_log) |
| 30 : socket_factory_(client_socket_factory), | 31 : socket_factory_(client_socket_factory), |
| 31 host_resolver_(host_resolver), | 32 host_resolver_(host_resolver), |
| 33 dnsrr_resolver_(dnsrr_resolver), |
| 32 proxy_service_(proxy_service), | 34 proxy_service_(proxy_service), |
| 33 ssl_config_service_(ssl_config_service), | 35 ssl_config_service_(ssl_config_service), |
| 34 socket_pool_manager_(net_log, | 36 socket_pool_manager_(net_log, |
| 35 client_socket_factory, | 37 client_socket_factory, |
| 36 host_resolver, | 38 host_resolver, |
| 39 dnsrr_resolver, |
| 37 proxy_service, | 40 proxy_service, |
| 38 ssl_config_service), | 41 ssl_config_service), |
| 39 spdy_session_pool_(spdy_session_pool), | 42 spdy_session_pool_(spdy_session_pool), |
| 40 http_stream_factory_(new HttpStreamFactory()), | 43 http_stream_factory_(new HttpStreamFactory()), |
| 41 http_auth_handler_factory_(http_auth_handler_factory), | 44 http_auth_handler_factory_(http_auth_handler_factory), |
| 42 network_delegate_(network_delegate), | 45 network_delegate_(network_delegate), |
| 43 net_log_(net_log) { | 46 net_log_(net_log) { |
| 44 DCHECK(proxy_service); | 47 DCHECK(proxy_service); |
| 45 DCHECK(ssl_config_service); | 48 DCHECK(ssl_config_service); |
| 46 } | 49 } |
| 47 | 50 |
| 48 HttpNetworkSession::~HttpNetworkSession() { | 51 HttpNetworkSession::~HttpNetworkSession() { |
| 49 STLDeleteElements(&response_drainers_); | 52 STLDeleteElements(&response_drainers_); |
| 50 spdy_session_pool_->CloseAllSessions(); | 53 spdy_session_pool_->CloseAllSessions(); |
| 51 } | 54 } |
| 52 | 55 |
| 53 void HttpNetworkSession::AddResponseDrainer(HttpResponseBodyDrainer* drainer) { | 56 void HttpNetworkSession::AddResponseDrainer(HttpResponseBodyDrainer* drainer) { |
| 54 DCHECK(!ContainsKey(response_drainers_, drainer)); | 57 DCHECK(!ContainsKey(response_drainers_, drainer)); |
| 55 response_drainers_.insert(drainer); | 58 response_drainers_.insert(drainer); |
| 56 } | 59 } |
| 57 | 60 |
| 58 void HttpNetworkSession::RemoveResponseDrainer( | 61 void HttpNetworkSession::RemoveResponseDrainer( |
| 59 HttpResponseBodyDrainer* drainer) { | 62 HttpResponseBodyDrainer* drainer) { |
| 60 DCHECK(ContainsKey(response_drainers_, drainer)); | 63 DCHECK(ContainsKey(response_drainers_, drainer)); |
| 61 response_drainers_.erase(drainer); | 64 response_drainers_.erase(drainer); |
| 62 } | 65 } |
| 63 | 66 |
| 64 } // namespace net | 67 } // namespace net |
| OLD | NEW |