OLD | NEW |
---|---|
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 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
48 #include "content/browser/loader/async_resource_handler.h" | 48 #include "content/browser/loader/async_resource_handler.h" |
49 #include "content/browser/loader/async_revalidation_manager.h" | 49 #include "content/browser/loader/async_revalidation_manager.h" |
50 #include "content/browser/loader/cross_site_resource_handler.h" | 50 #include "content/browser/loader/cross_site_resource_handler.h" |
51 #include "content/browser/loader/detachable_resource_handler.h" | 51 #include "content/browser/loader/detachable_resource_handler.h" |
52 #include "content/browser/loader/mime_type_resource_handler.h" | 52 #include "content/browser/loader/mime_type_resource_handler.h" |
53 #include "content/browser/loader/navigation_resource_handler.h" | 53 #include "content/browser/loader/navigation_resource_handler.h" |
54 #include "content/browser/loader/navigation_resource_throttle.h" | 54 #include "content/browser/loader/navigation_resource_throttle.h" |
55 #include "content/browser/loader/navigation_url_loader_impl_core.h" | 55 #include "content/browser/loader/navigation_url_loader_impl_core.h" |
56 #include "content/browser/loader/power_save_block_resource_throttle.h" | 56 #include "content/browser/loader/power_save_block_resource_throttle.h" |
57 #include "content/browser/loader/redirect_to_file_resource_handler.h" | 57 #include "content/browser/loader/redirect_to_file_resource_handler.h" |
58 #include "content/browser/loader/replacing_resource_handler.h" | |
58 #include "content/browser/loader/resource_message_filter.h" | 59 #include "content/browser/loader/resource_message_filter.h" |
59 #include "content/browser/loader/resource_request_info_impl.h" | 60 #include "content/browser/loader/resource_request_info_impl.h" |
60 #include "content/browser/loader/stream_resource_handler.h" | 61 #include "content/browser/loader/stream_resource_handler.h" |
61 #include "content/browser/loader/sync_resource_handler.h" | 62 #include "content/browser/loader/sync_resource_handler.h" |
62 #include "content/browser/loader/throttling_resource_handler.h" | 63 #include "content/browser/loader/throttling_resource_handler.h" |
63 #include "content/browser/loader/upload_data_stream_builder.h" | 64 #include "content/browser/loader/upload_data_stream_builder.h" |
64 #include "content/browser/renderer_host/render_view_host_delegate.h" | 65 #include "content/browser/renderer_host/render_view_host_delegate.h" |
65 #include "content/browser/renderer_host/render_view_host_impl.h" | 66 #include "content/browser/renderer_host/render_view_host_impl.h" |
66 #include "content/browser/resource_context_impl.h" | 67 #include "content/browser/resource_context_impl.h" |
67 #include "content/browser/service_worker/foreign_fetch_request_handler.h" | 68 #include "content/browser/service_worker/foreign_fetch_request_handler.h" |
(...skipping 1650 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1718 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && | 1719 if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && |
1719 child_id != -1) { | 1720 child_id != -1) { |
1720 DCHECK(request->url().SchemeIs(url::kBlobScheme)); | 1721 DCHECK(request->url().SchemeIs(url::kBlobScheme)); |
1721 return handler; | 1722 return handler; |
1722 } | 1723 } |
1723 | 1724 |
1724 PluginService* plugin_service = nullptr; | 1725 PluginService* plugin_service = nullptr; |
1725 #if defined(ENABLE_PLUGINS) | 1726 #if defined(ENABLE_PLUGINS) |
1726 plugin_service = PluginService::GetInstance(); | 1727 plugin_service = PluginService::GetInstance(); |
1727 #endif | 1728 #endif |
1728 // Insert a buffered event handler before the actual one. | 1729 |
1729 handler.reset(new MimeTypeResourceHandler(std::move(handler), this, | 1730 // The ReplacingResourceThrottle will replace its next handler with an |
1730 plugin_service, request)); | 1731 // 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.
| |
1732 handler.reset(new ReplacingResourceHandler(std::move(handler), this, | |
1733 plugin_service, request)); | |
1731 | 1734 |
1732 ScopedVector<ResourceThrottle> throttles; | 1735 ScopedVector<ResourceThrottle> throttles; |
1733 | 1736 |
1734 // Add a NavigationResourceThrottle for navigations. | 1737 // Add a NavigationResourceThrottle for navigations. |
1735 // PlzNavigate: the throttle is unnecessary as communication with the UI | 1738 // PlzNavigate: the throttle is unnecessary as communication with the UI |
1736 // thread is handled by the NavigationURLloader. | 1739 // thread is handled by the NavigationURLloader. |
1737 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) | 1740 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) |
1738 throttles.push_back(new NavigationResourceThrottle(request, delegate())); | 1741 throttles.push_back(new NavigationResourceThrottle(request, delegate())); |
1739 | 1742 |
1740 if (delegate_) { | 1743 if (delegate_) { |
(...skipping 11 matching lines...) Expand all Loading... | |
1752 } | 1755 } |
1753 | 1756 |
1754 // TODO(ricea): Stop looking this up so much. | 1757 // TODO(ricea): Stop looking this up so much. |
1755 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); | 1758 ResourceRequestInfoImpl* info = ResourceRequestInfoImpl::ForRequest(request); |
1756 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, | 1759 throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, |
1757 info->IsAsync(), request)); | 1760 info->IsAsync(), request)); |
1758 | 1761 |
1759 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 1762 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
1760 std::move(throttles))); | 1763 std::move(throttles))); |
1761 | 1764 |
1765 // Insert a buffered event handler to sniff the mime type first. | |
1766 handler.reset(new MimeTypeResourceHandler(std::move(handler), request)); | |
1767 | |
1762 return handler; | 1768 return handler; |
1763 } | 1769 } |
1764 | 1770 |
1765 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { | 1771 void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { |
1766 UnregisterDownloadedTempFile(filter_->child_id(), request_id); | 1772 UnregisterDownloadedTempFile(filter_->child_id(), request_id); |
1767 } | 1773 } |
1768 | 1774 |
1769 void ResourceDispatcherHostImpl::OnDidChangePriority( | 1775 void ResourceDispatcherHostImpl::OnDidChangePriority( |
1770 int request_id, | 1776 int request_id, |
1771 net::RequestPriority new_priority, | 1777 net::RequestPriority new_priority, |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2693 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); | 2699 ssl.cert_id = GetCertStore()->StoreCert(ssl_info.cert.get(), child_id); |
2694 response->head.security_info = SerializeSecurityInfo(ssl); | 2700 response->head.security_info = SerializeSecurityInfo(ssl); |
2695 } | 2701 } |
2696 | 2702 |
2697 CertStore* ResourceDispatcherHostImpl::GetCertStore() { | 2703 CertStore* ResourceDispatcherHostImpl::GetCertStore() { |
2698 return cert_store_for_testing_ ? cert_store_for_testing_ | 2704 return cert_store_for_testing_ ? cert_store_for_testing_ |
2699 : CertStore::GetInstance(); | 2705 : CertStore::GetInstance(); |
2700 } | 2706 } |
2701 | 2707 |
2702 } // namespace content | 2708 } // namespace content |
OLD | NEW |