| Index: extensions/browser/process_manager.cc
|
| diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc
|
| index be623e39ac1449489c879e2337e5d9afdbb24cec..a71b4c9d89fdb29a9494bf4d2694316f60299a7f 100644
|
| --- a/extensions/browser/process_manager.cc
|
| +++ b/extensions/browser/process_manager.cc
|
| @@ -569,37 +569,24 @@
|
| 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) {
|
|
|