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

Unified Diff: content/browser/renderer_host/cross_site_resource_handler.cc

Issue 10501004: Refactor the guts of ResourceDispatcherHostImpl into a new class named (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 6 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: content/browser/renderer_host/cross_site_resource_handler.cc
===================================================================
--- content/browser/renderer_host/cross_site_resource_handler.cc (revision 141889)
+++ content/browser/renderer_host/cross_site_resource_handler.cc (working copy)
@@ -47,6 +47,7 @@
in_cross_site_transition_(false),
request_id_(-1),
completed_during_transition_(false),
+ did_defer_(false),
completed_status_(),
response_(NULL),
rdh_(rdh) {
@@ -170,11 +171,11 @@
DCHECK(response_);
bool defer = false;
if (!next_handler_->OnResponseStarted(request_id_, response_, &defer)) {
- rdh_->CancelRequest(render_process_host_id_, request_id_, false);
+ controller()->Cancel();
} else if (!defer) {
// Unpause the request to resume reading. Any further reads will be
// directed toward the new renderer.
- rdh_->ResumeDeferredRequest(render_process_host_id_, request_id_);
+ ResumeIfDeferred();
}
}
@@ -186,11 +187,10 @@
// If the response completed during the transition, notify the next
// event handler.
if (completed_during_transition_) {
- next_handler_->OnResponseCompleted(request_id_, completed_status_,
- completed_security_info_);
- // TODO(darin): OnResponseCompleted can return false to defer
- // RemovePendingRequest.
- rdh_->RemovePendingRequest(render_process_host_id_, request_id_);
+ if (next_handler_->OnResponseCompleted(request_id_, completed_status_,
+ completed_security_info_)) {
+ ResumeIfDeferred();
+ }
}
}
@@ -219,7 +219,7 @@
if (has_started_response_) {
// Defer the request until the old renderer is finished and the new
// renderer is ready.
- *defer = true;
+ did_defer_ = *defer = true;
}
// If our OnResponseStarted wasn't called, then we're being called by
// OnResponseCompleted after a failure. We don't need to pause, because
@@ -241,4 +241,11 @@
// thread to proceed anyway, using ResourceDispatcherHost::OnClosePageACK.
}
+void CrossSiteResourceHandler::ResumeIfDeferred() {
+ if (did_defer_) {
+ did_defer_ = false;
+ controller()->Resume();
+ }
+}
+
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698