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

Unified Diff: chrome/browser/memory_details.cc

Issue 10409088: Get rid of the RenderViewType concept in content, since it was only used by Chrome. Store the enum… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: review comments Created 8 years, 7 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
Index: chrome/browser/memory_details.cc
===================================================================
--- chrome/browser/memory_details.cc (revision 138369)
+++ chrome/browser/memory_details.cc (working copy)
@@ -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 @@
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 @@
}
}
}
- 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;

Powered by Google App Engine
This is Rietveld 408576698