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_stream_factory_impl.h" | 5 #include "net/http/http_stream_factory_impl.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <tuple> | 8 #include <tuple> |
9 | 9 |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 DefaultJobFactory() {} | 39 DefaultJobFactory() {} |
40 | 40 |
41 ~DefaultJobFactory() override {} | 41 ~DefaultJobFactory() override {} |
42 | 42 |
43 HttpStreamFactoryImpl::Job* CreateJob( | 43 HttpStreamFactoryImpl::Job* CreateJob( |
44 HttpStreamFactoryImpl::Job::Delegate* delegate, | 44 HttpStreamFactoryImpl::Job::Delegate* delegate, |
45 HttpStreamFactoryImpl::JobType job_type, | 45 HttpStreamFactoryImpl::JobType job_type, |
46 HttpNetworkSession* session, | 46 HttpNetworkSession* session, |
47 const HttpRequestInfo& request_info, | 47 const HttpRequestInfo& request_info, |
48 RequestPriority priority, | 48 RequestPriority priority, |
| 49 ProxyInfo proxy_info, |
49 const SSLConfig& server_ssl_config, | 50 const SSLConfig& server_ssl_config, |
50 const SSLConfig& proxy_ssl_config, | 51 const SSLConfig& proxy_ssl_config, |
51 HostPortPair destination, | 52 HostPortPair destination, |
52 GURL origin_url, | 53 GURL origin_url, |
53 bool enable_ip_based_pooling, | 54 bool enable_ip_based_pooling, |
54 NetLog* net_log) override { | 55 NetLog* net_log) override { |
55 return new HttpStreamFactoryImpl::Job( | 56 return new HttpStreamFactoryImpl::Job( |
56 delegate, job_type, session, request_info, priority, server_ssl_config, | 57 delegate, job_type, session, request_info, priority, proxy_info, |
57 proxy_ssl_config, destination, origin_url, enable_ip_based_pooling, | 58 server_ssl_config, proxy_ssl_config, destination, origin_url, |
58 net_log); | 59 enable_ip_based_pooling, net_log); |
59 } | 60 } |
60 | 61 |
61 HttpStreamFactoryImpl::Job* CreateJob( | 62 HttpStreamFactoryImpl::Job* CreateJob( |
62 HttpStreamFactoryImpl::Job::Delegate* delegate, | 63 HttpStreamFactoryImpl::Job::Delegate* delegate, |
63 HttpStreamFactoryImpl::JobType job_type, | 64 HttpStreamFactoryImpl::JobType job_type, |
64 HttpNetworkSession* session, | 65 HttpNetworkSession* session, |
65 const HttpRequestInfo& request_info, | 66 const HttpRequestInfo& request_info, |
66 RequestPriority priority, | 67 RequestPriority priority, |
| 68 ProxyInfo proxy_info, |
67 const SSLConfig& server_ssl_config, | 69 const SSLConfig& server_ssl_config, |
68 const SSLConfig& proxy_ssl_config, | 70 const SSLConfig& proxy_ssl_config, |
69 HostPortPair destination, | 71 HostPortPair destination, |
70 GURL origin_url, | 72 GURL origin_url, |
71 AlternativeService alternative_service, | 73 AlternativeService alternative_service, |
72 bool enable_ip_based_pooling, | 74 bool enable_ip_based_pooling, |
73 NetLog* net_log) override { | 75 NetLog* net_log) override { |
74 return new HttpStreamFactoryImpl::Job( | 76 return new HttpStreamFactoryImpl::Job( |
75 delegate, job_type, session, request_info, priority, server_ssl_config, | 77 delegate, job_type, session, request_info, priority, proxy_info, |
76 proxy_ssl_config, destination, origin_url, alternative_service, | 78 server_ssl_config, proxy_ssl_config, destination, origin_url, |
77 ProxyServer(), enable_ip_based_pooling, net_log); | 79 alternative_service, ProxyServer(), enable_ip_based_pooling, net_log); |
78 } | 80 } |
79 | 81 |
80 HttpStreamFactoryImpl::Job* CreateJob( | 82 HttpStreamFactoryImpl::Job* CreateJob( |
81 HttpStreamFactoryImpl::Job::Delegate* delegate, | 83 HttpStreamFactoryImpl::Job::Delegate* delegate, |
82 HttpStreamFactoryImpl::JobType job_type, | 84 HttpStreamFactoryImpl::JobType job_type, |
83 HttpNetworkSession* session, | 85 HttpNetworkSession* session, |
84 const HttpRequestInfo& request_info, | 86 const HttpRequestInfo& request_info, |
85 RequestPriority priority, | 87 RequestPriority priority, |
| 88 ProxyInfo proxy_info, |
86 const SSLConfig& server_ssl_config, | 89 const SSLConfig& server_ssl_config, |
87 const SSLConfig& proxy_ssl_config, | 90 const SSLConfig& proxy_ssl_config, |
88 HostPortPair destination, | 91 HostPortPair destination, |
89 GURL origin_url, | 92 GURL origin_url, |
90 const ProxyServer& alternative_proxy_server, | 93 const ProxyServer& alternative_proxy_server, |
91 bool enable_ip_based_pooling, | 94 bool enable_ip_based_pooling, |
92 NetLog* net_log) override { | 95 NetLog* net_log) override { |
93 return new HttpStreamFactoryImpl::Job( | 96 return new HttpStreamFactoryImpl::Job( |
94 delegate, job_type, session, request_info, priority, server_ssl_config, | 97 delegate, job_type, session, request_info, priority, proxy_info, |
95 proxy_ssl_config, destination, origin_url, AlternativeService(), | 98 server_ssl_config, proxy_ssl_config, destination, origin_url, |
96 alternative_proxy_server, enable_ip_based_pooling, net_log); | 99 AlternativeService(), alternative_proxy_server, enable_ip_based_pooling, |
| 100 net_log); |
97 } | 101 } |
98 }; | 102 }; |
99 | 103 |
100 } // anonymous namespace | 104 } // anonymous namespace |
101 | 105 |
102 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, | 106 HttpStreamFactoryImpl::HttpStreamFactoryImpl(HttpNetworkSession* session, |
103 bool for_websockets) | 107 bool for_websockets) |
104 : session_(session), | 108 : session_(session), |
105 job_factory_(new DefaultJobFactory()), | 109 job_factory_(new DefaultJobFactory()), |
106 for_websockets_(for_websockets), | 110 for_websockets_(for_websockets), |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 websocket_handshake_stream_create_helper, | 178 websocket_handshake_stream_create_helper, |
175 HttpStreamRequest::StreamType stream_type, | 179 HttpStreamRequest::StreamType stream_type, |
176 bool enable_ip_based_pooling, | 180 bool enable_ip_based_pooling, |
177 bool enable_alternative_services, | 181 bool enable_alternative_services, |
178 const NetLogWithSource& net_log) { | 182 const NetLogWithSource& net_log) { |
179 AddJobControllerCountToHistograms(); | 183 AddJobControllerCountToHistograms(); |
180 | 184 |
181 auto job_controller = base::MakeUnique<JobController>( | 185 auto job_controller = base::MakeUnique<JobController>( |
182 this, delegate, session_, job_factory_.get(), request_info, | 186 this, delegate, session_, job_factory_.get(), request_info, |
183 /* is_preconnect = */ false, enable_ip_based_pooling, | 187 /* is_preconnect = */ false, enable_ip_based_pooling, |
184 enable_alternative_services); | 188 enable_alternative_services, server_ssl_config, proxy_ssl_config); |
185 JobController* job_controller_raw_ptr = job_controller.get(); | 189 JobController* job_controller_raw_ptr = job_controller.get(); |
186 job_controller_set_.insert(std::move(job_controller)); | 190 job_controller_set_.insert(std::move(job_controller)); |
187 Request* request = job_controller_raw_ptr->Start( | 191 Request* request = job_controller_raw_ptr->Start( |
188 request_info, delegate, websocket_handshake_stream_create_helper, net_log, | 192 delegate, websocket_handshake_stream_create_helper, net_log, stream_type, |
189 stream_type, priority, server_ssl_config, proxy_ssl_config); | 193 priority); |
190 | 194 |
191 return request; | 195 return request; |
192 } | 196 } |
193 | 197 |
194 void HttpStreamFactoryImpl::PreconnectStreams( | 198 void HttpStreamFactoryImpl::PreconnectStreams( |
195 int num_streams, | 199 int num_streams, |
196 const HttpRequestInfo& request_info) { | 200 const HttpRequestInfo& request_info) { |
197 AddJobControllerCountToHistograms(); | 201 AddJobControllerCountToHistograms(); |
198 | 202 |
199 SSLConfig server_ssl_config; | 203 SSLConfig server_ssl_config; |
200 SSLConfig proxy_ssl_config; | 204 SSLConfig proxy_ssl_config; |
201 session_->GetSSLConfig(request_info, &server_ssl_config, &proxy_ssl_config); | 205 session_->GetSSLConfig(request_info, &server_ssl_config, &proxy_ssl_config); |
202 // All preconnects should perform EV certificate verification. | 206 // All preconnects should perform EV certificate verification. |
203 server_ssl_config.verify_ev_cert = true; | 207 server_ssl_config.verify_ev_cert = true; |
204 proxy_ssl_config.verify_ev_cert = true; | 208 proxy_ssl_config.verify_ev_cert = true; |
205 | 209 |
206 DCHECK(!for_websockets_); | 210 DCHECK(!for_websockets_); |
207 | 211 |
208 auto job_controller = base::MakeUnique<JobController>( | 212 auto job_controller = base::MakeUnique<JobController>( |
209 this, nullptr, session_, job_factory_.get(), request_info, | 213 this, nullptr, session_, job_factory_.get(), request_info, |
210 /* is_preconnect = */ true, | 214 /* is_preconnect = */ true, |
211 /* enable_ip_based_pooling = */ true, | 215 /* enable_ip_based_pooling = */ true, |
212 /* enable_alternative_services = */ true); | 216 /* enable_alternative_services = */ true, server_ssl_config, |
| 217 proxy_ssl_config); |
213 JobController* job_controller_raw_ptr = job_controller.get(); | 218 JobController* job_controller_raw_ptr = job_controller.get(); |
214 job_controller_set_.insert(std::move(job_controller)); | 219 job_controller_set_.insert(std::move(job_controller)); |
215 job_controller_raw_ptr->Preconnect(num_streams, request_info, | 220 job_controller_raw_ptr->Preconnect(num_streams); |
216 server_ssl_config, proxy_ssl_config); | |
217 } | 221 } |
218 | 222 |
219 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { | 223 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { |
220 return session_->params().host_mapping_rules; | 224 return session_->params().host_mapping_rules; |
221 } | 225 } |
222 | 226 |
223 void HttpStreamFactoryImpl::OnNewSpdySessionReady( | 227 void HttpStreamFactoryImpl::OnNewSpdySessionReady( |
224 const base::WeakPtr<SpdySession>& spdy_session, | 228 const base::WeakPtr<SpdySession>& spdy_session, |
225 bool direct, | 229 bool direct, |
226 const SSLConfig& used_ssl_config, | 230 const SSLConfig& used_ssl_config, |
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
452 factory_dump->AddScalar("main_job_count", | 456 factory_dump->AddScalar("main_job_count", |
453 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 457 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
454 main_job_count); | 458 main_job_count); |
455 // The number of preconnect controllers. | 459 // The number of preconnect controllers. |
456 factory_dump->AddScalar("preconnect_count", | 460 factory_dump->AddScalar("preconnect_count", |
457 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 461 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
458 num_controllers_for_preconnect); | 462 num_controllers_for_preconnect); |
459 } | 463 } |
460 | 464 |
461 } // namespace net | 465 } // namespace net |
OLD | NEW |