Chromium Code Reviews| 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 08764e1046a4c0d27847c9bd55a4a33d7786ee63..56c46741eef691997e3ea74d11548452baabbfc2 100644 |
| --- a/chrome/browser/extensions/extension_process_manager.cc |
| +++ b/chrome/browser/extensions/extension_process_manager.cc |
| @@ -104,6 +104,9 @@ ExtensionProcessManager::ExtensionProcessManager(Profile* profile) |
| // |site_instance_id| in UnregisterExtensionSiteInstance. |
| registrar_.Add(this, content::NOTIFICATION_SITE_INSTANCE_DELETED, |
| NotificationService::AllBrowserContextsAndSources()); |
| + // Same for NOTIFICATION_RENDERER_PROCESS_CLOSED. |
| + registrar_.Add(this, content::NOTIFICATION_RENDERER_PROCESS_CLOSED, |
| + NotificationService::AllBrowserContextsAndSources()); |
| registrar_.Add(this, content::NOTIFICATION_APP_TERMINATING, |
| NotificationService::AllSources()); |
| } |
| @@ -246,6 +249,20 @@ void ExtensionProcessManager::UnregisterExtensionSiteInstance( |
| extension_ids_.erase(it++); |
| } |
| +void ExtensionProcessManager::RegisterProcessHostWithBindings(int host_id) { |
| + process_ids_.insert(host_id); |
| +} |
| + |
| +void ExtensionProcessManager::UnregisterProcessHostWithBindings(int host_id) { |
| + std::set<int>::iterator it = process_ids_.find(host_id); |
|
jam
2011/09/26 15:46:16
nit: you can also just write process_ids_.erase(ho
|
| + if (it != process_ids_.end()) |
| + process_ids_.erase(it); |
| +} |
| + |
| +bool ExtensionProcessManager::IsProcessHostWithBindings(int host_id) const { |
| + return process_ids_.find(host_id) != process_ids_.end(); |
| +} |
| + |
| RenderProcessHost* ExtensionProcessManager::GetExtensionProcess( |
| const GURL& url) { |
| if (!browsing_instance_->HasSiteInstance(url)) |
| @@ -335,6 +352,13 @@ void ExtensionProcessManager::Observe(int type, |
| break; |
| } |
| + case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: { |
| + RenderProcessHost* process_host = |
| + Source<RenderProcessHost>(source).ptr(); |
| + UnregisterProcessHostWithBindings(process_host->id()); |
| + break; |
| + } |
| + |
| case chrome::NOTIFICATION_EXTENSION_HOST_VIEW_SHOULD_CLOSE: { |
| ExtensionHost* host = Details<ExtensionHost>(details).ptr(); |
| if (host->extension_host_type() == ViewType::EXTENSION_BACKGROUND_PAGE) { |