Commit 3e18e29e authored by Yutaka Hirano's avatar Yutaka Hirano Committed by Commit Bot

Do not use DetachableResourceHandle for keepalive requests

We don't need it for keepalive requests any more, and
DetachableResourceHandler ignores cancel requests from renderer, which
is bad.

Change-Id: Iada35d44e2290760ed7b293cdd3dd7280e69edea
Bug: 836641
Reviewed-on: https://chromium-review.googlesource.com/1026333Reviewed-by: default avatarKinuko Yasuda <kinuko@chromium.org>
Commit-Queue: Yutaka Hirano <yhirano@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553480}
parent 801d8f04
......@@ -1265,9 +1265,8 @@ ResourceDispatcherHostImpl::CreateResourceHandler(
new RedirectToFileResourceHandler(std::move(handler), request));
}
// Prefetches and <a ping> requests outlive their child process.
if (request_data.resource_type == RESOURCE_TYPE_PREFETCH ||
request_data.keepalive) {
// Prefetches outlive their child process.
if (request_data.resource_type == RESOURCE_TYPE_PREFETCH) {
auto detachable_handler = std::make_unique<DetachableResourceHandler>(
request,
base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs),
......@@ -1530,19 +1529,11 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(
if (IsTransferredNavigation(id))
any_requests_transferring = true;
if (cancel_all_routes || route_id == info->GetRenderFrameID()) {
if (info->detachable_handler()) {
if (info->keepalive()) {
// If the feature is enabled, the renderer process's lifetime is
// prolonged so there's no need to detach.
if (cancel_all_routes) {
// If the process is going to shut down for other reasons, we need
// to cancel the request.
matching_requests.push_back(id);
}
} else {
// Otherwise, use DetachableResourceHandler's functionality.
info->detachable_handler()->Detach();
}
if (info->keepalive() && !cancel_all_routes) {
// If the keepalive flag is set, that request will outlive the frame
// deliberately, so we don't cancel it here.
} else if (info->detachable_handler()) {
info->detachable_handler()->Detach();
} else if (!info->IsDownload() && !info->is_stream() &&
!IsTransferredNavigation(id)) {
matching_requests.push_back(id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment