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

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

Issue 10332130: Use defer out-params instead of ResourceDispatcherHostImpl::PauseRequest(...true) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 7 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/throttling_resource_handler.cc
===================================================================
--- content/browser/renderer_host/throttling_resource_handler.cc (revision 136397)
+++ content/browser/renderer_host/throttling_resource_handler.cc (working copy)
@@ -74,15 +74,14 @@
bool ThrottlingResourceHandler::OnResponseStarted(
int request_id,
- content::ResourceResponse* response) {
+ content::ResourceResponse* response,
+ bool* defer) {
DCHECK_EQ(request_id_, request_id);
while (index_ < throttles_.size()) {
- bool defer = false;
- throttles_[index_]->WillProcessResponse(&defer);
+ throttles_[index_]->WillProcessResponse(defer);
index_++;
- if (defer) {
- host_->PauseRequest(child_id_, request_id_, true);
+ if (*defer) {
deferred_stage_ = DEFERRED_RESPONSE;
deferred_response_ = response;
return true; // Do not cancel.
@@ -91,7 +90,7 @@
index_ = 0; // Reset for next time.
Randy Smith (Not in Mondays) 2012/05/18 20:17:02 Not relevant to this CL, just for my curiosity: th
darin (slow to review) 2012/05/18 23:09:05 In this comment, "next time" refers to the next no
- return next_handler_->OnResponseStarted(request_id, response);
+ return next_handler_->OnResponseStarted(request_id, response, defer);
}
void ThrottlingResourceHandler::OnRequestClosed() {
@@ -154,11 +153,12 @@
scoped_refptr<ResourceResponse> response;
deferred_response_.swap(response);
- // OnResponseStarted will pause again if necessary.
- host_->PauseRequest(child_id_, request_id_, false);
-
- if (!OnResponseStarted(request_id_, response))
+ bool defer = false;
+ if (!OnResponseStarted(request_id_, response, &defer)) {
Cancel();
+ } else if (!defer) {
+ host_->ResumeDeferredRequest(child_id_, request_id_);
+ }
}
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698