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

Unified Diff: extensions/browser/process_manager.cc

Issue 1366393002: Prevent imbalanced keepalive counts in ProcessManager (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nits Created 5 years, 3 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 a4a46cd6205d29523599e0f30d32fa2eafdfa2ba..8b2b4b534b92e13bad3a2a9530c0f928c93eb284 100644
--- a/extensions/browser/process_manager.cc
+++ b/extensions/browser/process_manager.cc
@@ -553,6 +553,8 @@ void ProcessManager::OnNetworkRequestStarted(
uint64 request_id) {
ExtensionHost* host = GetBackgroundHostForExtension(
GetExtensionID(render_frame_host));
+ auto result = pending_network_requests_.insert(request_id);
+ DCHECK(result.second) << "Duplicate network request IDs.";
if (host && IsFrameInExtensionHost(host, render_frame_host)) {
IncrementLazyKeepaliveCount(host->extension());
host->OnNetworkRequestStarted(request_id);
@@ -566,7 +568,8 @@ void ProcessManager::OnNetworkRequestDone(
GetExtensionID(render_frame_host));
if (host && IsFrameInExtensionHost(host, render_frame_host)) {
host->OnNetworkRequestDone(request_id);
- DecrementLazyKeepaliveCount(host->extension());
+ if (pending_network_requests_.erase(request_id))
+ DecrementLazyKeepaliveCount(host->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