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 1568 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1579 handler.reset(new AsyncResourceHandler(request, this)); | 1579 handler.reset(new AsyncResourceHandler(request, this)); |
1580 } | 1580 } |
1581 | 1581 |
1582 // The RedirectToFileResourceHandler depends on being next in the chain. | 1582 // The RedirectToFileResourceHandler depends on being next in the chain. |
1583 if (request_data.download_to_file) { | 1583 if (request_data.download_to_file) { |
1584 handler.reset( | 1584 handler.reset( |
1585 new RedirectToFileResourceHandler(std::move(handler), request)); | 1585 new RedirectToFileResourceHandler(std::move(handler), request)); |
1586 } | 1586 } |
1587 } | 1587 } |
1588 | 1588 |
| 1589 bool start_detached = request_data.download_to_network_cache_only; |
| 1590 |
1589 // Prefetches and <a ping> requests outlive their child process. | 1591 // Prefetches and <a ping> requests outlive their child process. |
1590 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1592 if (!sync_result && (start_detached || |
1591 handler.reset(new DetachableResourceHandler( | 1593 IsDetachableResourceType(request_data.resource_type))) { |
1592 request, | 1594 std::unique_ptr<DetachableResourceHandler> detachable_handler = |
1593 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1595 base::MakeUnique<DetachableResourceHandler>( |
1594 std::move(handler))); | 1596 request, |
| 1597 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
| 1598 std::move(handler)); |
| 1599 if (start_detached) |
| 1600 detachable_handler->Detach(); |
| 1601 handler = std::move(detachable_handler); |
1595 } | 1602 } |
1596 | 1603 |
1597 // PlzNavigate: If using --enable-browser-side-navigation, the | 1604 // PlzNavigate: If using --enable-browser-side-navigation, the |
1598 // CrossSiteResourceHandler is not needed. This codepath is not used for the | 1605 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
1599 // actual navigation request, but only the subsequent blob URL load. This does | 1606 // actual navigation request, but only the subsequent blob URL load. This does |
1600 // not require request transfers. | 1607 // not require request transfers. |
1601 if (!IsBrowserSideNavigationEnabled()) { | 1608 if (!IsBrowserSideNavigationEnabled()) { |
1602 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1609 // Install a CrossSiteResourceHandler for all main frame requests. This will |
1603 // check whether a transfer is required and, if so, pause for the UI thread | 1610 // check whether a transfer is required and, if so, pause for the UI thread |
1604 // to drive the transfer. | 1611 // to drive the transfer. |
(...skipping 1100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2705 request_info->GetRouteID(), is_content_initiated, true, &throttles); | 2712 request_info->GetRouteID(), is_content_initiated, true, &throttles); |
2706 if (!throttles.empty()) { | 2713 if (!throttles.empty()) { |
2707 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2714 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2708 std::move(throttles))); | 2715 std::move(throttles))); |
2709 } | 2716 } |
2710 } | 2717 } |
2711 return handler; | 2718 return handler; |
2712 } | 2719 } |
2713 | 2720 |
2714 } // namespace content | 2721 } // namespace content |
OLD | NEW |