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 "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/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
439 if (bytes_read == -1 || !request_->status().is_success()) { | 439 if (bytes_read == -1 || !request_->status().is_success()) { |
440 ResponseCompleted(); | 440 ResponseCompleted(); |
441 return; | 441 return; |
442 } | 442 } |
443 | 443 |
444 CompleteRead(bytes_read); | 444 CompleteRead(bytes_read); |
445 } | 445 } |
446 | 446 |
447 void ResourceLoader::CancelSSLRequest(int error, | 447 void ResourceLoader::CancelSSLRequest(int error, |
448 const net::SSLInfo* ssl_info) { | 448 const net::SSLInfo* ssl_info) { |
449 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 449 DCHECK(thread_checker_.CalledOnValidThread()); |
450 | 450 |
451 // The request can be NULL if it was cancelled by the renderer (as the | 451 // The request can be NULL if it was cancelled by the renderer (as the |
452 // request of the user navigating to a new page from the location bar). | 452 // request of the user navigating to a new page from the location bar). |
453 if (!request_->is_pending()) | 453 if (!request_->is_pending()) |
454 return; | 454 return; |
455 DVLOG(1) << "CancelSSLRequest() url: " << request_->url().spec(); | 455 DVLOG(1) << "CancelSSLRequest() url: " << request_->url().spec(); |
456 | 456 |
457 if (ssl_info) { | 457 if (ssl_info) { |
458 request_->CancelWithSSLError(error, *ssl_info); | 458 request_->CancelWithSSLError(error, *ssl_info); |
459 } else { | 459 } else { |
460 request_->CancelWithError(error); | 460 request_->CancelWithError(error); |
461 } | 461 } |
462 } | 462 } |
463 | 463 |
464 void ResourceLoader::ContinueSSLRequest() { | 464 void ResourceLoader::ContinueSSLRequest() { |
465 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 465 DCHECK(thread_checker_.CalledOnValidThread()); |
466 | 466 |
467 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); | 467 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); |
468 | 468 |
469 request_->ContinueDespiteLastError(); | 469 request_->ContinueDespiteLastError(); |
470 } | 470 } |
471 | 471 |
472 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | 472 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { |
473 DCHECK(ssl_client_auth_handler_); | 473 DCHECK(ssl_client_auth_handler_); |
474 ssl_client_auth_handler_.reset(); | 474 ssl_client_auth_handler_.reset(); |
475 if (!cert) { | 475 if (!cert) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
807 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, | 807 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, |
808 STATUS_MAX); | 808 STATUS_MAX); |
809 } | 809 } |
810 } else if (request_->response_info().unused_since_prefetch) { | 810 } else if (request_->response_info().unused_since_prefetch) { |
811 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 811 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
812 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 812 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
813 } | 813 } |
814 } | 814 } |
815 | 815 |
816 } // namespace content | 816 } // namespace content |
OLD | NEW |