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

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

Issue 2436163002: When InterceptingResourceHandler swaps in a handler, call OnWillStart. (Closed)
Patch Set: Update comments, remove prototype for method that never existed Created 4 years, 2 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/loader/intercepting_resource_handler.cc
diff --git a/content/browser/loader/intercepting_resource_handler.cc b/content/browser/loader/intercepting_resource_handler.cc
index 6cdbcc5a4fe78c013679566951c71f52ccb89c24..7c8f4a998641b711b9f5917198011a99269cad02 100644
--- a/content/browser/loader/intercepting_resource_handler.cc
+++ b/content/browser/loader/intercepting_resource_handler.cc
@@ -8,6 +8,7 @@
#include "base/strings/string_util.h"
#include "content/public/common/resource_response.h"
#include "net/base/io_buffer.h"
+#include "net/url_request/url_request.h"
namespace content {
@@ -175,7 +176,10 @@ bool InterceptingResourceHandler::DoLoop(bool* defer) {
case State::PASS_THROUGH:
NOTREACHED();
break;
- case State::NOTIFYING_ON_RESPONSE_STARTED_TO_NEW_HANDLER:
+ case State::SENDING_ON_WILL_START_TO_NEW_HANDLER:
+ result = SendOnResponseStartedToNewHandler(defer);
+ break;
+ case State::SENDING_ON_RESPONSE_STARTED_TO_NEW_HANDLER:
if (first_read_buffer_double_) {
// OnWillRead has been called, so copying the data from
// |first_read_buffer_double_| to |first_read_buffer_| will be needed
@@ -239,7 +243,13 @@ bool InterceptingResourceHandler::SendPayloadToOldHandler(bool* defer) {
DCHECK(!*defer);
next_handler_ = std::move(new_handler_);
- state_ = State::NOTIFYING_ON_RESPONSE_STARTED_TO_NEW_HANDLER;
+ state_ = State::SENDING_ON_WILL_START_TO_NEW_HANDLER;
+ return next_handler_->OnWillStart(request()->url(), defer);
+}
+
+bool InterceptingResourceHandler::SendOnResponseStartedToNewHandler(
+ bool* defer) {
+ state_ = State::SENDING_ON_RESPONSE_STARTED_TO_NEW_HANDLER;
return next_handler_->OnResponseStarted(response_.get(), defer);
}

Powered by Google App Engine
This is Rietveld 408576698