| 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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( | 152 HttpStreamRequest* HttpStreamFactoryImpl::RequestStreamInternal( |
| 153 const HttpRequestInfo& request_info, | 153 const HttpRequestInfo& request_info, |
| 154 RequestPriority priority, | 154 RequestPriority priority, |
| 155 const SSLConfig& server_ssl_config, | 155 const SSLConfig& server_ssl_config, |
| 156 const SSLConfig& proxy_ssl_config, | 156 const SSLConfig& proxy_ssl_config, |
| 157 HttpStreamRequest::Delegate* delegate, | 157 HttpStreamRequest::Delegate* delegate, |
| 158 WebSocketHandshakeStreamBase::CreateHelper* | 158 WebSocketHandshakeStreamBase::CreateHelper* |
| 159 websocket_handshake_stream_create_helper, | 159 websocket_handshake_stream_create_helper, |
| 160 HttpStreamRequest::StreamType stream_type, | 160 HttpStreamRequest::StreamType stream_type, |
| 161 const NetLogWithSource& net_log) { | 161 const NetLogWithSource& net_log) { |
| 162 JobController* job_controller = | 162 auto job_controller = base::MakeUnique<JobController>( |
| 163 new JobController(this, delegate, session_, job_factory_.get()); | 163 this, delegate, session_, job_factory_.get(), request_info, |
| 164 job_controller_set_.insert(base::WrapUnique(job_controller)); | 164 /*is_preconnect=*/false); |
| 165 | 165 JobController* job_controller_raw_ptr = job_controller.get(); |
| 166 Request* request = job_controller->Start( | 166 job_controller_set_.insert(std::move(job_controller)); |
| 167 Request* request = job_controller_raw_ptr->Start( |
| 167 request_info, delegate, websocket_handshake_stream_create_helper, net_log, | 168 request_info, delegate, websocket_handshake_stream_create_helper, net_log, |
| 168 stream_type, priority, server_ssl_config, proxy_ssl_config); | 169 stream_type, priority, server_ssl_config, proxy_ssl_config); |
| 169 | 170 |
| 170 return request; | 171 return request; |
| 171 } | 172 } |
| 172 | 173 |
| 173 void HttpStreamFactoryImpl::PreconnectStreams( | 174 void HttpStreamFactoryImpl::PreconnectStreams( |
| 174 int num_streams, | 175 int num_streams, |
| 175 const HttpRequestInfo& request_info) { | 176 const HttpRequestInfo& request_info) { |
| 176 SSLConfig server_ssl_config; | 177 SSLConfig server_ssl_config; |
| 177 SSLConfig proxy_ssl_config; | 178 SSLConfig proxy_ssl_config; |
| 178 session_->GetSSLConfig(request_info, &server_ssl_config, &proxy_ssl_config); | 179 session_->GetSSLConfig(request_info, &server_ssl_config, &proxy_ssl_config); |
| 179 // All preconnects should perform EV certificate verification. | 180 // All preconnects should perform EV certificate verification. |
| 180 server_ssl_config.verify_ev_cert = true; | 181 server_ssl_config.verify_ev_cert = true; |
| 181 proxy_ssl_config.verify_ev_cert = true; | 182 proxy_ssl_config.verify_ev_cert = true; |
| 182 | 183 |
| 183 DCHECK(!for_websockets_); | 184 DCHECK(!for_websockets_); |
| 184 | 185 |
| 185 JobController* job_controller = | 186 auto job_controller = base::MakeUnique<JobController>( |
| 186 new JobController(this, nullptr, session_, job_factory_.get()); | 187 this, nullptr, session_, job_factory_.get(), request_info, |
| 187 job_controller_set_.insert(base::WrapUnique(job_controller)); | 188 /*is_preconnect=*/true); |
| 188 job_controller->Preconnect(num_streams, request_info, server_ssl_config, | 189 JobController* job_controller_raw_ptr = job_controller.get(); |
| 189 proxy_ssl_config); | 190 job_controller_set_.insert(std::move(job_controller)); |
| 191 job_controller_raw_ptr->Preconnect(num_streams, request_info, |
| 192 server_ssl_config, proxy_ssl_config); |
| 190 } | 193 } |
| 191 | 194 |
| 192 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { | 195 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { |
| 193 return session_->params().host_mapping_rules; | 196 return session_->params().host_mapping_rules; |
| 194 } | 197 } |
| 195 | 198 |
| 196 void HttpStreamFactoryImpl::OnNewSpdySessionReady( | 199 void HttpStreamFactoryImpl::OnNewSpdySessionReady( |
| 197 const base::WeakPtr<SpdySession>& spdy_session, | 200 const base::WeakPtr<SpdySession>& spdy_session, |
| 198 bool direct, | 201 bool direct, |
| 199 const SSLConfig& used_ssl_config, | 202 const SSLConfig& used_ssl_config, |
| 200 const ProxyInfo& used_proxy_info, | 203 const ProxyInfo& used_proxy_info, |
| 201 bool was_alpn_negotiated, | 204 bool was_alpn_negotiated, |
| 202 NextProto negotiated_protocol, | 205 NextProto negotiated_protocol, |
| 203 bool using_spdy, | 206 bool using_spdy) { |
| 204 const NetLogWithSource& net_log) { | |
| 205 while (true) { | 207 while (true) { |
| 206 if (!spdy_session) | 208 if (!spdy_session) |
| 207 break; | 209 break; |
| 208 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); | 210 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); |
| 209 // Each iteration may empty out the RequestSet for |spdy_session_key| in | 211 // Each iteration may empty out the RequestSet for |spdy_session_key| in |
| 210 // |spdy_session_request_map_|. So each time, check for RequestSet and use | 212 // |spdy_session_request_map_|. So each time, check for RequestSet and use |
| 211 // the first one. | 213 // the first one. |
| 212 // | 214 // |
| 213 // TODO(willchan): If it's important, switch RequestSet out for a FIFO | 215 // TODO(willchan): If it's important, switch RequestSet out for a FIFO |
| 214 // queue (Order by priority first, then FIFO within same priority). Unclear | 216 // queue (Order by priority first, then FIFO within same priority). Unclear |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 370 factory_dump->AddScalar("main_job_count", | 372 factory_dump->AddScalar("main_job_count", |
| 371 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 373 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 372 main_job_count); | 374 main_job_count); |
| 373 // The number of preconnect controllers. | 375 // The number of preconnect controllers. |
| 374 factory_dump->AddScalar("preconnect_count", | 376 factory_dump->AddScalar("preconnect_count", |
| 375 base::trace_event::MemoryAllocatorDump::kUnitsObjects, | 377 base::trace_event::MemoryAllocatorDump::kUnitsObjects, |
| 376 preconnect_controller_count); | 378 preconnect_controller_count); |
| 377 } | 379 } |
| 378 | 380 |
| 379 } // namespace net | 381 } // namespace net |
| OLD | NEW |