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

Unified Diff: chrome/browser/extensions/extension_process_manager.cc

Issue 10310005: Fix imbalanced keepalive count for event pages when dealing with other views. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: sync Created 8 years, 8 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 | « chrome/browser/extensions/extension_process_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/extension_process_manager.cc
diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc
index cf7230f675a9beef6f439f1a6f62540e7ccab633..f8a72ab5e8b4c01c1bb5d71006d601dd0df7521a 100644
--- a/chrome/browser/extensions/extension_process_manager.cc
+++ b/chrome/browser/extensions/extension_process_manager.cc
@@ -345,8 +345,7 @@ const Extension* ExtensionProcessManager::GetExtensionForRenderViewHost(
ExtensionService* service =
ExtensionSystem::Get(GetProfile())->extension_service();
- return service->extensions()->GetByID(
- render_view_host->GetSiteInstance()->GetSite().host());
+ return service->extensions()->GetByID(GetExtensionID(render_view_host));
}
void ExtensionProcessManager::RegisterRenderViewHost(
@@ -554,7 +553,7 @@ void ExtensionProcessManager::Observe(
case chrome::NOTIFICATION_EXTENSION_HOST_DESTROYED: {
ExtensionHost* host = content::Details<ExtensionHost>(details).ptr();
if (background_hosts_.erase(host))
- background_page_data_.erase(host->extension()->id());
+ ClearBackgroundPageData(host->extension()->id());
platform_app_hosts_.erase(host);
break;
}
@@ -646,6 +645,20 @@ void ExtensionProcessManager::CloseBackgroundHosts() {
}
}
+void ExtensionProcessManager::ClearBackgroundPageData(
+ const std::string& extension_id) {
+ background_page_data_.erase(extension_id);
+
+ // Re-register all RenderViews for this extension. We do this to restore
Yoyo Zhou 2012/05/03 00:10:25 Do we need to do this, or could we just not erase
Matt Perry 2012/05/03 00:18:38 I think we still need to erase background_page_dat
+ // the lazy_keepalive_count (if any) to properly reflect the number of open
+ // views.
+ for (ExtensionRenderViews::const_iterator it = all_extension_views_.begin();
+ it != all_extension_views_.end(); ++it) {
+ if (GetExtensionID(it->first) == extension_id)
+ UpdateRegisteredRenderView(it->first);
+ }
+}
+
//
// IncognitoExtensionProcessManager
//
« no previous file with comments | « chrome/browser/extensions/extension_process_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698