Chromium Code Reviews| 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 1620 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1631 handler.reset(new AsyncResourceHandler(request, this)); | 1631 handler.reset(new AsyncResourceHandler(request, this)); |
| 1632 } | 1632 } |
| 1633 | 1633 |
| 1634 // The RedirectToFileResourceHandler depends on being next in the chain. | 1634 // The RedirectToFileResourceHandler depends on being next in the chain. |
| 1635 if (request_data.download_to_file) { | 1635 if (request_data.download_to_file) { |
| 1636 handler.reset( | 1636 handler.reset( |
| 1637 new RedirectToFileResourceHandler(std::move(handler), request)); | 1637 new RedirectToFileResourceHandler(std::move(handler), request)); |
| 1638 } | 1638 } |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 // In prefetch mode, only let the main resource go through. | |
| 1642 bool start_detached = request_data.is_prefetch_only && | |
|
mmenke
2016/08/23 15:11:41
|is_prefetch_only| seems confusing, given that we
| |
| 1643 request_data.resource_type != RESOURCE_TYPE_MAIN_FRAME; | |
|
mmenke
2016/08/23 15:11:42
I'm not a fan of this MAIN_FRAME logic here. Perh
| |
| 1644 | |
| 1641 // Prefetches and <a ping> requests outlive their child process. | 1645 // Prefetches and <a ping> requests outlive their child process. |
| 1642 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1646 if (!sync_result && (start_detached || |
| 1647 IsDetachableResourceType(request_data.resource_type))) { | |
| 1643 handler.reset(new DetachableResourceHandler( | 1648 handler.reset(new DetachableResourceHandler( |
| 1644 request, | 1649 request, |
| 1645 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1650 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
| 1646 std::move(handler))); | 1651 start_detached ? nullptr : std::move(handler))); |
|
mmenke
2016/08/23 15:11:41
We need to tell the renderer the request was abort
mmenke
2016/08/23 15:11:42
Could you update the DetachableResourceHandler doc
| |
| 1647 } | 1652 } |
| 1648 | 1653 |
| 1649 // PlzNavigate: If using --enable-browser-side-navigation, the | 1654 // PlzNavigate: If using --enable-browser-side-navigation, the |
| 1650 // CrossSiteResourceHandler is not needed. This codepath is not used for the | 1655 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
| 1651 // actual navigation request, but only the subsequent blob URL load. This does | 1656 // actual navigation request, but only the subsequent blob URL load. This does |
| 1652 // not require request transfers. | 1657 // not require request transfers. |
| 1653 if (!IsBrowserSideNavigationEnabled()) { | 1658 if (!IsBrowserSideNavigationEnabled()) { |
| 1654 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1659 // Install a CrossSiteResourceHandler for all main frame requests. This will |
| 1655 // check whether a transfer is required and, if so, pause for the UI thread | 1660 // check whether a transfer is required and, if so, pause for the UI thread |
| 1656 // to drive the transfer. | 1661 // to drive the transfer. |
| (...skipping 976 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2633 load_flags |= net::LOAD_VERIFY_EV_CERT; | 2638 load_flags |= net::LOAD_VERIFY_EV_CERT; |
| 2634 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { | 2639 if (request_data.resource_type == RESOURCE_TYPE_MAIN_FRAME) { |
| 2635 load_flags |= net::LOAD_MAIN_FRAME; | 2640 load_flags |= net::LOAD_MAIN_FRAME; |
| 2636 } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) { | 2641 } else if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) { |
| 2637 load_flags |= net::LOAD_PREFETCH; | 2642 load_flags |= net::LOAD_PREFETCH; |
| 2638 } | 2643 } |
| 2639 | 2644 |
| 2640 if (is_sync_load) | 2645 if (is_sync_load) |
| 2641 load_flags |= net::LOAD_IGNORE_LIMITS; | 2646 load_flags |= net::LOAD_IGNORE_LIMITS; |
| 2642 | 2647 |
| 2648 if (request_data.is_prefetch_only) | |
| 2649 load_flags |= net::LOAD_PREFETCH; | |
| 2650 | |
| 2643 return load_flags; | 2651 return load_flags; |
| 2644 } | 2652 } |
| 2645 | 2653 |
| 2646 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer( | 2654 void ResourceDispatcherHostImpl::UpdateResponseCertificateForTransfer( |
| 2647 ResourceResponse* response, | 2655 ResourceResponse* response, |
| 2648 const net::SSLInfo& ssl_info, | 2656 const net::SSLInfo& ssl_info, |
| 2649 int child_id) { | 2657 int child_id) { |
| 2650 if (!ssl_info.cert) | 2658 if (!ssl_info.cert) |
| 2651 return; | 2659 return; |
| 2652 SSLStatus ssl; | 2660 SSLStatus ssl; |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2719 << iter->filesystem_url().spec(); | 2727 << iter->filesystem_url().spec(); |
| 2720 return false; | 2728 return false; |
| 2721 } | 2729 } |
| 2722 } | 2730 } |
| 2723 } | 2731 } |
| 2724 } | 2732 } |
| 2725 return true; | 2733 return true; |
| 2726 } | 2734 } |
| 2727 | 2735 |
| 2728 } // namespace content | 2736 } // namespace content |
| OLD | NEW |