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

Unified Diff: chrome/browser/prerender/prerender_resource_throttle.h

Issue 2807163002: [Prerender] Restore request priorities when swapped in (Closed)
Patch Set: Fix test: default image priority can be LOWEST or MEDIUM 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.h
diff --git a/chrome/browser/prerender/prerender_resource_throttle.h b/chrome/browser/prerender/prerender_resource_throttle.h
index a9f853ec9ccb45379d74940b614b10688629d6d5..0302ec5e710298dafae4a28e357071045579c303 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.h
+++ b/chrome/browser/prerender/prerender_resource_throttle.h
@@ -10,10 +10,12 @@
#include "base/macros.h"
#include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h"
+#include "base/optional.h"
#include "chrome/common/prerender_types.h"
#include "content/public/browser/resource_request_info.h"
#include "content/public/browser/resource_throttle.h"
#include "content/public/common/resource_type.h"
+#include "net/base/request_priority.h"
class GURL;
@@ -50,6 +52,9 @@ class PrerenderResourceThrottle
// May only be called if currently throttling the resource.
void ResumeHandler();
+ // Resets the resource priority back to its original value.
+ void ResetResourcePriority();
+
static void OverridePrerenderContentsForTesting(PrerenderContents* contents);
private:
@@ -90,6 +95,11 @@ class PrerenderResourceThrottle
net::URLRequest* request_;
int load_flags_; // Load flags to be OR'ed with the existing request flags.
+ // The throttle changes most request priorities to IDLE during prerendering.
+ // The priority is reset back to the original priority when prerendering is
+ // finished.
+ base::Optional<net::RequestPriority> original_request_priority_;
+
scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info_;
DISALLOW_COPY_AND_ASSIGN(PrerenderResourceThrottle);

Powered by Google App Engine
This is Rietveld 408576698