summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_details.cc
diff options
context:
space:
mode:
authorjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 05:31:15 +0000
committerjam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-23 05:31:15 +0000
commit299d7f1d0003d467a159fb79ba1884080a655a00 (patch)
tree087f5e337119e9c836260bf46cfd808236157d30 /chrome/browser/memory_details.cc
parentde030d16f66334efafdef4ddd01f715d9ebbcfe9 (diff)
downloadchromium_src-299d7f1d0003d467a159fb79ba1884080a655a00.zip
chromium_src-299d7f1d0003d467a159fb79ba1884080a655a00.tar.gz
chromium_src-299d7f1d0003d467a159fb79ba1884080a655a00.tar.bz2
Get rid of the RenderViewType concept in content, since it was only used by Chrome. Store the enum value in the WebContents' property bag.
BUG=98716 Review URL: https://chromiumcodereview.appspot.com/10409088 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@138434 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details.cc')
-rw-r--r--chrome/browser/memory_details.cc68
1 files changed, 32 insertions, 36 deletions
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 2f08bbf3..3f2dedc 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -14,7 +14,7 @@
#include "chrome/browser/extensions/extension_process_manager.h"
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/common/chrome_view_type.h"
+#include "chrome/browser/view_type_utils.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/url_constants.h"
#include "content/public/browser/browser_child_process_host_iterator.h"
@@ -24,7 +24,6 @@
#include "content/public/browser/navigation_entry.h"
#include "content/public/browser/render_process_host.h"
#include "content/public/browser/render_view_host.h"
-#include "content/public/browser/render_view_host_delegate.h"
#include "content/public/browser/web_contents.h"
#include "content/public/common/bindings_policy.h"
#include "content/public/common/process_type.h"
@@ -242,12 +241,13 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
if (!widget || !widget->IsRenderView())
continue;
- const RenderViewHost* host =
+ RenderViewHost* host =
RenderViewHost::From(const_cast<RenderWidgetHost*>(widget));
- content::RenderViewHostDelegate* host_delegate = host->GetDelegate();
- DCHECK(host_delegate);
- GURL url = host_delegate->GetURL();
- content::ViewType type = host_delegate->GetRenderViewType();
+ WebContents* contents = WebContents::FromRenderViewHost(host);
+ GURL url;
+ if (contents)
+ url = contents->GetURL();
+ chrome::ViewType type = chrome::GetViewType(contents);
if (host->GetEnabledBindings() & content::BINDINGS_POLICY_WEB_UI) {
process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME;
} else if (extension_process_map->Contains(
@@ -268,41 +268,37 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
}
}
}
- WebContents* contents = host_delegate->GetAsWebContents();
+ if (extension_process_map->Contains(host->GetProcess()->GetID())) {
+ const Extension* extension =
+ extension_service->extensions()->GetByID(url.host());
+ if (extension) {
+ string16 title = UTF8ToUTF16(extension->name());
+ process.titles.push_back(title);
+ }
+ continue;
+ }
+
if (!contents) {
- if (extension_process_map->Contains(host->GetProcess()->GetID())) {
- const Extension* extension =
- extension_service->extensions()->GetByID(url.host());
- if (extension) {
- string16 title = UTF8ToUTF16(extension->name());
- process.titles.push_back(title);
- }
- } else if (process.renderer_type ==
- ProcessMemoryInformation::RENDERER_UNKNOWN) {
- process.titles.push_back(UTF8ToUTF16(url.spec()));
- switch (type) {
- case chrome::VIEW_TYPE_BACKGROUND_CONTENTS:
- process.renderer_type =
+ process.renderer_type =
+ ProcessMemoryInformation::RENDERER_INTERSTITIAL;
+ continue;
+ }
+
+ if (type == chrome::VIEW_TYPE_BACKGROUND_CONTENTS) {
+ process.titles.push_back(UTF8ToUTF16(url.spec()));
+ process.renderer_type =
ProcessMemoryInformation::RENDERER_BACKGROUND_APP;
- break;
- case content::VIEW_TYPE_INTERSTITIAL_PAGE:
- process.renderer_type =
- ProcessMemoryInformation::RENDERER_INTERSTITIAL;
- break;
- case chrome::VIEW_TYPE_NOTIFICATION:
- process.renderer_type =
+ continue;
+ }
+
+ if (type == chrome::VIEW_TYPE_NOTIFICATION) {
+ process.titles.push_back(UTF8ToUTF16(url.spec()));
+ process.renderer_type =
ProcessMemoryInformation::RENDERER_NOTIFICATION;
- break;
- default:
- process.renderer_type =
- ProcessMemoryInformation::RENDERER_UNKNOWN;
- break;
- }
- }
continue;
}
- // Since We have a WebContents and and the renderer type hasn't been
+ // Since we have a WebContents and and the renderer type hasn't been
// set yet, it must be a normal tabbed renderer.
if (process.renderer_type == ProcessMemoryInformation::RENDERER_UNKNOWN)
process.renderer_type = ProcessMemoryInformation::RENDERER_NORMAL;