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

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

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

Powered by Google App Engine
This is Rietveld 408576698