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

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

Issue 2605503002: Prerender: Add thread checks to PrerenderResourceThrottle (Closed)
Patch Set: BrowserThread::IO (without content::) everywhere for consistency Created 3 years, 11 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 | « chrome/browser/prerender/prerender_resource_throttle.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 df57aa36620930cec613afaab18205b7a9c4355b..8d8511e22e2fc16a1612f39e862089171ecc2afa 100644
--- a/chrome/browser/prerender/prerender_resource_throttle.cc
+++ b/chrome/browser/prerender/prerender_resource_throttle.cc
@@ -90,6 +90,7 @@ PrerenderResourceThrottle::PrerenderResourceThrottle(net::URLRequest* request)
PrerenderResourceThrottle::~PrerenderResourceThrottle() {}
void PrerenderResourceThrottle::WillStartRequest(bool* defer) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request_);
*defer = true;
@@ -104,6 +105,7 @@ void PrerenderResourceThrottle::WillStartRequest(bool* defer) {
void PrerenderResourceThrottle::WillRedirectRequest(
const net::RedirectInfo& redirect_info,
bool* defer) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request_);
*defer = true;
@@ -119,6 +121,7 @@ void PrerenderResourceThrottle::WillRedirectRequest(
}
void PrerenderResourceThrottle::WillProcessResponse(bool* defer) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request_);
if (!info)
@@ -141,6 +144,7 @@ const char* PrerenderResourceThrottle::GetNameForLogging() const {
}
void PrerenderResourceThrottle::ResumeHandler() {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
request_->SetLoadFlags(request_->load_flags() | load_flags_);
Resume();
}
@@ -153,6 +157,7 @@ void PrerenderResourceThrottle::WillStartRequestOnUI(
const GURL& url,
const ResourceRequestInfo::WebContentsGetter& web_contents_getter,
scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
bool cancel = false;
PrerenderContents* prerender_contents =
PrerenderContentsFromGetter(web_contents_getter);
@@ -213,6 +218,7 @@ void PrerenderResourceThrottle::WillRedirectRequestOnUI(
bool is_no_store,
const GURL& new_url,
const ResourceRequestInfo::WebContentsGetter& web_contents_getter) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
bool cancel = false;
PrerenderContents* prerender_contents =
PrerenderContentsFromGetter(web_contents_getter);
@@ -256,6 +262,7 @@ void PrerenderResourceThrottle::WillProcessResponseOnUI(
bool is_no_store,
int redirect_count,
scoped_refptr<PrerenderThrottleInfo> prerender_throttle_info) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
DCHECK(prerender_throttle_info);
if (!prerender_throttle_info->manager())
return;
@@ -273,12 +280,14 @@ void PrerenderResourceThrottle::WillProcessResponseOnUI(
// static
PrerenderContents* PrerenderResourceThrottle::PrerenderContentsFromGetter(
const ResourceRequestInfo::WebContentsGetter& web_contents_getter) {
+ DCHECK_CURRENTLY_ON(BrowserThread::UI);
if (g_prerender_contents_for_testing)
return g_prerender_contents_for_testing;
return PrerenderContents::FromWebContents(web_contents_getter.Run());
}
void PrerenderResourceThrottle::SetPrerenderMode(PrerenderMode mode) {
+ DCHECK_CURRENTLY_ON(BrowserThread::IO);
load_flags_ = (mode == PREFETCH_ONLY) ? net::LOAD_PREFETCH : net::LOAD_NORMAL;
}
« no previous file with comments | « chrome/browser/prerender/prerender_resource_throttle.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698