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

Unified Diff: chrome/browser/task_manager_resource_providers.cc

Issue 126289: Graceful handling of extension process crashes (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 6 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_view.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/task_manager_resource_providers.cc
===================================================================
--- chrome/browser/task_manager_resource_providers.cc (revision 18701)
+++ chrome/browser/task_manager_resource_providers.cc (working copy)
@@ -540,22 +540,30 @@
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 @@
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::AddToTaskManager(
ExtensionHost* extension_host) {
+ // Don't add dead extension processes.
+ if (!extension_host->IsViewLive())
+ return;
+
TaskManagerExtensionProcessResource* resource =
new TaskManagerExtensionProcessResource(extension_host);
DCHECK(resources_.find(extension_host) == resources_.end());
« no previous file with comments | « chrome/browser/extensions/extension_view.cc ('k') | chrome/common/notification_type.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698