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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1677 // initial request. | 1677 // initial request. |
1678 if (IsBrowserSideNavigationEnabled() && | 1678 if (IsBrowserSideNavigationEnabled() && |
1679 IsResourceTypeFrame(request_data.resource_type)) { | 1679 IsResourceTypeFrame(request_data.resource_type)) { |
1680 DCHECK(request->url().SchemeIs(url::kBlobScheme)); | 1680 DCHECK(request->url().SchemeIs(url::kBlobScheme)); |
1681 return handler; | 1681 return handler; |
1682 } | 1682 } |
1683 | 1683 |
1684 return AddStandardHandlers(request, request_data.resource_type, | 1684 return AddStandardHandlers(request, request_data.resource_type, |
1685 resource_context, | 1685 resource_context, |
1686 request_data.fetch_request_context_type, | 1686 request_data.fetch_request_context_type, |
| 1687 request_data.fetch_mixed_content_context_type, |
1687 requester_info->appcache_service(), child_id, | 1688 requester_info->appcache_service(), child_id, |
1688 route_id, std::move(handler)); | 1689 route_id, std::move(handler)); |
1689 } | 1690 } |
1690 | 1691 |
1691 std::unique_ptr<ResourceHandler> | 1692 std::unique_ptr<ResourceHandler> |
1692 ResourceDispatcherHostImpl::AddStandardHandlers( | 1693 ResourceDispatcherHostImpl::AddStandardHandlers( |
1693 net::URLRequest* request, | 1694 net::URLRequest* request, |
1694 ResourceType resource_type, | 1695 ResourceType resource_type, |
1695 ResourceContext* resource_context, | 1696 ResourceContext* resource_context, |
1696 RequestContextType fetch_request_context_type, | 1697 RequestContextType fetch_request_context_type, |
| 1698 blink::WebMixedContent::ContextType fetch_mixed_content_context_type, |
1697 AppCacheService* appcache_service, | 1699 AppCacheService* appcache_service, |
1698 int child_id, | 1700 int child_id, |
1699 int route_id, | 1701 int route_id, |
1700 std::unique_ptr<ResourceHandler> handler) { | 1702 std::unique_ptr<ResourceHandler> handler) { |
1701 // The InterceptingResourceHandler will replace its next handler with an | 1703 // The InterceptingResourceHandler will replace its next handler with an |
1702 // appropriate one based on the MIME type of the response if needed. It | 1704 // appropriate one based on the MIME type of the response if needed. It |
1703 // should be placed at the end of the chain, just before |handler|. | 1705 // should be placed at the end of the chain, just before |handler|. |
1704 handler.reset(new InterceptingResourceHandler(std::move(handler), request)); | 1706 handler.reset(new InterceptingResourceHandler(std::move(handler), request)); |
1705 InterceptingResourceHandler* intercepting_handler = | 1707 InterceptingResourceHandler* intercepting_handler = |
1706 static_cast<InterceptingResourceHandler*>(handler.get()); | 1708 static_cast<InterceptingResourceHandler*>(handler.get()); |
1707 | 1709 |
1708 std::vector<std::unique_ptr<ResourceThrottle>> throttles; | 1710 std::vector<std::unique_ptr<ResourceThrottle>> throttles; |
1709 | 1711 |
1710 // Add a NavigationResourceThrottle for navigations. | 1712 // Add a NavigationResourceThrottle for navigations. |
1711 // PlzNavigate: the throttle is unnecessary as communication with the UI | 1713 // PlzNavigate: the throttle is unnecessary as communication with the UI |
1712 // thread is handled by the NavigationURLloader. | 1714 // thread is handled by the NavigationURLloader. |
1713 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) { | 1715 if (!IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type)) { |
1714 throttles.push_back(base::MakeUnique<NavigationResourceThrottle>( | 1716 throttles.push_back(base::MakeUnique<NavigationResourceThrottle>( |
1715 request, delegate_, fetch_request_context_type)); | 1717 request, delegate_, fetch_request_context_type, |
| 1718 fetch_mixed_content_context_type)); |
1716 } | 1719 } |
1717 | 1720 |
1718 if (delegate_) { | 1721 if (delegate_) { |
1719 delegate_->RequestBeginning(request, | 1722 delegate_->RequestBeginning(request, |
1720 resource_context, | 1723 resource_context, |
1721 appcache_service, | 1724 appcache_service, |
1722 resource_type, | 1725 resource_type, |
1723 &throttles); | 1726 &throttles); |
1724 } | 1727 } |
1725 | 1728 |
(...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2279 } | 2282 } |
2280 | 2283 |
2281 std::unique_ptr<ResourceHandler> handler( | 2284 std::unique_ptr<ResourceHandler> handler( |
2282 new NavigationResourceHandler(new_request.get(), loader, delegate())); | 2285 new NavigationResourceHandler(new_request.get(), loader, delegate())); |
2283 | 2286 |
2284 // TODO(davidben): Fix the dependency on child_id/route_id. Those are used | 2287 // TODO(davidben): Fix the dependency on child_id/route_id. Those are used |
2285 // by the ResourceScheduler. currently it's a no-op. | 2288 // by the ResourceScheduler. currently it's a no-op. |
2286 handler = AddStandardHandlers( | 2289 handler = AddStandardHandlers( |
2287 new_request.get(), resource_type, resource_context, | 2290 new_request.get(), resource_type, resource_context, |
2288 info.begin_params.request_context_type, | 2291 info.begin_params.request_context_type, |
| 2292 info.begin_params.mixed_content_context_type, |
2289 appcache_handle_core ? appcache_handle_core->GetAppCacheService() | 2293 appcache_handle_core ? appcache_handle_core->GetAppCacheService() |
2290 : nullptr, | 2294 : nullptr, |
2291 -1, // child_id | 2295 -1, // child_id |
2292 -1, // route_id | 2296 -1, // route_id |
2293 std::move(handler)); | 2297 std::move(handler)); |
2294 | 2298 |
2295 BeginRequestInternal(std::move(new_request), std::move(handler)); | 2299 BeginRequestInternal(std::move(new_request), std::move(handler)); |
2296 } | 2300 } |
2297 | 2301 |
2298 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { | 2302 void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { |
(...skipping 523 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2822 &throttles); | 2826 &throttles); |
2823 if (!throttles.empty()) { | 2827 if (!throttles.empty()) { |
2824 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2828 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2825 std::move(throttles))); | 2829 std::move(throttles))); |
2826 } | 2830 } |
2827 } | 2831 } |
2828 return handler; | 2832 return handler; |
2829 } | 2833 } |
2830 | 2834 |
2831 } // namespace content | 2835 } // namespace content |
OLD | NEW |