| Index: content/browser/loader/resource_dispatcher_host_impl.cc
|
| diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| index a44715d3996dcb3d155ea5158b95841b131eab26..fa016715bf55b4b07e0e0c6d82a49488e9a0dc82 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| @@ -413,6 +413,8 @@ void ResourceDispatcherHostImpl::CancelRequestsForContext(
|
| // without the invariant changing, then it's indicative of a leak.
|
| DCHECK((*i)->GetRequestInfo()->is_download() ||
|
| (*i)->GetRequestInfo()->is_stream() ||
|
| + (*i)->GetRequestInfo()->GetResourceType() ==
|
| + ResourceType::PREFETCH ||
|
| (*i)->is_transferring());
|
| }
|
| #endif
|
| @@ -1098,7 +1100,14 @@ void ResourceDispatcherHostImpl::BeginRequest(
|
| if (sync_result) {
|
| handler.reset(new SyncResourceHandler(request, sync_result, this));
|
| } else {
|
| - handler.reset(new AsyncResourceHandler(request, this));
|
| + AsyncResourceHandler* async_handler =
|
| + new AsyncResourceHandler(request, this);
|
| + if (request_data.resource_type == ResourceType::PREFETCH) {
|
| + // The renderer doesn't need prefetch data notifications and the prefetch
|
| + // request might live longer than the renderer, so detach reads.
|
| + async_handler->SetDetachedReads(true);
|
| + }
|
| + handler.reset(async_handler);
|
| }
|
|
|
| // The RedirectToFileResourceHandler depends on being next in the chain.
|
| @@ -1324,8 +1333,8 @@ void ResourceDispatcherHostImpl::ResumeDeferredNavigation(
|
| }
|
|
|
| // The object died, so cancel and detach all requests associated with it except
|
| -// for downloads, which belong to the browser process even if initiated via a
|
| -// renderer.
|
| +// for downloads and prefetches, which belong to the browser process even if
|
| +// initiated via a renderer.
|
| void ResourceDispatcherHostImpl::CancelRequestsForProcess(int child_id) {
|
| CancelRequestsForRoute(child_id, -1 /* cancel all */);
|
| registered_temp_files_.erase(child_id);
|
| @@ -1350,12 +1359,12 @@ void ResourceDispatcherHostImpl::CancelRequestsForRoute(int child_id,
|
|
|
| GlobalRequestID id(child_id, i->first.request_id);
|
| DCHECK(id == i->first);
|
| -
|
| // Don't cancel navigations that are transferring to another process,
|
| // since they belong to another process now.
|
| if (IsTransferredNavigation(id))
|
| any_requests_transferring = true;
|
| if (!info->is_download() && !info->is_stream() &&
|
| + info->GetResourceType() != ResourceType::PREFETCH &&
|
| !IsTransferredNavigation(id) &&
|
| (route_id == -1 || route_id == info->GetRouteID())) {
|
| matching_requests.push_back(id);
|
|
|