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

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

Issue 6966016: Handle <link rel=prerender> in chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to reviews Created 9 years, 7 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/renderer_host/resource_dispatcher_host.cc
diff --git a/content/browser/renderer_host/resource_dispatcher_host.cc b/content/browser/renderer_host/resource_dispatcher_host.cc
index 451f99e0ecae7defef1fa19d4d1f219d3df29a11..39ada1258f575fa91059e332281e1efedb38c739 100644
--- a/content/browser/renderer_host/resource_dispatcher_host.cc
+++ b/content/browser/renderer_host/resource_dispatcher_host.cc
@@ -438,9 +438,7 @@ void ResourceDispatcherHost::BeginRequest(
child_id, route_id);
// Handle a PREFETCH resource type. If prefetch is disabled, squelch the
- // request. If prerendering is enabled, trigger a prerender for the URL
- // and abort the request, to prevent double-gets. Otherwise, do a normal
- // prefetch.
+ // request. Otherwise, do a normal request to warm the cache.
if (request_data.resource_type == ResourceType::PREFETCH) {
// All PREFETCH requests should be GETs, but be defensive about it.
if (request_data.method != "GET") {
@@ -451,20 +449,26 @@ void ResourceDispatcherHost::BeginRequest(
AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
return;
}
+ // Otherwise, treat like a normal request, and fall-through.
+ }
+
+ // Handle a PRERENDER motivated request. Very similar to rel=prefetch, these
+ // rel=prerender requests instead launch an early render of the entire page.
+ if (request_data.resource_type == ResourceType::PRERENDER) {
if (prerender::PrerenderManager::IsPrerenderingPossible()) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
- NewRunnableFunction(prerender::HandlePrefetchTag,
+ NewRunnableFunction(prerender::HandleTag,
resource_context.prerender_manager(),
child_id,
route_id,
request_data.url,
referrer,
is_prerendering));
- AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
- return;
}
- // Otherwise, treat like a normal request, and fall-through.
+ // Prerendering or not, this request should stop.
+ AbortRequestBeforeItStarts(filter_, sync_result, route_id, request_id);
+ return;
}
// Abort any prerenders that spawn requests that use invalid HTTP methods.
@@ -525,7 +529,7 @@ void ResourceDispatcherHost::BeginRequest(
}
if (is_prerendering)
- load_flags |= net::LOAD_PRERENDER;
+ load_flags |= net::LOAD_PRERENDERING;
if (sync_result)
load_flags |= net::LOAD_IGNORE_LIMITS;
@@ -1982,7 +1986,7 @@ net::RequestPriority ResourceDispatcherHost::DetermineRequestPriority(
// * How useful is the page to the user if this resource is not loaded yet.
// Prerender-motivated requests should be made at IDLE.
- if (load_flags & net::LOAD_PRERENDER)
+ if (load_flags & net::LOAD_PRERENDERING)
return net::IDLE;
switch (type) {
@@ -2022,9 +2026,11 @@ net::RequestPriority ResourceDispatcherHost::DetermineRequestPriority(
case ResourceType::FAVICON:
return net::LOWEST;
- // Prefetches are at a lower priority than even LOWEST, since they
- // are not even required for rendering of the current page.
+ // Prefetches & prerenders are at a lower priority than even
cbentzel 2011/05/24 03:11:07 Nit: I'd spell out "and" rather than &, which make
gavinp 2011/05/24 13:02:52 Done.
+ // LOWEST, since they are not even required for rendering of the
+ // current page.
case ResourceType::PREFETCH:
+ case ResourceType::PRERENDER:
return net::IDLE;
default:

Powered by Google App Engine
This is Rietveld 408576698