| 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 #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/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "net/http/http_auth_handler_factory.h" | 14 #include "net/http/http_auth_handler_factory.h" |
| 15 #include "net/http/http_response_body_drainer.h" | 15 #include "net/http/http_response_body_drainer.h" |
| 16 #include "net/http/http_stream_factory_impl.h" | 16 #include "net/http/http_stream_factory_impl.h" |
| 17 #include "net/http/url_security_manager.h" | 17 #include "net/http/url_security_manager.h" |
| 18 #include "net/proxy/proxy_service.h" | 18 #include "net/proxy/proxy_service.h" |
| 19 #include "net/socket/client_socket_factory.h" | 19 #include "net/socket/client_socket_factory.h" |
| 20 #include "net/socket/client_socket_pool_manager_impl.h" | 20 #include "net/socket/client_socket_pool_manager_impl.h" |
| 21 #include "net/socket/next_proto.h" |
| 21 #include "net/spdy/spdy_session_pool.h" | 22 #include "net/spdy/spdy_session_pool.h" |
| 22 | 23 |
| 23 namespace { | 24 namespace { |
| 24 | 25 |
| 25 net::ClientSocketPoolManager* CreateSocketPoolManager( | 26 net::ClientSocketPoolManager* CreateSocketPoolManager( |
| 26 net::HttpNetworkSession::SocketPoolType pool_type, | 27 net::HttpNetworkSession::SocketPoolType pool_type, |
| 27 const net::HttpNetworkSession::Params& params) { | 28 const net::HttpNetworkSession::Params& params) { |
| 28 // TODO(yutak): Differentiate WebSocket pool manager and allow more | 29 // TODO(yutak): Differentiate WebSocket pool manager and allow more |
| 29 // simultaneous connections for WebSockets. | 30 // simultaneous connections for WebSockets. |
| 30 return new net::ClientSocketPoolManagerImpl( | 31 return new net::ClientSocketPoolManagerImpl( |
| (...skipping 25 matching lines...) Expand all Loading... |
| 56 ssl_config_service(NULL), | 57 ssl_config_service(NULL), |
| 57 http_auth_handler_factory(NULL), | 58 http_auth_handler_factory(NULL), |
| 58 network_delegate(NULL), | 59 network_delegate(NULL), |
| 59 http_server_properties(NULL), | 60 http_server_properties(NULL), |
| 60 net_log(NULL), | 61 net_log(NULL), |
| 61 host_mapping_rules(NULL), | 62 host_mapping_rules(NULL), |
| 62 force_http_pipelining(false), | 63 force_http_pipelining(false), |
| 63 ignore_certificate_errors(false), | 64 ignore_certificate_errors(false), |
| 64 http_pipelining_enabled(false), | 65 http_pipelining_enabled(false), |
| 65 testing_fixed_http_port(0), | 66 testing_fixed_http_port(0), |
| 66 testing_fixed_https_port(0) {} | 67 testing_fixed_https_port(0), |
| 68 max_spdy_sessions_per_domain(0), |
| 69 force_spdy_single_domain(false), |
| 70 enable_spdy_ip_pooling(true), |
| 71 enable_spdy_credential_frames(false), |
| 72 enable_spdy_compression(true), |
| 73 enable_spdy_ping_based_connection_checking(true), |
| 74 spdy_default_protocol(kProtoUnknown), |
| 75 spdy_initial_recv_window_size(0), |
| 76 spdy_initial_max_concurrent_streams(0), |
| 77 spdy_max_concurrent_streams_limit(0), |
| 78 time_func(&base::TimeTicks::Now) { |
| 79 } |
| 67 | 80 |
| 68 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. | 81 // TODO(mbelshe): Move the socket factories into HttpStreamFactory. |
| 69 HttpNetworkSession::HttpNetworkSession(const Params& params) | 82 HttpNetworkSession::HttpNetworkSession(const Params& params) |
| 70 : net_log_(params.net_log), | 83 : net_log_(params.net_log), |
| 71 network_delegate_(params.network_delegate), | 84 network_delegate_(params.network_delegate), |
| 72 http_server_properties_(params.http_server_properties), | 85 http_server_properties_(params.http_server_properties), |
| 73 cert_verifier_(params.cert_verifier), | 86 cert_verifier_(params.cert_verifier), |
| 74 http_auth_handler_factory_(params.http_auth_handler_factory), | 87 http_auth_handler_factory_(params.http_auth_handler_factory), |
| 75 force_http_pipelining_(params.force_http_pipelining), | 88 force_http_pipelining_(params.force_http_pipelining), |
| 76 proxy_service_(params.proxy_service), | 89 proxy_service_(params.proxy_service), |
| 77 ssl_config_service_(params.ssl_config_service), | 90 ssl_config_service_(params.ssl_config_service), |
| 78 normal_socket_pool_manager_( | 91 normal_socket_pool_manager_( |
| 79 CreateSocketPoolManager(NORMAL_SOCKET_POOL, params)), | 92 CreateSocketPoolManager(NORMAL_SOCKET_POOL, params)), |
| 80 websocket_socket_pool_manager_( | 93 websocket_socket_pool_manager_( |
| 81 CreateSocketPoolManager(WEBSOCKET_SOCKET_POOL, params)), | 94 CreateSocketPoolManager(WEBSOCKET_SOCKET_POOL, params)), |
| 82 spdy_session_pool_(params.host_resolver, | 95 spdy_session_pool_(params.host_resolver, |
| 83 params.ssl_config_service, | 96 params.ssl_config_service, |
| 84 params.http_server_properties, | 97 params.http_server_properties, |
| 98 params.max_spdy_sessions_per_domain, |
| 99 params.force_spdy_single_domain, |
| 100 params.enable_spdy_ip_pooling, |
| 101 params.enable_spdy_credential_frames, |
| 102 params.enable_spdy_compression, |
| 103 params.enable_spdy_ping_based_connection_checking, |
| 104 params.spdy_default_protocol, |
| 105 params.spdy_initial_recv_window_size, |
| 106 params.spdy_initial_max_concurrent_streams, |
| 107 params.spdy_max_concurrent_streams_limit, |
| 108 params.time_func, |
| 85 params.trusted_spdy_proxy), | 109 params.trusted_spdy_proxy), |
| 86 ALLOW_THIS_IN_INITIALIZER_LIST(http_stream_factory_( | 110 ALLOW_THIS_IN_INITIALIZER_LIST(http_stream_factory_( |
| 87 new HttpStreamFactoryImpl(this))), | 111 new HttpStreamFactoryImpl(this))), |
| 88 params_(params) { | 112 params_(params) { |
| 89 DCHECK(proxy_service_); | 113 DCHECK(proxy_service_); |
| 90 DCHECK(ssl_config_service_); | 114 DCHECK(ssl_config_service_); |
| 91 CHECK(http_server_properties_); | 115 CHECK(http_server_properties_); |
| 92 } | 116 } |
| 93 | 117 |
| 94 HttpNetworkSession::~HttpNetworkSession() { | 118 HttpNetworkSession::~HttpNetworkSession() { |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 166 case WEBSOCKET_SOCKET_POOL: | 190 case WEBSOCKET_SOCKET_POOL: |
| 167 return websocket_socket_pool_manager_.get(); | 191 return websocket_socket_pool_manager_.get(); |
| 168 default: | 192 default: |
| 169 NOTREACHED(); | 193 NOTREACHED(); |
| 170 break; | 194 break; |
| 171 } | 195 } |
| 172 return NULL; | 196 return NULL; |
| 173 } | 197 } |
| 174 | 198 |
| 175 } // namespace net | 199 } // namespace net |
| OLD | NEW |