diff options
author | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-28 20:13:20 +0000 |
---|---|---|
committer | erikkay@chromium.org <erikkay@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-12-28 20:13:20 +0000 |
commit | fcf79351461195a0d9f04549cfb9a72b4c72e7c1 (patch) | |
tree | 1891644d3779ad80137b812edd7db4ab1d9ce644 /chrome/common/child_process_info.cc | |
parent | c50c66dcc9d8b162e50b2888711cc9fa319cf7f2 (diff) | |
download | chromium_src-fcf79351461195a0d9f04549cfb9a72b4c72e7c1.zip chromium_src-fcf79351461195a0d9f04549cfb9a72b4c72e7c1.tar.gz chromium_src-fcf79351461195a0d9f04549cfb9a72b4c72e7c1.tar.bz2 |
fix about:memory and memory histograms
BUG=22020
TEST=about:memory
Review URL: http://codereview.chromium.org/5981007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@70236 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/child_process_info.cc')
-rw-r--r-- | chrome/common/child_process_info.cc | 54 |
1 files changed, 47 insertions, 7 deletions
diff --git a/chrome/common/child_process_info.cc b/chrome/common/child_process_info.cc index 8774578..69122cc 100644 --- a/chrome/common/child_process_info.cc +++ b/chrome/common/child_process_info.cc @@ -16,8 +16,18 @@ #include "base/utf_string_conversions.h" #include "grit/generated_resources.h" +ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : + type_(type), + renderer_type_(RENDERER_UNKNOWN) { + if (id == -1) + id_ = GenerateChildProcessUniqueId(); + else + id_ = id; +} + ChildProcessInfo::ChildProcessInfo(const ChildProcessInfo& original) : type_(original.type_), + renderer_type_(original.renderer_type_), name_(original.name_), version_(original.version_), id_(original.id_), @@ -31,6 +41,7 @@ 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_; @@ -39,6 +50,7 @@ ChildProcessInfo& ChildProcessInfo::operator=( return *this; } +// static std::string ChildProcessInfo::GetTypeNameInEnglish( ChildProcessInfo::ProcessType type) { switch (type) { @@ -73,6 +85,41 @@ 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); +} + + string16 ChildProcessInfo::GetLocalizedTitle() const { string16 title = WideToUTF16Hack(name_); if (type_ == ChildProcessInfo::PLUGIN_PROCESS && title.empty()) @@ -124,13 +171,6 @@ string16 ChildProcessInfo::GetLocalizedTitle() const { return title; } -ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : type_(type) { - if (id == -1) - id_ = GenerateChildProcessUniqueId(); - else - id_ = id; -} - 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. |