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

Unified Diff: chrome/browser/prerender/prerender_resource_throttle.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
Index: chrome/browser/prerender/prerender_resource_throttle.cc
diff --git a/chrome/browser/prerender/prerender_resource_throttle.cc b/chrome/browser/prerender/prerender_resource_throttle.cc
index b6ed41fdabf0878b3bce20130d8cb5f42a0cec50..afd908fe6db2c2b387927c3fea5619109a906278 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.cc
+++ b/chrome/browser/prerender/prerender_resource_throttle.cc
@@ -12,7 +12,6 @@
#include "chrome/browser/prerender/prerender_manager.h"
#include "chrome/browser/prerender/prerender_util.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/resource_dispatcher_host.h"
#include "content/public/browser/web_contents.h"
#include "net/base/load_flags.h"
#include "net/http/http_response_headers.h"
@@ -86,29 +85,7 @@
PrerenderResourceThrottle::PrerenderResourceThrottle(net::URLRequest* request)
: request_(request),
load_flags_(net::LOAD_NORMAL),
- prerender_throttle_info_(new PrerenderThrottleInfo()) {
-// Priorities for prerendering requests are lowered, to avoid competing with
-// other page loads, except on Android where this is less likely to be a
-// problem. In some cases, this may negatively impact the performance of
-// prerendering, see https://crbug.com/652746 for details.
-#if !defined(OS_ANDROID)
- // 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 if (request_->priority() != net::IDLE) {
- original_request_priority_ = request_->priority();
- // In practice, the resource scheduler does not know about the request yet,
- // and it falls back to calling request_->SetPriority(), so it would be
- // possible to do just that here. It is cleaner and more robust to go
- // through the resource dispatcher host though.
- if (content::ResourceDispatcherHost::Get()) {
- content::ResourceDispatcherHost::Get()->ReprioritizeRequest(request_,
- net::IDLE);
- }
- }
-#endif // OS_ANDROID
-}
+ prerender_throttle_info_(new PrerenderThrottleInfo()) {}
PrerenderResourceThrottle::~PrerenderResourceThrottle() {}
@@ -117,7 +94,6 @@
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request_);
*defer = true;
-
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
base::Bind(&PrerenderResourceThrottle::WillStartRequestOnUI, AsWeakPtr(),
@@ -171,16 +147,6 @@
DCHECK_CURRENTLY_ON(BrowserThread::IO);
request_->SetLoadFlags(request_->load_flags() | load_flags_);
Resume();
-}
-
-void PrerenderResourceThrottle::ResetResourcePriority() {
- if (!original_request_priority_)
- return;
-
- if (content::ResourceDispatcherHost::Get()) {
- content::ResourceDispatcherHost::Get()->ReprioritizeRequest(
- request_, original_request_priority_.value());
- }
}
// static
@@ -236,16 +202,9 @@
// Delay icon fetching until the contents are getting swapped in
// to conserve network usage in mobile devices.
prerender_contents->AddResourceThrottle(throttle);
-
- // No need to call AddIdleResource() on Android.
return;
#endif
}
-
-#if !defined(OS_ANDROID)
- if (!cancel)
- prerender_contents->AddIdleResource(throttle);
-#endif
}
BrowserThread::PostTask(
« no previous file with comments | « chrome/browser/prerender/prerender_resource_throttle.h ('k') | chrome/browser/prerender/prerender_test_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698