Chromium Code Reviews| Index: extensions/browser/process_manager.cc |
| diff --git a/extensions/browser/process_manager.cc b/extensions/browser/process_manager.cc |
| index a71b4c9d89fdb29a9494bf4d2694316f60299a7f..f497e2c87a20fa59a31dd53cdd8227e32a85c766 100644 |
| --- a/extensions/browser/process_manager.cc |
| +++ b/extensions/browser/process_manager.cc |
| @@ -569,9 +569,14 @@ void ProcessManager::OnNetworkRequestStarted( |
| uint64_t request_id) { |
| ExtensionHost* host = GetBackgroundHostForExtension( |
| GetExtensionID(render_frame_host)); |
| - auto result = pending_network_requests_.insert(request_id); |
| + if (!host) |
| + return; |
| + |
| + auto result = pending_network_requests_.insert( |
| + make_pair(request_id, host->extension()->id())); |
|
Devlin
2016/05/31 22:45:30
unrelated - why doesn't make_pair need the std:: s
nasko
2016/06/01 21:22:19
Done.
|
| DCHECK(result.second) << "Duplicate network request IDs."; |
| - if (host && IsFrameInExtensionHost(host, render_frame_host)) { |
| + |
| + if (IsFrameInExtensionHost(host, render_frame_host)) { |
| IncrementLazyKeepaliveCount(host->extension()); |
| host->OnNetworkRequestStarted(request_id); |
| } |
| @@ -582,11 +587,15 @@ void ProcessManager::OnNetworkRequestDone( |
| uint64_t request_id) { |
| ExtensionHost* host = GetBackgroundHostForExtension( |
| GetExtensionID(render_frame_host)); |
| - if (host && IsFrameInExtensionHost(host, render_frame_host)) { |
| + if (host && IsFrameInExtensionHost(host, render_frame_host)) |
| host->OnNetworkRequestDone(request_id); |
|
Devlin
2016/05/31 22:45:30
Are we going to have the same problem here with on
nasko
2016/06/01 21:22:19
There were a bunch of problems with this version o
|
| - if (pending_network_requests_.erase(request_id)) |
| - DecrementLazyKeepaliveCount(host->extension()); |
| - } |
| + |
| + auto result = pending_network_requests_.find(request_id); |
| + if (result == pending_network_requests_.end()) |
| + return; |
| + |
| + DecrementLazyKeepaliveCount(result->second); |
| + pending_network_requests_.erase(request_id); |
| } |
| void ProcessManager::CancelSuspend(const Extension* extension) { |