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 bool start_detached = request_data.download_to_network_cache_only; |
| 1642 |
1641 // Prefetches and <a ping> requests outlive their child process. | 1643 // Prefetches and <a ping> requests outlive their child process. |
1642 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1644 if (!sync_result && (start_detached || |
1643 handler.reset(new DetachableResourceHandler( | 1645 IsDetachableResourceType(request_data.resource_type))) { |
1644 request, | 1646 std::unique_ptr<DetachableResourceHandler> detachable_handler = |
1645 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1647 base::MakeUnique<DetachableResourceHandler>( |
1646 std::move(handler))); | 1648 request, |
| 1649 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
| 1650 std::move(handler)); |
| 1651 if (start_detached) |
| 1652 detachable_handler->Detach(); |
| 1653 handler = std::move(detachable_handler); |
1647 } | 1654 } |
1648 | 1655 |
1649 // PlzNavigate: If using --enable-browser-side-navigation, the | 1656 // PlzNavigate: If using --enable-browser-side-navigation, the |
1650 // CrossSiteResourceHandler is not needed. This codepath is not used for the | 1657 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
1651 // actual navigation request, but only the subsequent blob URL load. This does | 1658 // actual navigation request, but only the subsequent blob URL load. This does |
1652 // not require request transfers. | 1659 // not require request transfers. |
1653 if (!IsBrowserSideNavigationEnabled()) { | 1660 if (!IsBrowserSideNavigationEnabled()) { |
1654 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1661 // 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 | 1662 // check whether a transfer is required and, if so, pause for the UI thread |
1656 // to drive the transfer. | 1663 // to drive the transfer. |
(...skipping 1062 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2719 << iter->filesystem_url().spec(); | 2726 << iter->filesystem_url().spec(); |
2720 return false; | 2727 return false; |
2721 } | 2728 } |
2722 } | 2729 } |
2723 } | 2730 } |
2724 } | 2731 } |
2725 return true; | 2732 return true; |
2726 } | 2733 } |
2727 | 2734 |
2728 } // namespace content | 2735 } // namespace content |
OLD | NEW |