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

Unified Diff: extensions/browser/process_manager.cc

Issue 2044643003: Revert of Fix event page process cleanup when running in --isolate-extensions mode. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « extensions/browser/process_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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) {
« no previous file with comments | « extensions/browser/process_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698