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

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

Issue 8033001: Delegate decision what site instances can be rendered in what process to chrome (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: updates Created 9 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
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..1db0def3b5025aaa077b16efae1cbedbe287868c 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,18 @@ void ExtensionProcessManager::UnregisterExtensionSiteInstance(
extension_ids_.erase(it++);
}
+void ExtensionProcessManager::RegisterProcessHost(int host_id) {
+ process_ids_.insert(host_id);
+}
+
+void ExtensionProcessManager::UnregisterProcessHost(int host_id) {
+ process_ids_.erase(host_id);
+}
+
+bool ExtensionProcessManager::IsExtensionProcessHost(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 +350,13 @@ void ExtensionProcessManager::Observe(int type,
break;
}
+ case content::NOTIFICATION_RENDERER_PROCESS_CLOSED: {
+ RenderProcessHost* process_host =
+ Source<RenderProcessHost>(source).ptr();
+ UnregisterProcessHost(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) {

Powered by Google App Engine
This is Rietveld 408576698