summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/automation/automation_provider_observers.cc5
-rw-r--r--chrome/browser/browser_about_handler.cc4
-rw-r--r--chrome/browser/chromeos/system/syslogs_provider.cc2
-rw-r--r--chrome/browser/memory_details.cc72
-rw-r--r--chrome/browser/memory_details.h20
-rw-r--r--content/common/child_process_info.cc39
-rw-r--r--content/common/child_process_info.h24
7 files changed, 82 insertions, 84 deletions
diff --git a/chrome/browser/automation/automation_provider_observers.cc b/chrome/browser/automation/automation_provider_observers.cc
index c12bc02..8dde537 100644
--- a/chrome/browser/automation/automation_provider_observers.cc
+++ b/chrome/browser/automation/automation_provider_observers.cc
@@ -2872,8 +2872,9 @@ void ProcessInfoObserver::OnDetailsAvailable() {
// Renderer type, if this is a renderer process.
std::string renderer_type = "Unknown";
- if (iterator->renderer_type != ChildProcessInfo::RENDERER_UNKNOWN) {
- renderer_type = ChildProcessInfo::GetRendererTypeNameInEnglish(
+ if (iterator->renderer_type !=
+ ProcessMemoryInformation::RENDERER_UNKNOWN) {
+ renderer_type = ProcessMemoryInformation::GetRendererTypeNameInEnglish(
iterator->renderer_type);
}
proc_data->SetString("renderer_type", renderer_type);
diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc
index 1d3eb95..ba6c0ac 100644
--- a/chrome/browser/browser_about_handler.cc
+++ b/chrome/browser/browser_about_handler.cc
@@ -1277,8 +1277,8 @@ void AboutMemoryHandler::AppendProcess(ListValue* child_data,
BindProcessMetrics(child, info);
std::string child_label(
- ChildProcessInfo::GetFullTypeNameInEnglish(info->type,
- info->renderer_type));
+ ProcessMemoryInformation::GetFullTypeNameInEnglish(info->type,
+ info->renderer_type));
if (info->is_diagnostics)
child_label.append(" (diagnostics)");
child->SetString("child_name", child_label);
diff --git a/chrome/browser/chromeos/system/syslogs_provider.cc b/chrome/browser/chromeos/system/syslogs_provider.cc
index 07b556f..31046c0b 100644
--- a/chrome/browser/chromeos/system/syslogs_provider.cc
+++ b/chrome/browser/chromeos/system/syslogs_provider.cc
@@ -260,7 +260,7 @@ class SyslogsMemoryHandler : public MemoryDetails {
chrome.processes.begin();
iter1 != chrome.processes.end(); ++iter1) {
std::string process_string(
- ChildProcessInfo::GetFullTypeNameInEnglish(
+ ProcessMemoryInformation::GetFullTypeNameInEnglish(
iter1->type, iter1->renderer_type));
if (!iter1->titles.empty()) {
std::string titles(" [");
diff --git a/chrome/browser/memory_details.cc b/chrome/browser/memory_details.cc
index 20d04a4..1cd7a27 100644
--- a/chrome/browser/memory_details.cc
+++ b/chrome/browser/memory_details.cc
@@ -35,12 +35,46 @@
using content::BrowserThread;
+// static
+std::string ProcessMemoryInformation::GetRendererTypeNameInEnglish(
+ RendererProcessType type) {
+ switch (type) {
+ case RENDERER_NORMAL:
+ return "Tab";
+ case RENDERER_CHROME:
+ return "Tab (Chrome)";
+ case RENDERER_EXTENSION:
+ return "Extension";
+ case RENDERER_DEVTOOLS:
+ return "Devtools";
+ case RENDERER_INTERSTITIAL:
+ return "Interstitial";
+ case RENDERER_NOTIFICATION:
+ return "Notification";
+ case RENDERER_BACKGROUND_APP:
+ return "Background App";
+ case RENDERER_UNKNOWN:
+ default:
+ NOTREACHED() << "Unknown renderer process type!";
+ return "Unknown";
+ }
+}
+
+// static
+std::string ProcessMemoryInformation::GetFullTypeNameInEnglish(
+ ChildProcessInfo::ProcessType type,
+ RendererProcessType rtype) {
+ if (type == ChildProcessInfo::RENDER_PROCESS)
+ return GetRendererTypeNameInEnglish(rtype);
+ return ChildProcessInfo::GetTypeNameInEnglish(type);
+}
+
ProcessMemoryInformation::ProcessMemoryInformation()
: pid(0),
num_processes(0),
is_diagnostics(false),
type(ChildProcessInfo::UNKNOWN_PROCESS),
- renderer_type(ChildProcessInfo::RENDERER_UNKNOWN) {
+ renderer_type(RENDERER_UNKNOWN) {
}
ProcessMemoryInformation::~ProcessMemoryInformation() {}
@@ -101,7 +135,7 @@ void MemoryDetails::CollectChildInfoOnIOThread() {
continue;
info.type = iter->type();
- info.renderer_type = iter->renderer_type();
+ info.renderer_type = ProcessMemoryInformation::RENDERER_UNKNOWN;
info.titles.push_back(iter->name());
child_info.push_back(info);
}
@@ -174,9 +208,9 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
// TODO(erikkay) the type for devtools doesn't actually appear to
// be set.
if (type == content::VIEW_TYPE_DEV_TOOLS_UI)
- process.renderer_type = ChildProcessInfo::RENDERER_DEVTOOLS;
+ process.renderer_type = ProcessMemoryInformation::RENDERER_DEVTOOLS;
else
- process.renderer_type = ChildProcessInfo::RENDERER_CHROME;
+ process.renderer_type = ProcessMemoryInformation::RENDERER_CHROME;
} else if (extension_process_map->Contains(host->process()->GetID())) {
// For our purposes, don't count processes containing only hosted apps
// as extension processes. See also: crbug.com/102533.
@@ -188,7 +222,8 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
const Extension* extension =
extension_service->GetExtensionById(*iter, false);
if (extension && !extension->is_hosted_app()) {
- process.renderer_type = ChildProcessInfo::RENDERER_EXTENSION;
+ process.renderer_type =
+ ProcessMemoryInformation::RENDERER_EXTENSION;
break;
}
}
@@ -203,21 +238,24 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
process.titles.push_back(title);
}
} else if (process.renderer_type ==
- ChildProcessInfo::RENDERER_UNKNOWN) {
+ ProcessMemoryInformation::RENDERER_UNKNOWN) {
process.titles.push_back(UTF8ToUTF16(url.spec()));
switch (type) {
case chrome::VIEW_TYPE_BACKGROUND_CONTENTS:
process.renderer_type =
- ChildProcessInfo::RENDERER_BACKGROUND_APP;
+ ProcessMemoryInformation::RENDERER_BACKGROUND_APP;
break;
case content::VIEW_TYPE_INTERSTITIAL_PAGE:
- process.renderer_type = ChildProcessInfo::RENDERER_INTERSTITIAL;
+ process.renderer_type =
+ ProcessMemoryInformation::RENDERER_INTERSTITIAL;
break;
case chrome::VIEW_TYPE_NOTIFICATION:
- process.renderer_type = ChildProcessInfo::RENDERER_NOTIFICATION;
+ process.renderer_type =
+ ProcessMemoryInformation::RENDERER_NOTIFICATION;
break;
default:
- process.renderer_type = ChildProcessInfo::RENDERER_UNKNOWN;
+ process.renderer_type =
+ ProcessMemoryInformation::RENDERER_UNKNOWN;
break;
}
}
@@ -226,8 +264,8 @@ void MemoryDetails::CollectChildInfoOnUIThread() {
// Since We have a TabContents and and the renderer type hasn't been
// set yet, it must be a normal tabbed renderer.
- if (process.renderer_type == ChildProcessInfo::RENDERER_UNKNOWN)
- process.renderer_type = ChildProcessInfo::RENDERER_NORMAL;
+ if (process.renderer_type == ProcessMemoryInformation::RENDERER_UNKNOWN)
+ process.renderer_type = ProcessMemoryInformation::RENDERER_NORMAL;
string16 title = contents->GetTitle();
if (!title.length())
@@ -305,21 +343,21 @@ void MemoryDetails::UpdateHistograms() {
UMA_HISTOGRAM_MEMORY_KB("Memory.Browser", sample);
break;
case ChildProcessInfo::RENDER_PROCESS: {
- ChildProcessInfo::RendererProcessType renderer_type =
+ ProcessMemoryInformation::RendererProcessType renderer_type =
browser.processes[index].renderer_type;
switch (renderer_type) {
- case ChildProcessInfo::RENDERER_EXTENSION:
+ case ProcessMemoryInformation::RENDERER_EXTENSION:
UMA_HISTOGRAM_MEMORY_KB("Memory.Extension", sample);
extension_count++;
break;
- case ChildProcessInfo::RENDERER_CHROME:
+ case ProcessMemoryInformation::RENDERER_CHROME:
UMA_HISTOGRAM_MEMORY_KB("Memory.Chrome", sample);
chrome_count++;
break;
- case ChildProcessInfo::RENDERER_UNKNOWN:
+ case ProcessMemoryInformation::RENDERER_UNKNOWN:
NOTREACHED() << "Unknown renderer process type.";
break;
- case ChildProcessInfo::RENDERER_NORMAL:
+ case ProcessMemoryInformation::RENDERER_NORMAL:
default:
// TODO(erikkay): Should we bother splitting out the other subtypes?
UMA_HISTOGRAM_MEMORY_KB("Memory.Renderer", sample);
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index e3e2204..da62580 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -17,6 +17,24 @@
// have multiple processes (of course!). Even IE has multiple
// processes these days.
struct ProcessMemoryInformation {
+ // NOTE: Do not remove or reorder the elements in this enum, and only add new
+ // items at the end. We depend on these specific values in a histogram.
+ enum RendererProcessType {
+ RENDERER_UNKNOWN = 0,
+ RENDERER_NORMAL,
+ RENDERER_CHROME, // WebUI (chrome:// URL)
+ RENDERER_EXTENSION, // chrome-extension://
+ RENDERER_DEVTOOLS, // Web inspector
+ RENDERER_INTERSTITIAL, // malware/phishing interstitial
+ RENDERER_NOTIFICATION, // HTML notification bubble
+ RENDERER_BACKGROUND_APP // hosted app background page
+ };
+
+ static std::string GetRendererTypeNameInEnglish(RendererProcessType type);
+ static std::string GetFullTypeNameInEnglish(
+ ChildProcessInfo::ProcessType type,
+ RendererProcessType rtype);
+
ProcessMemoryInformation();
~ProcessMemoryInformation();
@@ -39,7 +57,7 @@ struct ProcessMemoryInformation {
// If this is a child process of Chrome, what type (i.e. plugin) it is.
ChildProcessInfo::ProcessType type;
// If this is a renderer process, what type it is.
- ChildProcessInfo::RendererProcessType renderer_type;
+ RendererProcessType renderer_type;
// A collection of titles used, i.e. for a tab it'll show all the page titles.
std::vector<string16> titles;
};
diff --git a/content/common/child_process_info.cc b/content/common/child_process_info.cc
index fad7e03..3af852d 100644
--- a/content/common/child_process_info.cc
+++ b/content/common/child_process_info.cc
@@ -15,8 +15,7 @@
#include "base/utf_string_conversions.h"
ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) :
- type_(type),
- renderer_type_(RENDERER_UNKNOWN) {
+ type_(type) {
if (id == -1)
id_ = GenerateChildProcessUniqueId();
else
@@ -25,7 +24,6 @@ ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) :
ChildProcessInfo::ChildProcessInfo(const ChildProcessInfo& original)
: type_(original.type_),
- renderer_type_(original.renderer_type_),
name_(original.name_),
version_(original.version_),
id_(original.id_),
@@ -39,7 +37,6 @@ ChildProcessInfo& ChildProcessInfo::operator=(
const ChildProcessInfo& original) {
if (&original != this) {
type_ = original.type_;
- renderer_type_ = original.renderer_type_;
name_ = original.name_;
version_ = original.version_;
id_ = original.id_;
@@ -85,40 +82,6 @@ std::string ChildProcessInfo::GetTypeNameInEnglish(
}
}
-// static
-std::string ChildProcessInfo::GetRendererTypeNameInEnglish(
- ChildProcessInfo::RendererProcessType type) {
- switch (type) {
- case RENDERER_NORMAL:
- return "Tab";
- case RENDERER_CHROME:
- return "Tab (Chrome)";
- case RENDERER_EXTENSION:
- return "Extension";
- case RENDERER_DEVTOOLS:
- return "Devtools";
- case RENDERER_INTERSTITIAL:
- return "Interstitial";
- case RENDERER_NOTIFICATION:
- return "Notification";
- case RENDERER_BACKGROUND_APP:
- return "Background App";
- case RENDERER_UNKNOWN:
- default:
- NOTREACHED() << "Unknown renderer process type!";
- return "Unknown";
- }
-}
-
-// static
-std::string ChildProcessInfo::GetFullTypeNameInEnglish(
- ChildProcessInfo::ProcessType type,
- ChildProcessInfo::RendererProcessType rtype) {
- if (type == RENDER_PROCESS)
- return GetRendererTypeNameInEnglish(rtype);
- return GetTypeNameInEnglish(type);
-}
-
std::string ChildProcessInfo::GenerateRandomChannelID(void* instance) {
// Note: the string must start with the current process id, this is how
// child processes determine the pid of the parent.
diff --git a/content/common/child_process_info.h b/content/common/child_process_info.h
index ec50849..e71b0c2 100644
--- a/content/common/child_process_info.h
+++ b/content/common/child_process_info.h
@@ -36,19 +36,6 @@ class CONTENT_EXPORT ChildProcessInfo {
MAX_PROCESS
};
- // NOTE: Do not remove or reorder the elements in this enum, and only add new
- // items at the end. We depend on these specific values in a histogram.
- enum RendererProcessType {
- RENDERER_UNKNOWN = 0,
- RENDERER_NORMAL,
- RENDERER_CHROME, // WebUI (chrome:// URL)
- RENDERER_EXTENSION, // chrome-extension://
- RENDERER_DEVTOOLS, // Web inspector
- RENDERER_INTERSTITIAL, // malware/phishing interstitial
- RENDERER_NOTIFICATION, // HTML notification bubble
- RENDERER_BACKGROUND_APP // hosted app background page
- };
-
ChildProcessInfo(const ChildProcessInfo& original);
virtual ~ChildProcessInfo();
@@ -57,15 +44,11 @@ class CONTENT_EXPORT ChildProcessInfo {
// Returns the type of the process.
ProcessType type() const { return type_; }
- // Returns the renderer subtype of this process.
- // Only valid if the type() is RENDER_PROCESS.
- RendererProcessType renderer_type() const { return renderer_type_; }
-
// Returns the name of the process. i.e. for plugins it might be Flash, while
// for workers it might be the domain that it's from.
const string16& name() const { return name_; }
- // Returns the version of the exe, this only appliest to plugins. Otherwise
+ // Returns the version of the exe, this only applies to plugins. Otherwise
// the string is empty.
const string16& version() const { return version_; }
@@ -84,10 +67,7 @@ class CONTENT_EXPORT ChildProcessInfo {
// Returns an English name of the process type, should only be used for non
// user-visible strings, or debugging pages like about:memory.
- static std::string GetFullTypeNameInEnglish(ProcessType type,
- RendererProcessType rtype);
static std::string GetTypeNameInEnglish(ProcessType type);
- static std::string GetRendererTypeNameInEnglish(RendererProcessType type);
// We define the < operator so that the ChildProcessInfo can be used as a key
// in a std::map.
@@ -122,14 +102,12 @@ class CONTENT_EXPORT ChildProcessInfo {
ChildProcessInfo(ProcessType type, int id);
void set_type(ProcessType type) { type_ = type; }
- void set_renderer_type(RendererProcessType type) { renderer_type_ = type; }
void set_name(const string16& name) { name_ = name; }
void set_version(const string16& ver) { version_ = ver; }
void set_handle(base::ProcessHandle handle) { process_.set_handle(handle); }
private:
ProcessType type_;
- RendererProcessType renderer_type_;
string16 name_;
string16 version_;
int id_;