Chromium Code Reviews| 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 16be639f7207a921d5403da720bf1ea16cb5d07e..1343bc9a1381e63410f791d4a5be326569cbc222 100644 |
| --- a/content/browser/loader/resource_dispatcher_host_impl.cc |
| +++ b/content/browser/loader/resource_dispatcher_host_impl.cc |
| @@ -1805,26 +1805,8 @@ bool ResourceDispatcherHostImpl::Send(IPC::Message* message) { |
| return false; |
| } |
| -// Note that this cancel is subtly different from the other |
| -// CancelRequest methods in this file, which also tear down the loader. |
| void ResourceDispatcherHostImpl::OnCancelRequest(int request_id) { |
| - int child_id = filter_->child_id(); |
| - |
| - // When the old renderer dies, it sends a message to us to cancel its |
| - // requests. |
| - if (IsTransferredNavigation(GlobalRequestID(child_id, request_id))) |
| - return; |
| - |
| - ResourceLoader* loader = GetLoader(child_id, request_id); |
| - |
| - // It is possible that the request has been completed and removed from the |
| - // loader queue but the client has not processed the request completed message |
| - // before issuing a cancel. This happens frequently for beacons which are |
| - // canceled in the response received handler. |
| - if (!loader) |
| - return; |
| - |
| - loader->CancelRequest(true); |
| + CancelRequestFromRenderer(GlobalRequestID(filter_->child_id(), request_id)); |
| } |
| ResourceRequestInfoImpl* ResourceDispatcherHostImpl::CreateRequestInfo( |
| @@ -2453,6 +2435,28 @@ int ResourceDispatcherHostImpl::MakeRequestID() { |
| return --request_id_; |
| } |
| +// Note that this cancel is subtly different from the other |
| +// CancelRequest methods in this file, which also tear down the loader. |
|
mmenke
2016/11/01 13:52:32
Existing bug, but class-level comments should go w
yhirano
2016/11/02 06:02:56
Done.
|
| +void ResourceDispatcherHostImpl::CancelRequestFromRenderer( |
|
mmenke
2016/11/01 13:52:32
Why the new method?
yhirano
2016/11/01 14:24:25
OnCancelRequest expects that |filter_| is set, but
|
| + GlobalRequestID request_id) { |
| + // When the old renderer dies, it sends a message to us to cancel its |
| + // requests. |
| + if (IsTransferredNavigation(request_id)) |
| + return; |
| + |
| + ResourceLoader* loader = |
| + GetLoader(request_id.child_id, request_id.request_id); |
| + |
| + // It is possible that the request has been completed and removed from the |
| + // loader queue but the client has not processed the request completed message |
| + // before issuing a cancel. This happens frequently for beacons which are |
| + // canceled in the response received handler. |
| + if (!loader) |
| + return; |
| + |
| + loader->CancelRequest(true); |
| +} |
| + |
| void ResourceDispatcherHostImpl::StartLoading( |
| ResourceRequestInfoImpl* info, |
| std::unique_ptr<ResourceLoader> loader) { |