| 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 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading | 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc
e-loading |
| 6 | 6 |
| 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 7 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <set> | 10 #include <set> |
| (...skipping 712 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 723 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( | 723 ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( |
| 724 net::URLRequest* request, | 724 net::URLRequest* request, |
| 725 bool is_content_initiated, | 725 bool is_content_initiated, |
| 726 bool must_download, | 726 bool must_download, |
| 727 uint32 id, | 727 uint32 id, |
| 728 scoped_ptr<DownloadSaveInfo> save_info, | 728 scoped_ptr<DownloadSaveInfo> save_info, |
| 729 const DownloadUrlParameters::OnStartedCallback& started_cb) { | 729 const DownloadUrlParameters::OnStartedCallback& started_cb) { |
| 730 scoped_ptr<ResourceHandler> handler( | 730 scoped_ptr<ResourceHandler> handler( |
| 731 new DownloadResourceHandler(id, request, started_cb, save_info.Pass())); | 731 new DownloadResourceHandler(id, request, started_cb, save_info.Pass())); |
| 732 if (delegate_) { | 732 if (delegate_) { |
| 733 const ResourceRequestInfo* request_info( | 733 const ResourceRequestInfoImpl* request_info( |
| 734 ResourceRequestInfo::ForRequest(request)); | 734 ResourceRequestInfoImpl::ForRequest(request)); |
| 735 | 735 |
| 736 ScopedVector<ResourceThrottle> throttles; | 736 ScopedVector<ResourceThrottle> throttles; |
| 737 delegate_->DownloadStarting( | 737 delegate_->DownloadStarting( |
| 738 request, request_info->GetContext(), request_info->GetChildID(), | 738 request, request_info->GetContext(), request_info->GetChildID(), |
| 739 request_info->GetRouteID(), request_info->GetRequestID(), | 739 request_info->GetRouteID(), request_info->GetRequestID(), |
| 740 is_content_initiated, must_download, &throttles); | 740 is_content_initiated, must_download, &throttles); |
| 741 if (!throttles.empty()) { | 741 if (!throttles.empty()) { |
| 742 handler.reset( | 742 handler.reset( |
| 743 new ThrottlingResourceHandler( | 743 new ThrottlingResourceHandler( |
| 744 handler.Pass(), request, throttles.Pass())); | 744 handler.Pass(), request, throttles.Pass())); |
| (...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 877 scoped_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails( | 877 scoped_ptr<ResourceRequestDetails> detail(new ResourceRequestDetails( |
| 878 request, GetCertID(request, info->GetChildID()))); | 878 request, GetCertID(request, info->GetChildID()))); |
| 879 BrowserThread::PostTask( | 879 BrowserThread::PostTask( |
| 880 BrowserThread::UI, FROM_HERE, | 880 BrowserThread::UI, FROM_HERE, |
| 881 base::Bind( | 881 base::Bind( |
| 882 &NotifyResponseOnUI, | 882 &NotifyResponseOnUI, |
| 883 render_process_id, render_frame_host, base::Passed(&detail))); | 883 render_process_id, render_frame_host, base::Passed(&detail))); |
| 884 } | 884 } |
| 885 | 885 |
| 886 void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) { | 886 void ResourceDispatcherHostImpl::DidFinishLoading(ResourceLoader* loader) { |
| 887 ResourceRequestInfo* info = loader->GetRequestInfo(); | 887 ResourceRequestInfoImpl* info = loader->GetRequestInfo(); |
| 888 | 888 |
| 889 // Record final result of all resource loads. | 889 // Record final result of all resource loads. |
| 890 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) { | 890 if (info->GetResourceType() == RESOURCE_TYPE_MAIN_FRAME) { |
| 891 // This enumeration has "3" appended to its name to distinguish it from | 891 // This enumeration has "3" appended to its name to distinguish it from |
| 892 // older versions. | 892 // older versions. |
| 893 UMA_HISTOGRAM_SPARSE_SLOWLY( | 893 UMA_HISTOGRAM_SPARSE_SLOWLY( |
| 894 "Net.ErrorCodesForMainFrame3", | 894 "Net.ErrorCodesForMainFrame3", |
| 895 -loader->request()->status().error()); | 895 -loader->request()->status().error()); |
| 896 | 896 |
| 897 // Record time to success and error for the most common errors, and for | 897 // Record time to success and error for the most common errors, and for |
| (...skipping 1544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2442 load_flags |= net::LOAD_PREFETCH; | 2442 load_flags |= net::LOAD_PREFETCH; |
| 2443 } | 2443 } |
| 2444 | 2444 |
| 2445 if (is_sync_load) | 2445 if (is_sync_load) |
| 2446 load_flags |= net::LOAD_IGNORE_LIMITS; | 2446 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2447 | 2447 |
| 2448 return load_flags; | 2448 return load_flags; |
| 2449 } | 2449 } |
| 2450 | 2450 |
| 2451 } // namespace content | 2451 } // namespace content |
| OLD | NEW |