diff options
author | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-25 22:05:14 +0000 |
---|---|---|
committer | creis@chromium.org <creis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-09-25 22:05:14 +0000 |
commit | 1f291cd57a56e70369dc2e47e3d4be6102254102 (patch) | |
tree | 39f02a836e501f01967e46917303af0fbe785ae0 /content/browser/loader/throttling_resource_handler.cc | |
parent | 0cb485cc68f91d337534372ebfd5d3a6b24ce7c3 (diff) | |
download | chromium_src-1f291cd57a56e70369dc2e47e3d4be6102254102.zip chromium_src-1f291cd57a56e70369dc2e47e3d4be6102254102.tar.gz chromium_src-1f291cd57a56e70369dc2e47e3d4be6102254102.tar.bz2 |
Make ResourceHandlers stateless with respect to child/routing/request IDs.
This lets us transfer an existing handler chain to a new process.
BUG=238331
TEST=Follow a link that redirects to the Chrome Web Store.
R=ajwong@chromium.org, darin@chromium.org, mpcomplete@chromium.org
Review URL: https://codereview.chromium.org/23180005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@225263 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/throttling_resource_handler.cc')
-rw-r--r-- | content/browser/loader/throttling_resource_handler.cc | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/content/browser/loader/throttling_resource_handler.cc b/content/browser/loader/throttling_resource_handler.cc index 5725e03..8bb5446 100644 --- a/content/browser/loader/throttling_resource_handler.cc +++ b/content/browser/loader/throttling_resource_handler.cc @@ -4,6 +4,7 @@ #include "content/browser/loader/throttling_resource_handler.h" +#include "content/public/browser/resource_request_info.h" #include "content/public/browser/resource_throttle.h" #include "content/public/common/resource_response.h" @@ -11,12 +12,11 @@ namespace content { ThrottlingResourceHandler::ThrottlingResourceHandler( scoped_ptr<ResourceHandler> next_handler, - int child_id, - int request_id, + net::URLRequest* request, ScopedVector<ResourceThrottle> throttles) : LayeredResourceHandler(next_handler.Pass()), deferred_stage_(DEFERRED_NONE), - request_id_(request_id), + request_(request), throttles_(throttles.Pass()), index_(0), cancelled_by_resource_throttle_(false) { @@ -31,7 +31,6 @@ bool ThrottlingResourceHandler::OnRequestRedirected(int request_id, const GURL& new_url, ResourceResponse* response, bool* defer) { - DCHECK_EQ(request_id_, request_id); DCHECK(!cancelled_by_resource_throttle_); *defer = false; @@ -57,7 +56,6 @@ bool ThrottlingResourceHandler::OnRequestRedirected(int request_id, bool ThrottlingResourceHandler::OnWillStart(int request_id, const GURL& url, bool* defer) { - DCHECK_EQ(request_id_, request_id); DCHECK(!cancelled_by_resource_throttle_); *defer = false; @@ -81,7 +79,6 @@ bool ThrottlingResourceHandler::OnWillStart(int request_id, bool ThrottlingResourceHandler::OnResponseStarted(int request_id, ResourceResponse* response, bool* defer) { - DCHECK_EQ(request_id_, request_id); DCHECK(!cancelled_by_resource_throttle_); while (index_ < throttles_.size()) { @@ -144,7 +141,8 @@ void ThrottlingResourceHandler::ResumeStart() { deferred_url_ = GURL(); bool defer = false; - if (!OnWillStart(request_id_, url, &defer)) { + const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); + if (!OnWillStart(info->GetRequestID(), url, &defer)) { controller()->Cancel(); } else if (!defer) { controller()->Resume(); @@ -160,7 +158,9 @@ void ThrottlingResourceHandler::ResumeRedirect() { deferred_response_.swap(response); bool defer = false; - if (!OnRequestRedirected(request_id_, new_url, response.get(), &defer)) { + const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); + if (!OnRequestRedirected(info->GetRequestID(), new_url, response.get(), + &defer)) { controller()->Cancel(); } else if (!defer) { controller()->Resume(); @@ -174,7 +174,8 @@ void ThrottlingResourceHandler::ResumeResponse() { deferred_response_.swap(response); bool defer = false; - if (!OnResponseStarted(request_id_, response.get(), &defer)) { + const ResourceRequestInfo* info = ResourceRequestInfo::ForRequest(request_); + if (!OnResponseStarted(info->GetRequestID(), response.get(), &defer)) { controller()->Cancel(); } else if (!defer) { controller()->Resume(); |