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/renderer_host/resource_dispatcher_host_impl.h" | 7 #include "content/browser/renderer_host/resource_dispatcher_host_impl.h" |
8 | 8 |
9 #include <set> | 9 #include <set> |
10 #include <vector> | 10 #include <vector> |
(...skipping 17 matching lines...) Expand all Loading... | |
28 #include "content/browser/cross_site_request_manager.h" | 28 #include "content/browser/cross_site_request_manager.h" |
29 #include "content/browser/download/download_file_manager.h" | 29 #include "content/browser/download/download_file_manager.h" |
30 #include "content/browser/download/download_resource_handler.h" | 30 #include "content/browser/download/download_resource_handler.h" |
31 #include "content/browser/download/save_file_manager.h" | 31 #include "content/browser/download/save_file_manager.h" |
32 #include "content/browser/download/save_file_resource_handler.h" | 32 #include "content/browser/download/save_file_resource_handler.h" |
33 #include "content/browser/fileapi/chrome_blob_storage_context.h" | 33 #include "content/browser/fileapi/chrome_blob_storage_context.h" |
34 #include "content/browser/plugin_service_impl.h" | 34 #include "content/browser/plugin_service_impl.h" |
35 #include "content/browser/renderer_host/async_resource_handler.h" | 35 #include "content/browser/renderer_host/async_resource_handler.h" |
36 #include "content/browser/renderer_host/buffered_resource_handler.h" | 36 #include "content/browser/renderer_host/buffered_resource_handler.h" |
37 #include "content/browser/renderer_host/cross_site_resource_handler.h" | 37 #include "content/browser/renderer_host/cross_site_resource_handler.h" |
38 #include "content/browser/renderer_host/duplicate_resource_handler.h" | |
38 #include "content/browser/renderer_host/redirect_to_file_resource_handler.h" | 39 #include "content/browser/renderer_host/redirect_to_file_resource_handler.h" |
39 #include "content/browser/renderer_host/render_view_host_delegate.h" | 40 #include "content/browser/renderer_host/render_view_host_delegate.h" |
40 #include "content/browser/renderer_host/render_view_host_impl.h" | 41 #include "content/browser/renderer_host/render_view_host_impl.h" |
41 #include "content/browser/renderer_host/resource_message_filter.h" | 42 #include "content/browser/renderer_host/resource_message_filter.h" |
42 #include "content/browser/renderer_host/transfer_navigation_resource_throttle.h" | 43 #include "content/browser/renderer_host/transfer_navigation_resource_throttle.h" |
43 #include "content/browser/renderer_host/resource_request_info_impl.h" | 44 #include "content/browser/renderer_host/resource_request_info_impl.h" |
44 #include "content/browser/renderer_host/sync_resource_handler.h" | 45 #include "content/browser/renderer_host/sync_resource_handler.h" |
45 #include "content/browser/renderer_host/throttling_resource_handler.h" | 46 #include "content/browser/renderer_host/throttling_resource_handler.h" |
46 #include "content/browser/resource_context_impl.h" | 47 #include "content/browser/resource_context_impl.h" |
47 #include "content/browser/worker_host/worker_service_impl.h" | 48 #include "content/browser/worker_host/worker_service_impl.h" |
(...skipping 960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1008 | 1009 |
1009 // Construct the IPC resource handler. | 1010 // Construct the IPC resource handler. |
1010 scoped_ptr<ResourceHandler> handler; | 1011 scoped_ptr<ResourceHandler> handler; |
1011 if (sync_result) { | 1012 if (sync_result) { |
1012 handler.reset(new SyncResourceHandler( | 1013 handler.reset(new SyncResourceHandler( |
1013 filter_, request, sync_result, this)); | 1014 filter_, request, sync_result, this)); |
1014 } else { | 1015 } else { |
1015 handler.reset(new AsyncResourceHandler( | 1016 handler.reset(new AsyncResourceHandler( |
1016 filter_, route_id, request, this)); | 1017 filter_, route_id, request, this)); |
1017 } | 1018 } |
1018 | 1019 |
1019 // The RedirectToFileResourceHandler depends on being next in the chain. | 1020 // The RedirectToFileResourceHandler depends on being next in the chain. |
1020 if (request_data.download_to_file) { | 1021 if (request_data.download_to_file) { |
1021 handler.reset( | 1022 handler.reset( |
1022 new RedirectToFileResourceHandler(handler.Pass(), child_id, this)); | 1023 new RedirectToFileResourceHandler(handler.Pass(), child_id, this)); |
1023 } | 1024 } |
1024 | 1025 |
1025 // Install a CrossSiteResourceHandler if this request is coming from a | 1026 // Install a CrossSiteResourceHandler if this request is coming from a |
1026 // RenderViewHost with a pending cross-site request. We only check this for | 1027 // RenderViewHost with a pending cross-site request. We only check this for |
1027 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do | 1028 // MAIN_FRAME requests. Unblock requests only come from a blocked page, do |
1028 // not count as cross-site, otherwise it gets blocked indefinitely. | 1029 // not count as cross-site, otherwise it gets blocked indefinitely. |
1029 if (request_data.resource_type == ResourceType::MAIN_FRAME && | 1030 if (request_data.resource_type == ResourceType::MAIN_FRAME && |
1030 process_type == PROCESS_TYPE_RENDERER && | 1031 process_type == PROCESS_TYPE_RENDERER && |
1031 CrossSiteRequestManager::GetInstance()-> | 1032 CrossSiteRequestManager::GetInstance()-> |
1032 HasPendingCrossSiteRequest(child_id, route_id)) { | 1033 HasPendingCrossSiteRequest(child_id, route_id)) { |
1033 // Wrap the event handler to be sure the current page's onunload handler | 1034 // Wrap the event handler to be sure the current page's onunload handler |
1034 // has a chance to run before we render the new page. | 1035 // has a chance to run before we render the new page. |
1035 handler.reset(new CrossSiteResourceHandler(handler.Pass(), child_id, | 1036 handler.reset(new CrossSiteResourceHandler(handler.Pass(), child_id, |
1036 route_id, request)); | 1037 route_id, request)); |
1037 } | 1038 } |
1038 | 1039 |
1039 // Insert a buffered event handler before the actual one. | 1040 // Insert a buffered event handler before the actual one. |
1040 handler.reset( | 1041 handler.reset( |
1041 new BufferedResourceHandler(handler.Pass(), this, request)); | 1042 new BufferedResourceHandler(handler.Pass(), this, request)); |
1042 | 1043 |
1044 handler.reset( | |
1045 new DuplicateResourceHandler(handler.Pass(), request)); | |
frankwang
2012/07/12 21:50:36
I am not sure if this is in the right spot in term
| |
1046 | |
1043 ScopedVector<ResourceThrottle> throttles; | 1047 ScopedVector<ResourceThrottle> throttles; |
1044 if (delegate_) { | 1048 if (delegate_) { |
1045 bool is_continuation_of_transferred_request = | 1049 bool is_continuation_of_transferred_request = |
1046 (deferred_loader.get() != NULL); | 1050 (deferred_loader.get() != NULL); |
1047 | 1051 |
1048 delegate_->RequestBeginning(request, | 1052 delegate_->RequestBeginning(request, |
1049 resource_context, | 1053 resource_context, |
1050 request_data.resource_type, | 1054 request_data.resource_type, |
1051 child_id, | 1055 child_id, |
1052 route_id, | 1056 route_id, |
(...skipping 664 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1717 | 1721 |
1718 return i->second.get(); | 1722 return i->second.get(); |
1719 } | 1723 } |
1720 | 1724 |
1721 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, | 1725 ResourceLoader* ResourceDispatcherHostImpl::GetLoader(int child_id, |
1722 int request_id) const { | 1726 int request_id) const { |
1723 return GetLoader(GlobalRequestID(child_id, request_id)); | 1727 return GetLoader(GlobalRequestID(child_id, request_id)); |
1724 } | 1728 } |
1725 | 1729 |
1726 } // namespace content | 1730 } // namespace content |
OLD | NEW |