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

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

Issue 1174173013: replace VLOG with DVLOG in content/browser/loader/resource_loader.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 | « no previous file | no next file » | 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 "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/location.h" 8 #include "base/location.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/profiler/scoped_tracker.h" 10 #include "base/profiler/scoped_tracker.h"
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after
215 215
216 void ResourceLoader::OnUploadProgressACK() { 216 void ResourceLoader::OnUploadProgressACK() {
217 waiting_for_upload_progress_ack_ = false; 217 waiting_for_upload_progress_ack_ = false;
218 } 218 }
219 219
220 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused, 220 void ResourceLoader::OnReceivedRedirect(net::URLRequest* unused,
221 const net::RedirectInfo& redirect_info, 221 const net::RedirectInfo& redirect_info,
222 bool* defer) { 222 bool* defer) {
223 DCHECK_EQ(request_.get(), unused); 223 DCHECK_EQ(request_.get(), unused);
224 224
225 VLOG(1) << "OnReceivedRedirect: " << request_->url().spec(); 225 DVLOG(1) << "OnReceivedRedirect: " << request_->url().spec();
226 DCHECK(request_->status().is_success()); 226 DCHECK(request_->status().is_success());
227 227
228 ResourceRequestInfoImpl* info = GetRequestInfo(); 228 ResourceRequestInfoImpl* info = GetRequestInfo();
229 229
230 if (info->GetProcessType() != PROCESS_TYPE_PLUGIN && 230 if (info->GetProcessType() != PROCESS_TYPE_PLUGIN &&
231 !ChildProcessSecurityPolicyImpl::GetInstance()-> 231 !ChildProcessSecurityPolicyImpl::GetInstance()->
232 CanRequestURL(info->GetChildID(), redirect_info.new_url)) { 232 CanRequestURL(info->GetChildID(), redirect_info.new_url)) {
233 VLOG(1) << "Denied unauthorized request for " 233 DVLOG(1) << "Denied unauthorized request for "
234 << redirect_info.new_url.possibly_invalid_spec(); 234 << redirect_info.new_url.possibly_invalid_spec();
235 235
236 // Tell the renderer that this request was disallowed. 236 // Tell the renderer that this request was disallowed.
237 Cancel(); 237 Cancel();
238 return; 238 return;
239 } 239 }
240 240
241 delegate_->DidReceiveRedirect(this, redirect_info.new_url); 241 delegate_->DidReceiveRedirect(this, redirect_info.new_url);
242 242
243 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) { 243 if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
244 // The request is complete so we can remove it. 244 // The request is complete so we can remove it.
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 Cancel(); 322 Cancel();
323 return; 323 return;
324 } else if (*defer) { 324 } else if (*defer) {
325 deferred_stage_ = DEFERRED_NETWORK_START; 325 deferred_stage_ = DEFERRED_NETWORK_START;
326 } 326 }
327 } 327 }
328 328
329 void ResourceLoader::OnResponseStarted(net::URLRequest* unused) { 329 void ResourceLoader::OnResponseStarted(net::URLRequest* unused) {
330 DCHECK_EQ(request_.get(), unused); 330 DCHECK_EQ(request_.get(), unused);
331 331
332 VLOG(1) << "OnResponseStarted: " << request_->url().spec(); 332 DVLOG(1) << "OnResponseStarted: " << request_->url().spec();
333 333
334 progress_timer_.Stop(); 334 progress_timer_.Stop();
335 335
336 // The CanLoadPage check should take place after any server redirects have 336 // The CanLoadPage check should take place after any server redirects have
337 // finished, at the point in time that we know a page will commit in the 337 // finished, at the point in time that we know a page will commit in the
338 // renderer process. 338 // renderer process.
339 ResourceRequestInfoImpl* info = GetRequestInfo(); 339 ResourceRequestInfoImpl* info = GetRequestInfo();
340 ChildProcessSecurityPolicyImpl* policy = 340 ChildProcessSecurityPolicyImpl* policy =
341 ChildProcessSecurityPolicyImpl::GetInstance(); 341 ChildProcessSecurityPolicyImpl::GetInstance();
342 if (!policy->CanLoadPage(info->GetChildID(), 342 if (!policy->CanLoadPage(info->GetChildID(),
(...skipping 22 matching lines...) Expand all
365 return; 365 return;
366 366
367 if (request_->status().is_success()) 367 if (request_->status().is_success())
368 StartReading(false); // Read the first chunk. 368 StartReading(false); // Read the first chunk.
369 else 369 else
370 ResponseCompleted(); 370 ResponseCompleted();
371 } 371 }
372 372
373 void ResourceLoader::OnReadCompleted(net::URLRequest* unused, int bytes_read) { 373 void ResourceLoader::OnReadCompleted(net::URLRequest* unused, int bytes_read) {
374 DCHECK_EQ(request_.get(), unused); 374 DCHECK_EQ(request_.get(), unused);
375 VLOG(1) << "OnReadCompleted: \"" << request_->url().spec() << "\"" 375 DVLOG(1) << "OnReadCompleted: \"" << request_->url().spec() << "\""
376 << " bytes_read = " << bytes_read; 376 << " bytes_read = " << bytes_read;
377 377
378 // bytes_read == -1 always implies an error. 378 // bytes_read == -1 always implies an error.
379 if (bytes_read == -1 || !request_->status().is_success()) { 379 if (bytes_read == -1 || !request_->status().is_success()) {
380 ResponseCompleted(); 380 ResponseCompleted();
381 return; 381 return;
382 } 382 }
383 383
384 CompleteRead(bytes_read); 384 CompleteRead(bytes_read);
385 385
386 // If the handler cancelled or deferred the request, do not continue 386 // If the handler cancelled or deferred the request, do not continue
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
499 request_->has_upload()) { 499 request_->has_upload()) {
500 progress_timer_.Start( 500 progress_timer_.Start(
501 FROM_HERE, 501 FROM_HERE,
502 base::TimeDelta::FromMilliseconds(kUploadProgressIntervalMsec), 502 base::TimeDelta::FromMilliseconds(kUploadProgressIntervalMsec),
503 this, 503 this,
504 &ResourceLoader::ReportUploadProgress); 504 &ResourceLoader::ReportUploadProgress);
505 } 505 }
506 } 506 }
507 507
508 void ResourceLoader::CancelRequestInternal(int error, bool from_renderer) { 508 void ResourceLoader::CancelRequestInternal(int error, bool from_renderer) {
509 VLOG(1) << "CancelRequestInternal: " << request_->url().spec(); 509 DVLOG(1) << "CancelRequestInternal: " << request_->url().spec();
510 510
511 ResourceRequestInfoImpl* info = GetRequestInfo(); 511 ResourceRequestInfoImpl* info = GetRequestInfo();
512 512
513 // WebKit will send us a cancel for downloads since it no longer handles 513 // WebKit will send us a cancel for downloads since it no longer handles
514 // them. In this case, ignore the cancel since we handle downloads in the 514 // them. In this case, ignore the cancel since we handle downloads in the
515 // browser. 515 // browser.
516 if (from_renderer && (info->IsDownload() || info->is_stream())) 516 if (from_renderer && (info->IsDownload() || info->is_stream()))
517 return; 517 return;
518 518
519 if (from_renderer && info->detachable_handler()) { 519 if (from_renderer && info->detachable_handler()) {
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 bytes_read > 0 ? DEFERRED_READ : DEFERRED_RESPONSE_COMPLETE; 682 bytes_read > 0 ? DEFERRED_READ : DEFERRED_RESPONSE_COMPLETE;
683 } 683 }
684 684
685 // Note: the request may still have been cancelled while OnReadCompleted 685 // Note: the request may still have been cancelled while OnReadCompleted
686 // returns true if OnReadCompleted caused request to get cancelled 686 // returns true if OnReadCompleted caused request to get cancelled
687 // out-of-band. (In AwResourceDispatcherHostDelegate::DownloadStarting, for 687 // out-of-band. (In AwResourceDispatcherHostDelegate::DownloadStarting, for
688 // instance.) 688 // instance.)
689 } 689 }
690 690
691 void ResourceLoader::ResponseCompleted() { 691 void ResourceLoader::ResponseCompleted() {
692 VLOG(1) << "ResponseCompleted: " << request_->url().spec(); 692 DVLOG(1) << "ResponseCompleted: " << request_->url().spec();
693 RecordHistograms(); 693 RecordHistograms();
694 ResourceRequestInfoImpl* info = GetRequestInfo(); 694 ResourceRequestInfoImpl* info = GetRequestInfo();
695 695
696 std::string security_info; 696 std::string security_info;
697 const net::SSLInfo& ssl_info = request_->ssl_info(); 697 const net::SSLInfo& ssl_info = request_->ssl_info();
698 if (ssl_info.cert.get() != NULL) { 698 if (ssl_info.cert.get() != NULL) {
699 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert.get(), 699 int cert_id = CertStore::GetInstance()->StoreCert(ssl_info.cert.get(),
700 info->GetChildID()); 700 info->GetChildID());
701 SignedCertificateTimestampIDStatusList signed_certificate_timestamp_ids; 701 SignedCertificateTimestampIDStatusList signed_certificate_timestamp_ids;
702 StoreSignedCertificateTimestamps(ssl_info.signed_certificate_timestamps, 702 StoreSignedCertificateTimestamps(ssl_info.signed_certificate_timestamps,
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
757 case net::URLRequestStatus::FAILED: 757 case net::URLRequestStatus::FAILED:
758 status = STATUS_UNDEFINED; 758 status = STATUS_UNDEFINED;
759 break; 759 break;
760 } 760 }
761 761
762 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX); 762 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", status, STATUS_MAX);
763 } 763 }
764 } 764 }
765 765
766 } // namespace content 766 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698