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 1552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1563 handler.reset(new AsyncResourceHandler(request, this)); | 1563 handler.reset(new AsyncResourceHandler(request, this)); |
1564 } | 1564 } |
1565 | 1565 |
1566 // The RedirectToFileResourceHandler depends on being next in the chain. | 1566 // The RedirectToFileResourceHandler depends on being next in the chain. |
1567 if (request_data.download_to_file) { | 1567 if (request_data.download_to_file) { |
1568 handler.reset( | 1568 handler.reset( |
1569 new RedirectToFileResourceHandler(std::move(handler), request)); | 1569 new RedirectToFileResourceHandler(std::move(handler), request)); |
1570 } | 1570 } |
1571 } | 1571 } |
1572 | 1572 |
| 1573 bool start_detached = request_data.download_to_network_cache_only; |
| 1574 |
1573 // Prefetches and <a ping> requests outlive their child process. | 1575 // Prefetches and <a ping> requests outlive their child process. |
1574 if (!sync_result && IsDetachableResourceType(request_data.resource_type)) { | 1576 if (!sync_result && (start_detached || |
1575 handler.reset(new DetachableResourceHandler( | 1577 IsDetachableResourceType(request_data.resource_type))) { |
1576 request, | 1578 std::unique_ptr<DetachableResourceHandler> detachable_handler = |
1577 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), | 1579 base::MakeUnique<DetachableResourceHandler>( |
1578 std::move(handler))); | 1580 request, |
| 1581 base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), |
| 1582 std::move(handler)); |
| 1583 if (start_detached) |
| 1584 detachable_handler->Detach(); |
| 1585 handler = std::move(detachable_handler); |
1579 } | 1586 } |
1580 | 1587 |
1581 // PlzNavigate: If using --enable-browser-side-navigation, the | 1588 // PlzNavigate: If using --enable-browser-side-navigation, the |
1582 // CrossSiteResourceHandler is not needed. This codepath is not used for the | 1589 // CrossSiteResourceHandler is not needed. This codepath is not used for the |
1583 // actual navigation request, but only the subsequent blob URL load. This does | 1590 // actual navigation request, but only the subsequent blob URL load. This does |
1584 // not require request transfers. | 1591 // not require request transfers. |
1585 if (!IsBrowserSideNavigationEnabled()) { | 1592 if (!IsBrowserSideNavigationEnabled()) { |
1586 // Install a CrossSiteResourceHandler for all main frame requests. This will | 1593 // Install a CrossSiteResourceHandler for all main frame requests. This will |
1587 // check whether a transfer is required and, if so, pause for the UI thread | 1594 // check whether a transfer is required and, if so, pause for the UI thread |
1588 // to drive the transfer. | 1595 // to drive the transfer. |
(...skipping 1084 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2673 request_info->GetRouteID(), is_content_initiated, true, &throttles); | 2680 request_info->GetRouteID(), is_content_initiated, true, &throttles); |
2674 if (!throttles.empty()) { | 2681 if (!throttles.empty()) { |
2675 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, | 2682 handler.reset(new ThrottlingResourceHandler(std::move(handler), request, |
2676 std::move(throttles))); | 2683 std::move(throttles))); |
2677 } | 2684 } |
2678 } | 2685 } |
2679 return handler; | 2686 return handler; |
2680 } | 2687 } |
2681 | 2688 |
2682 } // namespace content | 2689 } // namespace content |
OLD | NEW |