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

Side by Side Diff: content/browser/loader/resource_dispatcher_host_impl.cc

Issue 2323623002: Do not sniff mime type for fetch() requests (Closed)
Patch Set: 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading 5 // See http://dev.chromium.org/developers/design-documents/multi-process-resourc e-loading
6 6
7 #include "content/browser/loader/resource_dispatcher_host_impl.h" 7 #include "content/browser/loader/resource_dispatcher_host_impl.h"
8 8
9 #include <stddef.h> 9 #include <stddef.h>
10 10
(...skipping 1697 matching lines...) Expand 10 before | Expand all | Expand 10 after
1708 1708
1709 // Add the post mime sniffing throttles. 1709 // Add the post mime sniffing throttles.
1710 handler.reset(new ThrottlingResourceHandler( 1710 handler.reset(new ThrottlingResourceHandler(
1711 std::move(handler), request, std::move(post_mime_sniffing_throttles))); 1711 std::move(handler), request, std::move(post_mime_sniffing_throttles)));
1712 1712
1713 PluginService* plugin_service = nullptr; 1713 PluginService* plugin_service = nullptr;
1714 #if defined(ENABLE_PLUGINS) 1714 #if defined(ENABLE_PLUGINS)
1715 plugin_service = PluginService::GetInstance(); 1715 plugin_service = PluginService::GetInstance();
1716 #endif 1716 #endif
1717 1717
1718 // Insert a buffered event handler to sniff the mime type. 1718 if (fetch_request_context_type != REQUEST_CONTEXT_TYPE_FETCH) {
1719 // Note: all ResourceHandler following the MimeSniffingResourceHandler should 1719 // fetch() ignores mime sniffing.
tyoshino (SeeGerritForStatus) 2016/09/08 06:04:31 place above the if
yhirano 2016/09/08 06:08:39 Done.
1720 // expect OnWillRead to be called *before* OnResponseStarted as part of the 1720 //
1721 // mime sniffing process. 1721 // Insert a buffered event handler to sniff the mime type.
1722 handler.reset(new MimeSniffingResourceHandler( 1722 // Note: all ResourceHandler following the MimeSniffingResourceHandler
1723 std::move(handler), this, plugin_service, intercepting_handler, request)); 1723 // should expect OnWillRead to be called *before* OnResponseStarted as
1724 // part of the mime sniffing process.
1725 handler.reset(new MimeSniffingResourceHandler(
1726 std::move(handler), this, plugin_service, intercepting_handler,
1727 request));
1728 }
1724 1729
1725 // Add the pre mime sniffing throttles. 1730 // Add the pre mime sniffing throttles.
1726 handler.reset(new ThrottlingResourceHandler( 1731 handler.reset(new ThrottlingResourceHandler(
1727 std::move(handler), request, std::move(pre_mime_sniffing_throttles))); 1732 std::move(handler), request, std::move(pre_mime_sniffing_throttles)));
1728 1733
1729 return handler; 1734 return handler;
1730 } 1735 }
1731 1736
1732 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { 1737 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) {
1733 UnregisterDownloadedTempFile(filter_->child_id(), request_id); 1738 UnregisterDownloadedTempFile(filter_->child_id(), request_id);
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
2730 request_info->GetRouteID(), is_content_initiated, true, &throttles); 2735 request_info->GetRouteID(), is_content_initiated, true, &throttles);
2731 if (!throttles.empty()) { 2736 if (!throttles.empty()) {
2732 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, 2737 handler.reset(new ThrottlingResourceHandler(std::move(handler), request,
2733 std::move(throttles))); 2738 std::move(throttles)));
2734 } 2739 }
2735 } 2740 }
2736 return handler; 2741 return handler;
2737 } 2742 }
2738 2743
2739 } // namespace content 2744 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698