| 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 <stddef.h> | 9 #include <stddef.h> |
| 10 | 10 |
| (...skipping 1756 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1767 } | 1767 } |
| 1768 | 1768 |
| 1769 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile( | 1769 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile( |
| 1770 ResourceRequesterInfo* requester_info, | 1770 ResourceRequesterInfo* requester_info, |
| 1771 int request_id) { | 1771 int request_id) { |
| 1772 UnregisterDownloadedTempFile(requester_info->child_id(), request_id); | 1772 UnregisterDownloadedTempFile(requester_info->child_id(), request_id); |
| 1773 } | 1773 } |
| 1774 | 1774 |
| 1775 void ResourceDispatcherHostImpl::OnDidChangePriority( | 1775 void ResourceDispatcherHostImpl::OnDidChangePriority( |
| 1776 ResourceRequesterInfo* requester_info, | 1776 ResourceRequesterInfo* requester_info, |
| 1777 int request_id, | 1777 const std::vector<ResourcePriorityChangeInfo>& priority_info_vector) { |
| 1778 net::RequestPriority new_priority, | 1778 std::vector<ResourceScheduler::PriorityChangeRequest> |
| 1779 int intra_priority_value) { | 1779 priority_change_requests; |
| 1780 ResourceLoader* loader = GetLoader(requester_info->child_id(), request_id); | |
| 1781 // The request may go away before processing this message, so |loader| can | |
| 1782 // legitimately be null. | |
| 1783 if (!loader) | |
| 1784 return; | |
| 1785 | 1780 |
| 1786 scheduler_->ReprioritizeRequest(loader->request(), new_priority, | 1781 for (auto& v : priority_info_vector) { |
| 1787 intra_priority_value); | 1782 ResourceLoader* loader = |
| 1783 GetLoader(requester_info->child_id(), v.request_id); |
| 1784 // The request may go away before processing this message, so |loader| can |
| 1785 // legitimately be null. |
| 1786 if (!loader) |
| 1787 continue; |
| 1788 |
| 1789 priority_change_requests.push_back( |
| 1790 {loader->request(), v.priority, v.intra_priority_value}); |
| 1791 } |
| 1792 scheduler_->ReprioritizeRequests(priority_change_requests); |
| 1788 } | 1793 } |
| 1789 | 1794 |
| 1790 void ResourceDispatcherHostImpl::RegisterDownloadedTempFile( | 1795 void ResourceDispatcherHostImpl::RegisterDownloadedTempFile( |
| 1791 int child_id, int request_id, const base::FilePath& file_path) { | 1796 int child_id, int request_id, const base::FilePath& file_path) { |
| 1792 scoped_refptr<ShareableFileReference> reference = | 1797 scoped_refptr<ShareableFileReference> reference = |
| 1793 ShareableFileReference::Get(file_path); | 1798 ShareableFileReference::Get(file_path); |
| 1794 DCHECK(reference.get()); | 1799 DCHECK(reference.get()); |
| 1795 | 1800 |
| 1796 registered_temp_files_[child_id][request_id] = reference; | 1801 registered_temp_files_[child_id][request_id] = reference; |
| 1797 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( | 1802 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( |
| (...skipping 1016 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2814 &throttles); | 2819 &throttles); |
| 2815 if (!throttles.empty()) { | 2820 if (!throttles.empty()) { |
| 2816 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2821 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
| 2817 std::move(throttles))); | 2822 std::move(throttles))); |
| 2818 } | 2823 } |
| 2819 } | 2824 } |
| 2820 return handler; | 2825 return handler; |
| 2821 } | 2826 } |
| 2822 | 2827 |
| 2823 } // namespace content | 2828 } // namespace content |
| OLD | NEW |