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

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

Issue 2411663002: prerender: Don't set the priority to net::IDLE on Android. (Closed)
Patch Set: 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
« no previous file with comments | « no previous file | no next file » | 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 97cb50e63cb009c469b17f04e21d99a5de1ca62e..e4589d63e23a7ad3ff07783bdf450e2cebb5beba 100644
--- a/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
+++ b/chrome/browser/loader/chrome_resource_dispatcher_host_delegate.cc
@@ -253,9 +253,15 @@ void LaunchURL(
#if !defined(DISABLE_NACL)
void AppendComponentUpdaterThrottles(
net::URLRequest* request,
+ const ResourceRequestInfo& info,
content::ResourceContext* resource_context,
ResourceType resource_type,
ScopedVector<content::ResourceThrottle>* throttles) {
+ bool is_prerendering =
+ info.GetVisibilityState() == blink::WebPageVisibilityStatePrerender;
+ if (is_prerendering)
+ return;
+
const char* crx_id = NULL;
component_updater::ComponentUpdateService* cus =
g_browser_process->component_updater();
@@ -422,6 +428,14 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
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::WebPageVisibilityStatePrerender;
if (is_prerendering) {
@@ -433,6 +447,7 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
request->SetPriority(net::IDLE);
}
}
+#endif // OS_ANDROID
ProfileIOData* io_data = ProfileIOData::FromResourceContext(
resource_context);
@@ -482,13 +497,9 @@ void ChromeResourceDispatcherHostDelegate::RequestBeginning(
resource_type,
throttles);
#if !defined(DISABLE_NACL)
- if (!is_prerendering) {
- AppendComponentUpdaterThrottles(request,
- resource_context,
- resource_type,
- throttles);
- }
-#endif
+ AppendComponentUpdaterThrottles(request, *info, resource_context,
+ resource_type, throttles);
+#endif // !defined(DISABLE_NACL)
if (io_data->resource_prefetch_predictor_observer()) {
io_data->resource_prefetch_predictor_observer()->OnRequestStarted(
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698