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

Unified Diff: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc

Issue 2833553002: Revert of [Prerender] Restore request priorities when swapped in (Closed)
Patch Set: Created 3 years, 8 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 | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
diff --git a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
index cc36f63584bf41e131932889a297f929981c2f81..ef5d5c416c517d104df1545a7a32ef83e320887a 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -443,6 +443,27 @@
safe_browsing_->OnResourceRequest(request);
const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request);
+
+// The lowering of request priority causes issues with scheduling, since
+// content::ResourceScheduler uses it to delay and throttle requests. This is
+// disabled only on Android, as the prerenders are not likely to compete with
+// page loads there.
+// See https://crbug.com/652746 for details.
+// TODO(lizeb,droger): Fix the issue on all platforms.
+#if !defined(OS_ANDROID)
+ bool is_prerendering =
+ info->GetVisibilityState() == blink::kWebPageVisibilityStatePrerender;
+ if (is_prerendering) {
+ // Requests with the IGNORE_LIMITS flag set (i.e., sync XHRs)
+ // should remain at MAXIMUM_PRIORITY.
+ if (request->load_flags() & net::LOAD_IGNORE_LIMITS) {
+ DCHECK_EQ(request->priority(), net::MAXIMUM_PRIORITY);
+ } else {
+ request->SetPriority(net::IDLE);
+ }
+ }
+#endif // OS_ANDROID
+
ProfileIOData* io_data = ProfileIOData::FromResourceContext(
resource_context);
« no previous file with comments | « no previous file | chrome/browser/prerender/prerender_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698