diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 13:56:25 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-19 13:56:25 +0000 |
commit | 7c6877dea4bdbc7bd434ea9c96795529e466903c (patch) | |
tree | d7ac3fa32188710955166e416c6bd632759fcf10 /chrome/browser/task_manager_resource_providers.cc | |
parent | 5b3986e89eca4e3045dde25635e270f6ea5d2961 (diff) | |
download | chromium_src-7c6877dea4bdbc7bd434ea9c96795529e466903c.zip chromium_src-7c6877dea4bdbc7bd434ea9c96795529e466903c.tar.gz chromium_src-7c6877dea4bdbc7bd434ea9c96795529e466903c.tar.bz2 |
Display an infobar alert when extension process crashes.
Also correctly handle crashes in task manager. The infobar allows user to restart the extension process.
TEST=Install buildbot extension, see its content in the shelf. Open task manager, kill extension process. Click "restart" in the infobar that should appear. The extension content in the shelf should re-appear after the crash.
http://crbug.com/14111
Review URL: http://codereview.chromium.org/126289
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18809 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager_resource_providers.cc')
-rw-r--r-- | chrome/browser/task_manager_resource_providers.cc | 18 |
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()); |