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

Unified Diff: content/browser/loader/mime_sniffing_resource_handler.h

Issue 2366753002: Have MimeSniffingResourceHandler call WillStartRequest on new Handlers. (Closed)
Patch Set: Fix Created 4 years, 3 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/mime_sniffing_resource_handler.h
diff --git a/content/browser/loader/mime_sniffing_resource_handler.h b/content/browser/loader/mime_sniffing_resource_handler.h
index 05b901a9c0cb51ca16509e4bc63b6bcf14d8ffca..bb3e3fdb566467710b8101cb11199fe0ab4e79b8 100644
--- a/content/browser/loader/mime_sniffing_resource_handler.h
+++ b/content/browser/loader/mime_sniffing_resource_handler.h
@@ -64,13 +64,17 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
// In this state, the MimeSniffingResourceHandler has identified the mime
// type and made a decision on whether the request should be intercepted or
- // not. It is nows attempting to replay the response to downstream
- // handlers.
- STATE_INTERCEPTION_CHECK_DONE,
+ // not. It now needs to prepare the new handler for use, and replay the
+ // already received data.
+ STATE_NEED_TO_PREPARE_TO_USE_NEW_HANDLER,
+
+ // In this state, the MimeSniffingResourceHandler is preparing the new
+ // handler for use.
+ STATE_PREPARING_TO_USE_NEW_HANDLER,
// In this state, the MimeSniffingResourceHandler is replaying the buffered
// OnResponseStarted event to the downstream ResourceHandlers.
- STATE_REPLAYING_RESPONSE_RECEIVED,
+ STATE_REPLAYING_RECEIVED_RESPONSE,
// In this state, the MimeSniffingResourceHandler is just a blind
// pass-through
@@ -108,8 +112,12 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
// Intercepts the request as a stream/download if needed.
bool MaybeIntercept(bool* defer);
+ // Prepares the new handler for use, advancing it to a state where it can
+ // be swapped in to replace the InterceptingResourceHandler's old one.
+ bool PrepareToUseNewHandler(bool* defer);
+
// Replays OnResponseStarted on the downstream handlers.
- bool ReplayResponseReceived(bool* defer);
+ bool ReplayReceivedResponse(bool* defer);
// Replays OnReadCompleted on the downstreams handlers.
bool ReplayReadCompleted(bool* defer);
@@ -169,6 +177,9 @@ class CONTENT_EXPORT MimeSniffingResourceHandler
RequestContextType request_context_type_;
+ std::unique_ptr<ResourceHandler> new_handler_;
+ std::string payload_for_old_handler_;
+
base::WeakPtrFactory<MimeSniffingResourceHandler> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(MimeSniffingResourceHandler);
« no previous file with comments | « content/browser/loader/intercepting_resource_handler.cc ('k') | content/browser/loader/mime_sniffing_resource_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698