diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-08 21:43:35 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-08 21:43:35 +0000 |
commit | 79dc42cdd33ac921aa435646ee242845bfa4fb87 (patch) | |
tree | faea8d7d8dd64c82fb24484f1ca3f7b5c146e582 | |
parent | 6d2aca529a7dd5a5ab6fc9dacdfc997d6b892035 (diff) | |
download | chromium_src-79dc42cdd33ac921aa435646ee242845bfa4fb87.zip chromium_src-79dc42cdd33ac921aa435646ee242845bfa4fb87.tar.gz chromium_src-79dc42cdd33ac921aa435646ee242845bfa4fb87.tar.bz2 |
Fix crasher caused by non-ExtensionHost-based RenderViewHostDelegates in
extension processes (notifications or sidebars currently) when viewing
about:memory.
BUG=68773
TEST=create an HTML notification (webkitNotifications.createHTMLNotification)
from an extension process and show about:memory. the browser shouldn't crash.
Review URL: http://codereview.chromium.org/6174003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70852 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/memory_details.cc | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc index fc3d5f8..233f444 100644 --- a/chrome/browser/memory_details.cc +++ b/chrome/browser/memory_details.cc @@ -12,7 +12,8 @@ #include "base/utf_string_conversions.h" #include "chrome/browser/browser_child_process_host.h" #include "chrome/browser/browser_thread.h" -#include "chrome/browser/extensions/extension_host.h" +#include "chrome/browser/extensions/extension_service.h" +#include "chrome/browser/profiles/profile.h" #include "chrome/browser/renderer_host/backing_store_manager.h" #include "chrome/browser/renderer_host/render_process_host.h" #include "chrome/browser/renderer_host/render_view_host.h" @@ -134,6 +135,9 @@ void MemoryDetails::CollectChildInfoOnUIThread() { continue; } process.type = ChildProcessInfo::RENDER_PROCESS; + Profile* profile = render_process_host->profile(); + ExtensionService* extension_service = profile->GetExtensionService(); + // The RenderProcessHost may host multiple TabContents. Any // of them which contain diagnostics information make the whole // process be considered a diagnostics process. @@ -169,11 +173,12 @@ void MemoryDetails::CollectChildInfoOnUIThread() { contents = host_delegate->GetAsTabContents(); if (!contents) { if (host->is_extension_process()) { - // TODO(erikkay) should we just add GetAsExtensionHost to - // TabContents? - ExtensionHost* eh = static_cast<ExtensionHost*>(host_delegate); - string16 title = UTF8ToUTF16(eh->extension()->name()); - process.titles.push_back(title); + const Extension* extension = + extension_service->GetExtensionByURL(url); + if (extension) { + string16 title = UTF8ToUTF16(extension->name()); + process.titles.push_back(title); + } } else if (process.renderer_type == ChildProcessInfo::RENDERER_UNKNOWN) { process.titles.push_back(UTF8ToUTF16(url.spec())); |