| 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..b088e1a588793282a5ee922c76af31f7d52d90e0 100644
|
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc
|
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc
|
| @@ -407,12 +407,15 @@ void ResourceDispatcherHostImpl::CancelRequestsForContext(
|
| for (LoaderList::iterator i = loaders_to_cancel.begin();
|
| i != loaders_to_cancel.end(); ++i) {
|
| // There is no strict requirement that this be the case, but currently
|
| - // downloads, streams and transferred requests are the only requests that
|
| - // aren't cancelled when the associated processes go away. It may be OK for
|
| - // this invariant to change in the future, but if this assertion fires
|
| - // without the invariant changing, then it's indicative of a leak.
|
| + // downloads, streams, prefetches, and transferred requests are the only
|
| + // requests that aren't cancelled when the associated processes go away. It
|
| + // may be OK for this invariant to change in the future, but if this
|
| + // assertion fires 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 +1101,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->DetachReads();
|
| + }
|
| + handler.reset(async_handler);
|
| }
|
|
|
| // The RedirectToFileResourceHandler depends on being next in the chain.
|
| @@ -1324,8 +1334,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 +1360,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);
|
|
|