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

Unified Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2262183002: [NoStatePrefetch] Do not send responses to renderer in prefetch mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@prefetchProto
Patch Set: Fix uninitialized variable Created 4 years, 4 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
« no previous file with comments | « no previous file | content/child/request_extra_data.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 847f0fd5f9d82e6dd5d54a4e4db3d75360c35fde..84c79752fba4c3982399688c5565ee399077b282 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -1638,12 +1638,17 @@ ResourceDispatcherHostImpl::CreateResourceHandler(
}
}
+ // In prefetch mode, only let the main resource go through.
+ bool start_detached = request_data.is_prefetch_only &&
mmenke 2016/08/23 15:11:41 |is_prefetch_only| seems confusing, given that we
+ request_data.resource_type != RESOURCE_TYPE_MAIN_FRAME;
mmenke 2016/08/23 15:11:42 I'm not a fan of this MAIN_FRAME logic here. Perh
+
// Prefetches and <a ping> requests outlive their child process.
- if (!sync_result && IsDetachableResourceType(request_data.resource_type)) {
+ if (!sync_result && (start_detached ||
+ IsDetachableResourceType(request_data.resource_type))) {
handler.reset(new DetachableResourceHandler(
request,
base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs),
- std::move(handler)));
+ start_detached ? nullptr : std::move(handler)));
mmenke 2016/08/23 15:11:41 We need to tell the renderer the request was abort
mmenke 2016/08/23 15:11:42 Could you update the DetachableResourceHandler doc
}
// PlzNavigate: If using --enable-browser-side-navigation, the
@@ -2640,6 +2645,9 @@ int ResourceDispatcherHostImpl::BuildLoadFlagsForRequest(
if (is_sync_load)
load_flags |= net::LOAD_IGNORE_LIMITS;
+ if (request_data.is_prefetch_only)
+ load_flags |= net::LOAD_PREFETCH;
+
return load_flags;
}
« no previous file with comments | « no previous file | content/child/request_extra_data.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698