summaryrefslogtreecommitdiffstats
path: root/chrome/browser/memory_details.h
diff options
context:
space:
mode:
authoragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 00:12:58 +0000
committeragl@chromium.org <agl@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-09-01 00:12:58 +0000
commit54fd1d3ac91d117719f157fad3ead41518865f52 (patch)
treebe3ec12e4da55384888a13707d8eee0f05e60a07 /chrome/browser/memory_details.h
parent1f758608ae7c38a580d574ec7e5061eb0bfa7ee2 (diff)
downloadchromium_src-54fd1d3ac91d117719f157fad3ead41518865f52.zip
chromium_src-54fd1d3ac91d117719f157fad3ead41518865f52.tar.gz
chromium_src-54fd1d3ac91d117719f157fad3ead41518865f52.tar.bz2
Linux: about:memory
(based on http://code.google.com/p/chromium/issues/detail?id=16251) Add about:memory support to Linux. Rather than try and copy the Windows output, we use a couple of metrics which make more sense on Linux: USS and PSS. http://codereview.chromium.org/177024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@24979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/memory_details.h')
-rw-r--r--chrome/browser/memory_details.h33
1 files changed, 13 insertions, 20 deletions
diff --git a/chrome/browser/memory_details.h b/chrome/browser/memory_details.h
index 8876c47..2e7e852 100644
--- a/chrome/browser/memory_details.h
+++ b/chrome/browser/memory_details.h
@@ -17,8 +17,11 @@ class MessageLoop;
// have multiple processes (of course!). Even IE has multiple
// processes these days.
struct ProcessMemoryInformation {
- ProcessMemoryInformation() {
- memset(this, 0, sizeof(ProcessMemoryInformation));
+ ProcessMemoryInformation()
+ : pid(0),
+ num_processes(0),
+ is_diagnostics(false),
+ type(ChildProcessInfo::UNKNOWN_PROCESS) {
}
// The process id.
@@ -46,8 +49,8 @@ typedef std::vector<ProcessMemoryInformation> ProcessMemoryInformationList;
// Browser Process Information.
struct ProcessData {
- const wchar_t* name;
- const wchar_t* process_name;
+ std::wstring name;
+ std::wstring process_name;
ProcessMemoryInformationList processes;
};
@@ -71,26 +74,13 @@ struct ProcessData {
// }
class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
public:
- // Known browsers which we collect details for.
- enum {
- CHROME_BROWSER = 0,
- IE_BROWSER,
- FIREFOX_BROWSER,
- OPERA_BROWSER,
- SAFARI_BROWSER,
- IE_64BIT_BROWSER,
- KONQUEROR_BROWSER,
- MAX_BROWSERS
- } BrowserProcess;
-
// Constructor.
MemoryDetails();
virtual ~MemoryDetails() {}
- // Access to the process detail information. This is an array
- // of MAX_BROWSER ProcessData structures. This data is only available
+ // Access to the process detail information. This data is only available
// after OnDetailsAvailable() has been called.
- ProcessData* processes() { return process_data_; }
+ const std::vector<ProcessData>& processes() { return process_data_; }
// Initiate updating the current memory details. These are fetched
// asynchronously because data must be collected from multiple threads.
@@ -123,7 +113,10 @@ class MemoryDetails : public base::RefCountedThreadSafe<MemoryDetails> {
// the global histograms for tracking memory usage.
void UpdateHistograms();
- ProcessData process_data_[MAX_BROWSERS];
+ // Returns a pointer to the ProcessData structure for Chrome.
+ ProcessData* ChromeBrowser();
+
+ std::vector<ProcessData> process_data_;
MessageLoop* ui_loop_;
DISALLOW_EVIL_CONSTRUCTORS(MemoryDetails);