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

Unified Diff: content/browser/loader/resource_loader.cc

Issue 2597563002: Revert of Move ResourceHandler deferred actions ahead of external protocol handling. (Closed)
Patch Set: Created 4 years 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 | « content/browser/loader/resource_loader.h ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/loader/resource_loader.cc
diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc
index e30970b991e525ca45aaf946afc12a8ecc6b6e99..bb77021ac8fa20c3d369154da1b6f0adcd0df945 100644
--- a/content/browser/loader/resource_loader.cc
+++ b/content/browser/loader/resource_loader.cc
@@ -157,6 +157,11 @@
}
void ResourceLoader::StartRequest() {
+ if (delegate_->HandleExternalProtocol(this, request_->url())) {
+ CancelAndIgnore();
+ return;
+ }
+
// Give the handler a chance to delay the URLRequest from being started.
bool defer_start = false;
if (!handler_->OnWillStart(request_->url(), &defer_start)) {
@@ -268,6 +273,12 @@
}
}
+ if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
+ // The request is complete so we can remove it.
+ CancelAndIgnore();
+ return;
+ }
+
scoped_refptr<ResourceResponse> response = new ResourceResponse();
PopulateResourceResponse(info, request_.get(), response.get());
delegate_->DidReceiveRedirect(this, redirect_info.new_url, response.get());
@@ -275,12 +286,6 @@
Cancel();
} else if (*defer) {
deferred_stage_ = DEFERRED_REDIRECT; // Follow redirect when resumed.
- DCHECK(deferred_redirect_url_.is_empty());
- deferred_redirect_url_ = redirect_info.new_url;
- } else if (delegate_->HandleExternalProtocol(this, redirect_info.new_url)) {
- // The request is complete so we can remove it.
- CancelAndIgnore();
- return;
}
}
@@ -445,7 +450,7 @@
StartRequestInternal();
break;
case DEFERRED_REDIRECT:
- FollowDeferredRedirectInternal();
+ request_->FollowDeferredRedirect();
break;
case DEFERRED_READ:
base::ThreadTaskRunnerHandle::Get()->PostTask(
@@ -473,14 +478,7 @@
void ResourceLoader::StartRequestInternal() {
DCHECK(!request_->is_pending());
- // Note: at this point any possible deferred start actions are already over.
-
if (!request_->status().is_success()) {
- return;
- }
-
- if (delegate_->HandleExternalProtocol(this, request_->url())) {
- CancelAndIgnore();
return;
}
@@ -533,17 +531,6 @@
base::ThreadTaskRunnerHandle::Get()->PostTask(
FROM_HERE, base::Bind(&ResourceLoader::ResponseCompleted,
weak_ptr_factory_.GetWeakPtr()));
- }
-}
-
-void ResourceLoader::FollowDeferredRedirectInternal() {
- DCHECK(!deferred_redirect_url_.is_empty());
- GURL redirect_url = deferred_redirect_url_;
- deferred_redirect_url_ = GURL();
- if (delegate_->HandleExternalProtocol(this, deferred_redirect_url_)) {
- CancelAndIgnore();
- } else {
- request_->FollowDeferredRedirect();
}
}
« no previous file with comments | « content/browser/loader/resource_loader.h ('k') | content/browser/loader/resource_loader_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698