summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager_resource_providers.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/browser/task_manager_resource_providers.cc')
-rw-r--r--chrome/browser/task_manager_resource_providers.cc18
1 files changed, 16 insertions, 2 deletions
diff --git a/chrome/browser/task_manager_resource_providers.cc b/chrome/browser/task_manager_resource_providers.cc
index 7279aab..f76d8ad 100644
--- a/chrome/browser/task_manager_resource_providers.cc
+++ b/chrome/browser/task_manager_resource_providers.cc
@@ -540,22 +540,30 @@ void TaskManagerExtensionProcessResourceProvider::StartUpdating() {
AddToTaskManager(*jt);
}
- // Register for notifications to get new extension processes.
+ // Register for notifications about extension process changes.
registrar_.Add(this, NotificationType::EXTENSION_HOST_CREATED,
NotificationService::AllSources());
registrar_.Add(this, NotificationType::EXTENSION_HOST_DESTROYED,
NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::EXTENSION_PROCESS_CRASHED,
+ NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::EXTENSION_PROCESS_RESTORED,
+ NotificationService::AllSources());
}
void TaskManagerExtensionProcessResourceProvider::StopUpdating() {
DCHECK(updating_);
updating_ = false;
- // Unregister for notifications to get new extension processes.
+ // Unregister for notifications about extension process changes.
registrar_.Remove(this, NotificationType::EXTENSION_HOST_CREATED,
NotificationService::AllSources());
registrar_.Remove(this, NotificationType::EXTENSION_HOST_DESTROYED,
NotificationService::AllSources());
+ registrar_.Remove(this, NotificationType::EXTENSION_PROCESS_CRASHED,
+ NotificationService::AllSources());
+ registrar_.Remove(this, NotificationType::EXTENSION_PROCESS_RESTORED,
+ NotificationService::AllSources());
// Delete all the resources.
STLDeleteContainerPairSecondPointers(resources_.begin(), resources_.end());
@@ -570,9 +578,11 @@ void TaskManagerExtensionProcessResourceProvider::Observe(
const NotificationDetails& details) {
switch (type.value) {
case NotificationType::EXTENSION_HOST_CREATED:
+ case NotificationType::EXTENSION_PROCESS_RESTORED:
AddToTaskManager(Details<ExtensionHost>(details).ptr());
break;
case NotificationType::EXTENSION_HOST_DESTROYED:
+ case NotificationType::EXTENSION_PROCESS_CRASHED:
RemoveFromTaskManager(Details<ExtensionHost>(details).ptr());
break;
default:
@@ -583,6 +593,10 @@ void TaskManagerExtensionProcessResourceProvider::Observe(
void TaskManagerExtensionProcessResourceProvider::AddToTaskManager(
ExtensionHost* extension_host) {
+ // Don't add dead extension processes.
+ if (!extension_host->IsRenderViewLive())
+ return;
+
TaskManagerExtensionProcessResource* resource =
new TaskManagerExtensionProcessResource(extension_host);
DCHECK(resources_.find(extension_host) == resources_.end());