| Index: extensions/browser/process_manager.cc
|
| diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
|
| index 9758fd1645587b5972048cc1a0f3e433b2aef09e..23e964abe9f6db531946b95e6cf1db4fbc4ae549 100644
|
| --- a/extensions/browser/process_manager.cc
|
| +++ b/extensions/browser/process_manager.cc
|
| @@ -570,37 +570,24 @@ void ProcessManager::OnNetworkRequestStarted(
|
| uint64_t request_id) {
|
| ExtensionHost* host = GetBackgroundHostForExtension(
|
| GetExtensionID(render_frame_host));
|
| - if (!host || !IsFrameInExtensionHost(host, render_frame_host))
|
| - return;
|
| -
|
| - auto result =
|
| - pending_network_requests_.insert(std::make_pair(request_id, host));
|
| + auto result = pending_network_requests_.insert(request_id);
|
| DCHECK(result.second) << "Duplicate network request IDs.";
|
| -
|
| - IncrementLazyKeepaliveCount(host->extension());
|
| - host->OnNetworkRequestStarted(request_id);
|
| + if (host && IsFrameInExtensionHost(host, render_frame_host)) {
|
| + IncrementLazyKeepaliveCount(host->extension());
|
| + host->OnNetworkRequestStarted(request_id);
|
| + }
|
| }
|
|
|
| void ProcessManager::OnNetworkRequestDone(
|
| content::RenderFrameHost* render_frame_host,
|
| uint64_t request_id) {
|
| - auto result = pending_network_requests_.find(request_id);
|
| - if (result == pending_network_requests_.end())
|
| - return;
|
| -
|
| - // The cached |host| can be invalid, if it was deleted between the time it
|
| - // was inserted in the map and the look up. It is checked to ensure it is in
|
| - // the list of existing background_hosts_.
|
| - ExtensionHost* host = result->second;
|
| - pending_network_requests_.erase(result);
|
| -
|
| - if (background_hosts_.find(host) == background_hosts_.end())
|
| - return;
|
| -
|
| - DCHECK(IsFrameInExtensionHost(host, render_frame_host));
|
| -
|
| - host->OnNetworkRequestDone(request_id);
|
| - DecrementLazyKeepaliveCount(host->extension());
|
| + ExtensionHost* host = GetBackgroundHostForExtension(
|
| + GetExtensionID(render_frame_host));
|
| + if (host && IsFrameInExtensionHost(host, render_frame_host)) {
|
| + host->OnNetworkRequestDone(request_id);
|
| + if (pending_network_requests_.erase(request_id))
|
| + DecrementLazyKeepaliveCount(host->extension());
|
| + }
|
| }
|
|
|
| void ProcessManager::CancelSuspend(const Extension* extension) {
|
|
|