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

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

Issue 2005273002: Move MimeTypeResourceHandler before ThrottlingResourceHandler (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed gypi error Created 4 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/loader/resource_dispatcher_host_impl.cc
diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
index 50153c6706bfa0951f8506161aa063702a7069b1..ab3ebb5d4c5c7d6de73bebd3f701957aeaa6c27f 100644
--- a/content/browser/loader/resource_dispatcher_host_impl.cc
+++ b/content/browser/loader/resource_dispatcher_host_impl.cc
@@ -55,6 +55,7 @@
#include "content/browser/loader/navigation_url_loader_impl_core.h"
#include "content/browser/loader/power_save_block_resource_throttle.h"
#include "content/browser/loader/redirect_to_file_resource_handler.h"
+#include "content/browser/loader/replacing_resource_handler.h"
#include "content/browser/loader/resource_message_filter.h"
#include "content/browser/loader/resource_request_info_impl.h"
#include "content/browser/loader/stream_resource_handler.h"
@@ -1725,9 +1726,11 @@ ResourceDispatcherHostImpl::AddStandardHandlers(
#if defined(ENABLE_PLUGINS)
plugin_service = PluginService::GetInstance();
#endif
- // Insert a buffered event handler before the actual one.
- handler.reset(new MimeTypeResourceHandler(std::move(handler), this,
- plugin_service, request));
+
+ // The ReplacingResourceThrottle will replace its next handler with an
+ // appropriate one based on the MIME type of the response if needed.
mmenke 2016/06/09 18:18:42 Maybe mention that this must be at the end of the
clamy 2016/06/21 16:14:15 Done.
+ handler.reset(new ReplacingResourceHandler(std::move(handler), this,
+ plugin_service, request));
ScopedVector<ResourceThrottle> throttles;
@@ -1759,6 +1762,9 @@ ResourceDispatcherHostImpl::AddStandardHandlers(
handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
std::move(throttles)));
+ // Insert a buffered event handler to sniff the mime type first.
+ handler.reset(new MimeTypeResourceHandler(std::move(handler), request));
+
return handler;
}

Powered by Google App Engine
This is Rietveld 408576698