Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(28)

Unified Diff: extensions/browser/process_manager.cc

Issue 2028873002: Fix event page process cleanup when running in --isolate-extensions mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cleanup empty lines and formatting. Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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) {

Powered by Google App Engine
This is Rietveld 408576698