Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2397893002: Revert the merge of CrossSiteResourceHandler and NavigationResourceThrottle. (Closed)
Patch Set: Add back initialization of started_from_context_menu_. Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 26 matching lines...) Expand all
37 #include "content/browser/appcache/chrome_appcache_service.h" 37 #include "content/browser/appcache/chrome_appcache_service.h"
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/cross_site_resource_handler.h"
47 #include "content/browser/loader/detachable_resource_handler.h" 48 #include "content/browser/loader/detachable_resource_handler.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"
(...skipping 1108 matching lines...) Expand 10 before | Expand all | Expand 10 after
1165 ServiceWorkerRequestHandler::GetHandler(loader_ptr->request()); 1166 ServiceWorkerRequestHandler::GetHandler(loader_ptr->request());
1166 if (handler) { 1167 if (handler) {
1167 if (!handler->SanityCheckIsSameContext(filter_->service_worker_context())) { 1168 if (!handler->SanityCheckIsSameContext(filter_->service_worker_context())) {
1168 bad_message::ReceivedBadMessage( 1169 bad_message::ReceivedBadMessage(
1169 filter_, bad_message::RDHI_WRONG_STORAGE_PARTITION); 1170 filter_, bad_message::RDHI_WRONG_STORAGE_PARTITION);
1170 } else { 1171 } else {
1171 handler->CompleteCrossSiteTransfer( 1172 handler->CompleteCrossSiteTransfer(
1172 child_id, request_data.service_worker_provider_id); 1173 child_id, request_data.service_worker_provider_id);
1173 } 1174 }
1174 } 1175 }
1176
1177 // We should have a CrossSiteResourceHandler to finish the transfer.
1178 DCHECK(info->cross_site_handler());
1175 } 1179 }
1176 1180
1177 void ResourceDispatcherHostImpl::BeginRequest( 1181 void ResourceDispatcherHostImpl::BeginRequest(
1178 int request_id, 1182 int request_id,
1179 const ResourceRequest& request_data, 1183 const ResourceRequest& request_data,
1180 IPC::Message* sync_result, // only valid for sync 1184 IPC::Message* sync_result, // only valid for sync
1181 int route_id, 1185 int route_id,
1182 mojo::InterfaceRequest<mojom::URLLoader> mojo_request, 1186 mojo::InterfaceRequest<mojom::URLLoader> mojo_request,
1183 mojom::URLLoaderClientPtr url_loader_client) { 1187 mojom::URLLoaderClientPtr url_loader_client) {
1184 int process_type = filter_->process_type(); 1188 int process_type = filter_->process_type();
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
1570 std::unique_ptr<DetachableResourceHandler> detachable_handler = 1574 std::unique_ptr<DetachableResourceHandler> detachable_handler =
1571 base::MakeUnique<DetachableResourceHandler>( 1575 base::MakeUnique<DetachableResourceHandler>(
1572 request, 1576 request,
1573 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), 1577 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs),
1574 std::move(handler)); 1578 std::move(handler));
1575 if (start_detached) 1579 if (start_detached)
1576 detachable_handler->Detach(); 1580 detachable_handler->Detach();
1577 handler = std::move(detachable_handler); 1581 handler = std::move(detachable_handler);
1578 } 1582 }
1579 1583
1584 // PlzNavigate: If using --enable-browser-side-navigation, the
1585 // CrossSiteResourceHandler is not needed. This codepath is not used for the
1586 // actual navigation request, but only the subsequent blob URL load. This does
1587 // not require request transfers.
1588 if (!IsBrowserSideNavigationEnabled()) {
1589 // Install a CrossSiteResourceHandler for all main frame requests. This will
1590 // check whether a transfer is required and, if so, pause for the UI thread
1591 // to drive the transfer.
1592 bool is_swappable_navigation =
1593 request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME;
1594 // If out-of-process iframes are possible, then all subframe requests need
1595 // to go through the CrossSiteResourceHandler to enforce the site isolation
1596 // policy.
1597 if (!is_swappable_navigation &&
1598 SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
1599 is_swappable_navigation =
1600 request_data.resource_type == RESOURCE_TYPE_SUB_FRAME;
1601 }
1602 if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER)
1603 handler.reset(new CrossSiteResourceHandler(std::move(handler), request));
1604 }
1605
1580 return AddStandardHandlers( 1606 return AddStandardHandlers(
1581 request, request_data.resource_type, resource_context, 1607 request, request_data.resource_type, resource_context,
1582 request_data.fetch_request_context_type, filter_->appcache_service(), 1608 request_data.fetch_request_context_type, filter_->appcache_service(),
1583 child_id, route_id, std::move(handler)); 1609 child_id, route_id, std::move(handler));
1584 } 1610 }
1585 1611
1586 std::unique_ptr<ResourceHandler> 1612 std::unique_ptr<ResourceHandler>
1587 ResourceDispatcherHostImpl::AddStandardHandlers( 1613 ResourceDispatcherHostImpl::AddStandardHandlers(
1588 net::URLRequest* request, 1614 net::URLRequest* request,
1589 ResourceType resource_type, 1615 ResourceType resource_type,
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
1815 } 1841 }
1816 1842
1817 void ResourceDispatcherHostImpl::OnRenderViewHostSetIsLoading(int child_id, 1843 void ResourceDispatcherHostImpl::OnRenderViewHostSetIsLoading(int child_id,
1818 int route_id, 1844 int route_id,
1819 bool is_loading) { 1845 bool is_loading) {
1820 scheduler_->OnLoadingStateChanged(child_id, route_id, !is_loading); 1846 scheduler_->OnLoadingStateChanged(child_id, route_id, !is_loading);
1821 } 1847 }
1822 1848
1823 void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( 1849 void ResourceDispatcherHostImpl::MarkAsTransferredNavigation(
1824 const GlobalRequestID& id, 1850 const GlobalRequestID& id,
1825 const base::Closure& on_transfer_complete_callback) { 1851 const scoped_refptr<ResourceResponse>& response) {
1826 GetLoader(id)->MarkAsTransferring(on_transfer_complete_callback); 1852 GetLoader(id)->MarkAsTransferring(response);
1827 } 1853 }
1828 1854
1829 void ResourceDispatcherHostImpl::CancelTransferringNavigation( 1855 void ResourceDispatcherHostImpl::CancelTransferringNavigation(
1830 const GlobalRequestID& id) { 1856 const GlobalRequestID& id) {
1831 // Request should still exist and be in the middle of a transfer. 1857 // Request should still exist and be in the middle of a transfer.
1832 DCHECK(IsTransferredNavigation(id)); 1858 DCHECK(IsTransferredNavigation(id));
1833 RemovePendingRequest(id.child_id, id.request_id); 1859 RemovePendingRequest(id.child_id, id.request_id);
1834 } 1860 }
1835 1861
1836 void ResourceDispatcherHostImpl::ResumeDeferredNavigation( 1862 void ResourceDispatcherHostImpl::ResumeDeferredNavigation(
(...skipping 866 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 &throttles); 2729 &throttles);
2704 if (!throttles.empty()) { 2730 if (!throttles.empty()) {
2705 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2731 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2706 std::move(throttles))); 2732 std::move(throttles)));
2707 } 2733 }
2708 } 2734 }
2709 return handler; 2735 return handler;
2710 } 2736 }
2711 2737
2712 } // namespace content 2738 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/loader/resource_dispatcher_host_impl.h ('k') | content/browser/loader/resource_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698