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 |
// |