diff options
author | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-18 05:49:03 +0000 |
---|---|---|
committer | davidben@chromium.org <davidben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-11-18 05:49:03 +0000 |
commit | 3780874a5b4d7470daf71357a7d5d001347f50b7 (patch) | |
tree | cdca9150eef2a25fb0bf173be11cc9c8a5958eed /content/browser/loader/cross_site_resource_handler.cc | |
parent | 4477aae3367d44c3000b312b7e4b531babf35b66 (diff) | |
download | chromium_src-3780874a5b4d7470daf71357a7d5d001347f50b7.zip chromium_src-3780874a5b4d7470daf71357a7d5d001347f50b7.tar.gz chromium_src-3780874a5b4d7470daf71357a7d5d001347f50b7.tar.bz2 |
Make ResourceHandler::OnResponseCompleted take a defer output parameter.
Every other method of ResourceHandler returns false to abort and sets *defer to
cancel. Between the StreamResourceHandler fix here and
https://src.chromium.org/viewvc/chrome?view=rev&revision=233661, there were
twice as many ResourceHandlers that mistakenly deferred shutdown as
intentionally. (RedirectToFileResourceHandler and CrossSiteResourceHandler do
so intentionally.) Make this consistent so it's not as confusing.
BUG=none
Review URL: https://codereview.chromium.org/74373002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@235631 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/loader/cross_site_resource_handler.cc')
-rw-r--r-- | content/browser/loader/cross_site_resource_handler.cc | 26 |
1 files changed, 15 insertions, 11 deletions
diff --git a/content/browser/loader/cross_site_resource_handler.cc b/content/browser/loader/cross_site_resource_handler.cc index fa2f92f..f6274bd 100644 --- a/content/browser/loader/cross_site_resource_handler.cc +++ b/content/browser/loader/cross_site_resource_handler.cc @@ -130,10 +130,11 @@ bool CrossSiteResourceHandler::OnReadCompleted(int request_id, return next_handler_->OnReadCompleted(request_id, bytes_read, defer); } -bool CrossSiteResourceHandler::OnResponseCompleted( +void CrossSiteResourceHandler::OnResponseCompleted( int request_id, const net::URLRequestStatus& status, - const std::string& security_info) { + const std::string& security_info, + bool* defer) { if (!in_cross_site_transition_) { ResourceRequestInfoImpl* info = GetRequestInfo(); // If we've already completed the transition, or we're canceling the @@ -143,8 +144,9 @@ bool CrossSiteResourceHandler::OnResponseCompleted( status.status() != net::URLRequestStatus::FAILED || !CrossSiteRequestManager::GetInstance()->HasPendingCrossSiteRequest( info->GetChildID(), info->GetRouteID())) { - return next_handler_->OnResponseCompleted(request_id, status, - security_info); + next_handler_->OnResponseCompleted(request_id, status, + security_info, defer); + return; } // An error occurred. We should wait now for the cross-process transition, @@ -159,10 +161,10 @@ bool CrossSiteResourceHandler::OnResponseCompleted( completed_status_ = status; completed_security_info_ = security_info; - // Return false to tell RDH not to notify the world or clean up the - // pending request. We will do so in ResumeResponse. + // Defer to tell RDH not to notify the world or clean up the pending request. + // We will do so in ResumeResponse. did_defer_ = true; - return false; + *defer = true; } // We can now send the response to the new renderer, which will cause @@ -193,11 +195,13 @@ void CrossSiteResourceHandler::ResumeResponse() { // If the response completed during the transition, notify the next // event handler. if (completed_during_transition_) { - if (next_handler_->OnResponseCompleted(info->GetRequestID(), - completed_status_, - completed_security_info_)) { + bool defer = false; + next_handler_->OnResponseCompleted(info->GetRequestID(), + completed_status_, + completed_security_info_, + &defer); + if (!defer) ResumeIfDeferred(); - } } } |