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" |
11 #include "base/location.h" | 11 #include "base/location.h" |
12 #include "base/memory/ptr_util.h" | 12 #include "base/memory/ptr_util.h" |
13 #include "base/metrics/histogram_macros.h" | 13 #include "base/metrics/histogram_macros.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/threading/thread_task_runner_handle.h" | 15 #include "base/threading/thread_task_runner_handle.h" |
16 #include "base/trace_event/trace_event.h" | 16 #include "base/trace_event/trace_event.h" |
17 #include "content/browser/appcache/appcache_interceptor.h" | 17 #include "content/browser/appcache/appcache_interceptor.h" |
18 #include "content/browser/child_process_security_policy_impl.h" | 18 #include "content/browser/child_process_security_policy_impl.h" |
19 #include "content/browser/loader/detachable_resource_handler.h" | 19 #include "content/browser/loader/detachable_resource_handler.h" |
20 #include "content/browser/loader/loader_globals.h" | |
20 #include "content/browser/loader/resource_controller.h" | 21 #include "content/browser/loader/resource_controller.h" |
21 #include "content/browser/loader/resource_handler.h" | 22 #include "content/browser/loader/resource_handler.h" |
22 #include "content/browser/loader/resource_loader_delegate.h" | 23 #include "content/browser/loader/resource_loader_delegate.h" |
23 #include "content/browser/loader/resource_request_info_impl.h" | 24 #include "content/browser/loader/resource_request_info_impl.h" |
24 #include "content/browser/service_worker/service_worker_request_handler.h" | 25 #include "content/browser/service_worker/service_worker_request_handler.h" |
25 #include "content/browser/service_worker/service_worker_response_info.h" | 26 #include "content/browser/service_worker/service_worker_response_info.h" |
26 #include "content/browser/ssl/ssl_client_auth_handler.h" | 27 #include "content/browser/ssl/ssl_client_auth_handler.h" |
27 #include "content/browser/ssl/ssl_manager.h" | 28 #include "content/browser/ssl/ssl_manager.h" |
28 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" | 29 #include "content/public/browser/resource_dispatcher_host_login_delegate.h" |
29 #include "content/public/common/browser_side_navigation_policy.h" | 30 #include "content/public/common/browser_side_navigation_policy.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
437 | 438 |
438 // bytes_read == -1 always implies an error. | 439 // bytes_read == -1 always implies an error. |
439 if (bytes_read == -1 || !request_->status().is_success()) { | 440 if (bytes_read == -1 || !request_->status().is_success()) { |
440 ResponseCompleted(); | 441 ResponseCompleted(); |
441 return; | 442 return; |
442 } | 443 } |
443 | 444 |
444 CompleteRead(bytes_read); | 445 CompleteRead(bytes_read); |
445 } | 446 } |
446 | 447 |
447 void ResourceLoader::CancelSSLRequest(int error, | 448 void ResourceLoader::CancelSSLRequest(int error, |
jam
2017/03/29 15:44:32
ResourceLoader is created from RDH, so we know it'
ananta
2017/03/29 19:41:04
Done.
| |
448 const net::SSLInfo* ssl_info) { | 449 const net::SSLInfo* ssl_info) { |
449 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 450 DCHECK( |
451 LoaderGlobals::Get()->io_thread_task_runner()->BelongsToCurrentThread()); | |
450 | 452 |
451 // The request can be NULL if it was cancelled by the renderer (as the | 453 // 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). | 454 // request of the user navigating to a new page from the location bar). |
453 if (!request_->is_pending()) | 455 if (!request_->is_pending()) |
454 return; | 456 return; |
455 DVLOG(1) << "CancelSSLRequest() url: " << request_->url().spec(); | 457 DVLOG(1) << "CancelSSLRequest() url: " << request_->url().spec(); |
456 | 458 |
457 if (ssl_info) { | 459 if (ssl_info) { |
458 request_->CancelWithSSLError(error, *ssl_info); | 460 request_->CancelWithSSLError(error, *ssl_info); |
459 } else { | 461 } else { |
460 request_->CancelWithError(error); | 462 request_->CancelWithError(error); |
461 } | 463 } |
462 } | 464 } |
463 | 465 |
464 void ResourceLoader::ContinueSSLRequest() { | 466 void ResourceLoader::ContinueSSLRequest() { |
465 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 467 DCHECK( |
468 LoaderGlobals::Get()->io_thread_task_runner()->BelongsToCurrentThread()); | |
466 | 469 |
467 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); | 470 DVLOG(1) << "ContinueSSLRequest() url: " << request_->url().spec(); |
468 | 471 |
469 request_->ContinueDespiteLastError(); | 472 request_->ContinueDespiteLastError(); |
470 } | 473 } |
471 | 474 |
472 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { | 475 void ResourceLoader::ContinueWithCertificate(net::X509Certificate* cert) { |
473 DCHECK(ssl_client_auth_handler_); | 476 DCHECK(ssl_client_auth_handler_); |
474 ssl_client_auth_handler_.reset(); | 477 ssl_client_auth_handler_.reset(); |
475 if (!cert) { | 478 if (!cert) { |
(...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
807 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, | 810 UMA_HISTOGRAM_ENUMERATION("Net.Prefetch.Pattern", prefetch_status, |
808 STATUS_MAX); | 811 STATUS_MAX); |
809 } | 812 } |
810 } else if (request_->response_info().unused_since_prefetch) { | 813 } else if (request_->response_info().unused_since_prefetch) { |
811 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); | 814 TimeDelta total_time = base::TimeTicks::Now() - request_->creation_time(); |
812 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); | 815 UMA_HISTOGRAM_TIMES("Net.Prefetch.TimeSpentOnPrefetchHit", total_time); |
813 } | 816 } |
814 } | 817 } |
815 | 818 |
816 } // namespace content | 819 } // namespace content |
OLD | NEW |