Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(541)

Side by Side Diff: net/http/http_stream_factory_impl.cc

Issue 2621983004: Improve HttpStreamFactory NetLog events (Closed)
Patch Set: Get rid of long-running Source Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 const HttpRequestInfo& request_info, 148 const HttpRequestInfo& request_info,
149 RequestPriority priority, 149 RequestPriority priority,
150 const SSLConfig& server_ssl_config, 150 const SSLConfig& server_ssl_config,
151 const SSLConfig& proxy_ssl_config, 151 const SSLConfig& proxy_ssl_config,
152 HttpStreamRequest::Delegate* delegate, 152 HttpStreamRequest::Delegate* delegate,
153 WebSocketHandshakeStreamBase::CreateHelper* 153 WebSocketHandshakeStreamBase::CreateHelper*
154 websocket_handshake_stream_create_helper, 154 websocket_handshake_stream_create_helper,
155 HttpStreamRequest::StreamType stream_type, 155 HttpStreamRequest::StreamType stream_type,
156 const NetLogWithSource& net_log) { 156 const NetLogWithSource& net_log) {
157 JobController* job_controller = 157 JobController* job_controller =
158 new JobController(this, delegate, session_, job_factory_.get()); 158 new JobController(this, delegate, session_, job_factory_.get(),
159 /*is_preconnect=*/false, net_log);
159 job_controller_set_.insert(base::WrapUnique(job_controller)); 160 job_controller_set_.insert(base::WrapUnique(job_controller));
160 161
161 Request* request = job_controller->Start( 162 Request* request = job_controller->Start(
162 request_info, delegate, websocket_handshake_stream_create_helper, net_log, 163 request_info, delegate, websocket_handshake_stream_create_helper,
163 stream_type, priority, server_ssl_config, proxy_ssl_config); 164 stream_type, priority, server_ssl_config, proxy_ssl_config);
164 165
165 return request; 166 return request;
166 } 167 }
167 168
168 void HttpStreamFactoryImpl::PreconnectStreams( 169 void HttpStreamFactoryImpl::PreconnectStreams(
169 int num_streams, 170 int num_streams,
170 const HttpRequestInfo& request_info) { 171 const HttpRequestInfo& request_info) {
171 SSLConfig server_ssl_config; 172 SSLConfig server_ssl_config;
172 SSLConfig proxy_ssl_config; 173 SSLConfig proxy_ssl_config;
173 session_->GetSSLConfig(request_info, &server_ssl_config, &proxy_ssl_config); 174 session_->GetSSLConfig(request_info, &server_ssl_config, &proxy_ssl_config);
174 // All preconnects should perform EV certificate verification. 175 // All preconnects should perform EV certificate verification.
175 server_ssl_config.verify_ev_cert = true; 176 server_ssl_config.verify_ev_cert = true;
176 proxy_ssl_config.verify_ev_cert = true; 177 proxy_ssl_config.verify_ev_cert = true;
177 178
178 DCHECK(!for_websockets_); 179 DCHECK(!for_websockets_);
179 180
181 NetLogWithSource dummy_netlog_with_source;
mmenke 2017/01/25 19:32:17 Can just inline NetLogWithSource() in the line bel
xunjieli 2017/01/25 21:41:48 Done.
180 JobController* job_controller = 182 JobController* job_controller =
eroman 2017/01/25 19:55:26 side-comment: can you update this to be std::uniqu
xunjieli 2017/01/25 21:41:48 Done.
181 new JobController(this, nullptr, session_, job_factory_.get()); 183 new JobController(this, nullptr, session_, job_factory_.get(),
184 /*is_preconnect=*/true, dummy_netlog_with_source);
182 job_controller_set_.insert(base::WrapUnique(job_controller)); 185 job_controller_set_.insert(base::WrapUnique(job_controller));
183 job_controller->Preconnect(num_streams, request_info, server_ssl_config, 186 job_controller->Preconnect(num_streams, request_info, server_ssl_config,
184 proxy_ssl_config); 187 proxy_ssl_config);
185 } 188 }
186 189
187 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const { 190 const HostMappingRules* HttpStreamFactoryImpl::GetHostMappingRules() const {
188 return session_->params().host_mapping_rules; 191 return session_->params().host_mapping_rules;
189 } 192 }
190 193
191 void HttpStreamFactoryImpl::OnNewSpdySessionReady( 194 void HttpStreamFactoryImpl::OnNewSpdySessionReady(
192 const base::WeakPtr<SpdySession>& spdy_session, 195 const base::WeakPtr<SpdySession>& spdy_session,
193 bool direct, 196 bool direct,
194 const SSLConfig& used_ssl_config, 197 const SSLConfig& used_ssl_config,
195 const ProxyInfo& used_proxy_info, 198 const ProxyInfo& used_proxy_info,
196 bool was_alpn_negotiated, 199 bool was_alpn_negotiated,
197 NextProto negotiated_protocol, 200 NextProto negotiated_protocol,
198 bool using_spdy, 201 bool using_spdy) {
199 const NetLogWithSource& net_log) {
200 while (true) { 202 while (true) {
201 if (!spdy_session) 203 if (!spdy_session)
202 break; 204 break;
203 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key(); 205 const SpdySessionKey& spdy_session_key = spdy_session->spdy_session_key();
204 // Each iteration may empty out the RequestSet for |spdy_session_key| in 206 // Each iteration may empty out the RequestSet for |spdy_session_key| in
205 // |spdy_session_request_map_|. So each time, check for RequestSet and use 207 // |spdy_session_request_map_|. So each time, check for RequestSet and use
206 // the first one. 208 // the first one.
207 // 209 //
208 // TODO(willchan): If it's important, switch RequestSet out for a FIFO 210 // TODO(willchan): If it's important, switch RequestSet out for a FIFO
209 // queue (Order by priority first, then FIFO within same priority). Unclear 211 // queue (Order by priority first, then FIFO within same priority). Unclear
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 DCHECK(!host_port_pair.IsEmpty()); 298 DCHECK(!host_port_pair.IsEmpty());
297 299
298 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(), 300 url::SchemeHostPort scheme_host_port("https", host_port_pair.host(),
299 host_port_pair.port()); 301 host_port_pair.port());
300 302
301 return session_->http_server_properties()->SupportsRequestPriority( 303 return session_->http_server_properties()->SupportsRequestPriority(
302 scheme_host_port); 304 scheme_host_port);
303 } 305 }
304 306
305 } // namespace net 307 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698