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 27 matching lines...) Expand all Loading... |
38 #include "content/browser/bad_message.h" | 38 #include "content/browser/bad_message.h" |
39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 39 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
40 #include "content/browser/child_process_security_policy_impl.h" | 40 #include "content/browser/child_process_security_policy_impl.h" |
41 #include "content/browser/frame_host/frame_tree.h" | 41 #include "content/browser/frame_host/frame_tree.h" |
42 #include "content/browser/frame_host/navigation_handle_impl.h" | 42 #include "content/browser/frame_host/navigation_handle_impl.h" |
43 #include "content/browser/frame_host/navigation_request_info.h" | 43 #include "content/browser/frame_host/navigation_request_info.h" |
44 #include "content/browser/frame_host/navigator.h" | 44 #include "content/browser/frame_host/navigator.h" |
45 #include "content/browser/loader/async_resource_handler.h" | 45 #include "content/browser/loader/async_resource_handler.h" |
46 #include "content/browser/loader/async_revalidation_manager.h" | 46 #include "content/browser/loader/async_revalidation_manager.h" |
47 #include "content/browser/loader/detachable_resource_handler.h" | 47 #include "content/browser/loader/detachable_resource_handler.h" |
| 48 #include "content/browser/loader/downloaded_temp_file_impl.h" |
48 #include "content/browser/loader/intercepting_resource_handler.h" | 49 #include "content/browser/loader/intercepting_resource_handler.h" |
49 #include "content/browser/loader/loader_delegate.h" | 50 #include "content/browser/loader/loader_delegate.h" |
50 #include "content/browser/loader/mime_sniffing_resource_handler.h" | 51 #include "content/browser/loader/mime_sniffing_resource_handler.h" |
51 #include "content/browser/loader/mojo_async_resource_handler.h" | 52 #include "content/browser/loader/mojo_async_resource_handler.h" |
52 #include "content/browser/loader/navigation_resource_handler.h" | 53 #include "content/browser/loader/navigation_resource_handler.h" |
53 #include "content/browser/loader/navigation_resource_throttle.h" | 54 #include "content/browser/loader/navigation_resource_throttle.h" |
54 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 55 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
55 #include "content/browser/loader/power_save_block_resource_throttle.h" | 56 #include "content/browser/loader/power_save_block_resource_throttle.h" |
56 #include "content/browser/loader/redirect_to_file_resource_handler.h" | 57 #include "content/browser/loader/redirect_to_file_resource_handler.h" |
57 #include "content/browser/loader/resource_message_filter.h" | 58 #include "content/browser/loader/resource_message_filter.h" |
(...skipping 1701 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1759 // The request may go away before processing this message, so |loader| can | 1760 // The request may go away before processing this message, so |loader| can |
1760 // legitimately be null. | 1761 // legitimately be null. |
1761 if (!loader) | 1762 if (!loader) |
1762 return; | 1763 return; |
1763 | 1764 |
1764 scheduler_->ReprioritizeRequest(loader->request(), new_priority, | 1765 scheduler_->ReprioritizeRequest(loader->request(), new_priority, |
1765 intra_priority_value); | 1766 intra_priority_value); |
1766 } | 1767 } |
1767 | 1768 |
1768 void ResourceDispatcherHostImpl::RegisterDownloadedTempFile( | 1769 void ResourceDispatcherHostImpl::RegisterDownloadedTempFile( |
1769 int child_id, int request_id, const base::FilePath& file_path) { | 1770 std::unique_ptr<DownloadedTempFileImpl> downloaded_file) { |
1770 scoped_refptr<ShareableFileReference> reference = | 1771 int child_id = downloaded_file->child_id(); |
1771 ShareableFileReference::Get(file_path); | 1772 int request_id = downloaded_file->request_id(); |
1772 DCHECK(reference.get()); | 1773 scoped_refptr<storage::ShareableFileReference> reference = |
| 1774 downloaded_file->reference(); |
1773 | 1775 |
1774 registered_temp_files_[child_id][request_id] = reference; | 1776 registered_temp_files_[child_id][request_id] = std::move(downloaded_file); |
1775 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( | 1777 ChildProcessSecurityPolicyImpl::GetInstance()->GrantReadFile( |
1776 child_id, reference->path()); | 1778 child_id, reference->path()); |
1777 | 1779 |
1778 // When the temp file is deleted, revoke permissions that the renderer has | 1780 // When the temp file is deleted, revoke permissions that the renderer has |
1779 // to that file. This covers an edge case where the file is deleted and then | 1781 // to that file. This covers an edge case where the file is deleted and then |
1780 // the same name is re-used for some other purpose, we don't want the old | 1782 // the same name is re-used for some other purpose, we don't want the old |
1781 // renderer to still have access to it. | 1783 // renderer to still have access to it. |
1782 // | 1784 // |
1783 // We do this when the file is deleted because the renderer can take a blob | 1785 // We do this when the file is deleted because the renderer can take a blob |
1784 // reference to the temp file that outlives the url loaded that it was | 1786 // reference to the temp file that outlives the url loaded that it was |
(...skipping 1007 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2792 &throttles); | 2794 &throttles); |
2793 if (!throttles.empty()) { | 2795 if (!throttles.empty()) { |
2794 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2796 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2795 std::move(throttles))); | 2797 std::move(throttles))); |
2796 } | 2798 } |
2797 } | 2799 } |
2798 return handler; | 2800 return handler; |
2799 } | 2801 } |
2800 | 2802 |
2801 } // namespace content | 2803 } // namespace content |
OLD | NEW |