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

Side by Side Diff: content/browser/loader/resource_loader.cc

Issue 1834273002: Add TRACE_EVENT macros to net. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and address comments. Created 4 years, 8 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
« no previous file with comments | « chrome/browser/net/crl_set_fetcher.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "content/browser/loader/resource_loader.h" 5 #include "content/browser/loader/resource_loader.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/location.h" 10 #include "base/location.h"
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 return ResourceRequestInfoImpl::ForRequest(request_.get()); 245 return ResourceRequestInfoImpl::ForRequest(request_.get());
246 } 246 }
247 247
248 void ResourceLoader::ClearLoginDelegate() { 248 void ResourceLoader::ClearLoginDelegate() {
249 login_delegate_ = NULL; 249 login_delegate_ = NULL;
250 } 250 }
251 251
252 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused, 252 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused,
253 const net::RedirectInfo& redirect_info, 253 const net::RedirectInfo& redirect_info,
254 bool* defer) { 254 bool* defer) {
255 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"),
256 "ResourceLoader::OnReceivedRedirect");
255 DCHECK_EQ(request_.get(), unused); 257 DCHECK_EQ(request_.get(), unused);
256 258
257 DVLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); 259 DVLOG(1) << "OnReceivedRedirect: " << request_->url().spec();
258 DCHECK(request_->status().is_success()); 260 DCHECK(request_->status().is_success());
259 261
260 ResourceRequestInfoImpl* info = GetRequestInfo(); 262 ResourceRequestInfoImpl* info = GetRequestInfo();
261 263
262 if (info->GetProcessType() != PROCESS_TYPE_PLUGIN && 264 if (info->GetProcessType() != PROCESS_TYPE_PLUGIN &&
263 !ChildProcessSecurityPolicyImpl::GetInstance()-> 265 !ChildProcessSecurityPolicyImpl::GetInstance()->
264 CanRequestURL(info->GetChildID(), redirect_info.new_url)) { 266 CanRequestURL(info->GetChildID(), redirect_info.new_url)) {
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
330 bool fatal) { 332 bool fatal) {
331 ResourceRequestInfoImpl* info = GetRequestInfo(); 333 ResourceRequestInfoImpl* info = GetRequestInfo();
332 334
333 SSLManager::OnSSLCertificateError( 335 SSLManager::OnSSLCertificateError(
334 weak_ptr_factory_.GetWeakPtr(), info->GetResourceType(), request_->url(), 336 weak_ptr_factory_.GetWeakPtr(), info->GetResourceType(), request_->url(),
335 info->GetWebContentsGetterForRequest(), ssl_info, fatal); 337 info->GetWebContentsGetterForRequest(), ssl_info, fatal);
336 } 338 }
337 339
338 void ResourceLoader::OnBeforeNetworkStart(net::URLRequest* unused, 340 void ResourceLoader::OnBeforeNetworkStart(net::URLRequest* unused,
339 bool* defer) { 341 bool* defer) {
342 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"),
343 "ResourceLoader::OnBeforeNetworkStart");
340 DCHECK_EQ(request_.get(), unused); 344 DCHECK_EQ(request_.get(), unused);
341 345
342 // Give the handler a chance to delay the URLRequest from using the network. 346 // Give the handler a chance to delay the URLRequest from using the network.
343 if (!handler_->OnBeforeNetworkStart(request_->url(), defer)) { 347 if (!handler_->OnBeforeNetworkStart(request_->url(), defer)) {
344 Cancel(); 348 Cancel();
345 return; 349 return;
346 } else if (*defer) { 350 } else if (*defer) {
347 deferred_stage_ = DEFERRED_NETWORK_START; 351 deferred_stage_ = DEFERRED_NETWORK_START;
348 } 352 }
349 } 353 }
350 354
351 void ResourceLoader::OnResponseStarted(net::URLRequest* unused) { 355 void ResourceLoader::OnResponseStarted(net::URLRequest* unused) {
356 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"),
357 "ResourceLoader::OnResponseStarted");
352 DCHECK_EQ(request_.get(), unused); 358 DCHECK_EQ(request_.get(), unused);
353 359
354 DVLOG(1) << "OnResponseStarted: " << request_->url().spec(); 360 DVLOG(1) << "OnResponseStarted: " << request_->url().spec();
355 361
356 if (!request_->status().is_success()) { 362 if (!request_->status().is_success()) {
357 ResponseCompleted(); 363 ResponseCompleted();
358 return; 364 return;
359 } 365 }
360 366
361 CompleteResponseStarted(); 367 CompleteResponseStarted();
362 368
363 if (is_deferred()) 369 if (is_deferred())
364 return; 370 return;
365 371
366 if (request_->status().is_success()) 372 if (request_->status().is_success())
367 StartReading(false); // Read the first chunk. 373 StartReading(false); // Read the first chunk.
368 else 374 else
369 ResponseCompleted(); 375 ResponseCompleted();
370 } 376 }
371 377
372 void ResourceLoader::OnReadCompleted(net::URLRequest* unused, int bytes_read) { 378 void ResourceLoader::OnReadCompleted(net::URLRequest* unused, int bytes_read) {
379 TRACE_EVENT0(TRACE_DISABLED_BY_DEFAULT("loading"),
380 "ResourceLoader::OnReadCompleted");
373 DCHECK_EQ(request_.get(), unused); 381 DCHECK_EQ(request_.get(), unused);
374 DVLOG(1) << "OnReadCompleted: \"" << request_->url().spec() << "\"" 382 DVLOG(1) << "OnReadCompleted: \"" << request_->url().spec() << "\""
375 << " bytes_read = " << bytes_read; 383 << " bytes_read = " << bytes_read;
376 384
377 // bytes_read == -1 always implies an error. 385 // bytes_read == -1 always implies an error.
378 if (bytes_read == -1 || !request_->status().is_success()) { 386 if (bytes_read == -1 || !request_->status().is_success()) {
379 ResponseCompleted(); 387 ResponseCompleted();
380 return; 388 return;
381 } 389 }
382 390
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
733 case net::URLRequestStatus::FAILED: 741 case net::URLRequestStatus::FAILED:
734 status = STATUS_UNDEFINED; 742 status = STATUS_UNDEFINED;
735 break; 743 break;
736 } 744 }
737 745
738 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 746 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
739 } 747 }
740 } 748 }
741 749
742 } // namespace content 750 } // namespace content
OLDNEW
« no previous file with comments | « chrome/browser/net/crl_set_fetcher.cc ('k') | net/base/network_delegate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698