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

Unified 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index f2c1ac98e8cd6387941ada630c8b712ed8d68600..8cc50c6f05820225092b7d051a9878edc962c5ee 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -44,6 +44,7 @@
#include "content/browser/frame_host/navigator.h"
#include "content/browser/loader/async_resource_handler.h"
#include "content/browser/loader/async_revalidation_manager.h"
+#include "content/browser/loader/cross_site_resource_handler.h"
#include "content/browser/loader/detachable_resource_handler.h"
#include "content/browser/loader/intercepting_resource_handler.h"
#include "content/browser/loader/loader_delegate.h"
@@ -1172,6 +1173,9 @@ void ResourceDispatcherHostImpl::UpdateRequestForTransfer(
child_id, request_data.service_worker_provider_id);
}
}
+
+ // We should have a CrossSiteResourceHandler to finish the transfer.
+ DCHECK(info->cross_site_handler());
}
void ResourceDispatcherHostImpl::BeginRequest(
@@ -1577,6 +1581,28 @@ ResourceDispatcherHostImpl::CreateResourceHandler(
handler = std::move(detachable_handler);
}
+ // PlzNavigate: If using --enable-browser-side-navigation, the
+ // CrossSiteResourceHandler is not needed. This codepath is not used for the
+ // actual navigation request, but only the subsequent blob URL load. This does
+ // not require request transfers.
+ if (!IsBrowserSideNavigationEnabled()) {
+ // Install a CrossSiteResourceHandler for all main frame requests. This will
+ // check whether a transfer is required and, if so, pause for the UI thread
+ // to drive the transfer.
+ bool is_swappable_navigation =
+ request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME;
+ // If out-of-process iframes are possible, then all subframe requests need
+ // to go through the CrossSiteResourceHandler to enforce the site isolation
+ // policy.
+ if (!is_swappable_navigation &&
+ SiteIsolationPolicy::AreCrossProcessFramesPossible()) {
+ is_swappable_navigation =
+ request_data.resource_type == RESOURCE_TYPE_SUB_FRAME;
+ }
+ if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER)
+ handler.reset(new CrossSiteResourceHandler(std::move(handler), request));
+ }
+
return AddStandardHandlers(
request, request_data.resource_type, resource_context,
request_data.fetch_request_context_type, filter_->appcache_service(),
@@ -1822,8 +1848,8 @@ void ResourceDispatcherHostImpl::OnRenderViewHostSetIsLoading(int child_id,
void ResourceDispatcherHostImpl::MarkAsTransferredNavigation(
const GlobalRequestID& id,
- const base::Closure& on_transfer_complete_callback) {
- GetLoader(id)->MarkAsTransferring(on_transfer_complete_callback);
+ const scoped_refptr<ResourceResponse>& response) {
+ GetLoader(id)->MarkAsTransferring(response);
}
void ResourceDispatcherHostImpl::CancelTransferringNavigation(
« 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