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

Unified Diff: chrome/browser/renderer_host/resource_dispatcher_host.cc

Issue 3050016: Implement prefetching in chrome (Closed)
Patch Set: merge to trunk Created 10 years, 5 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 | « build/features_override.gypi ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/renderer_host/resource_dispatcher_host.cc
diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc
index 7e53a5e75a7fb4fe0b45dc8ea47a4243e9099053..92e851422a3aacf3c8f52cabf648163b63c5631a 100644
--- a/chrome/browser/renderer_host/resource_dispatcher_host.cc
+++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc
@@ -125,6 +125,10 @@ bool ShouldServiceRequest(ChildProcessInfo::ProcessType process_type,
if (process_type == ChildProcessInfo::PLUGIN_PROCESS)
return true;
+ if (request_data.resource_type == ResourceType::PREFETCH &&
+ CommandLine::ForCurrentProcess()->HasSwitch(switches::kDisablePrefetch))
+ return false;
+
ChildProcessSecurityPolicy* policy =
ChildProcessSecurityPolicy::GetInstance();
@@ -1837,12 +1841,17 @@ net::RequestPriority ResourceDispatcherHost::DetermineRequestPriority(
case ResourceType::SHARED_WORKER:
return net::LOW;
- // Images are the lowest priority because they typically do not block
+ // Images are the "lowest" priority because they typically do not block
// downloads or rendering and most pages have some useful content without
// them.
case ResourceType::IMAGE:
return net::LOWEST;
+ // Prefetches are at a lower priority than even LOWEST, since they
+ // are not even required for rendering of the current page.
+ case ResourceType::PREFETCH:
+ return net::IDLE;
+
default:
// When new resource types are added, their priority must be considered.
NOTREACHED();
« no previous file with comments | « build/features_override.gypi ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698