summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 18:30:45 +0000
committerphajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-03-25 18:30:45 +0000
commitd043c2cccc2705908f2a3d39d404c8bf1a51c0de (patch)
tree6c2d946dc5fcbd111fab9c3662ea98af433c702b /base
parent4b576875ad1b570c3f34f549df27b9e98941dac7 (diff)
downloadchromium_src-d043c2cccc2705908f2a3d39d404c8bf1a51c0de.zip
chromium_src-d043c2cccc2705908f2a3d39d404c8bf1a51c0de.tar.gz
chromium_src-d043c2cccc2705908f2a3d39d404c8bf1a51c0de.tar.bz2
Cleanup in chrome/browser
- make more things const - remove unreferenced declaration of GetGoButton - fix indentation in one place Review URL: http://codereview.chromium.org/53053 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@12475 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base')
-rw-r--r--base/process_util.h16
-rw-r--r--base/process_util_linux.cc2
-rw-r--r--base/process_util_mac.mm2
-rw-r--r--base/process_util_win.cc16
4 files changed, 18 insertions, 18 deletions
diff --git a/base/process_util.h b/base/process_util.h
index 0f074b1..35a051a 100644
--- a/base/process_util.h
+++ b/base/process_util.h
@@ -290,27 +290,27 @@ class ProcessMetrics {
// Returns the current space allocated for the pagefile, in bytes (these pages
// may or may not be in memory).
- size_t GetPagefileUsage();
+ size_t GetPagefileUsage() const;
// Returns the peak space allocated for the pagefile, in bytes.
- size_t GetPeakPagefileUsage();
+ size_t GetPeakPagefileUsage() const;
// Returns the current working set size, in bytes.
- size_t GetWorkingSetSize();
+ size_t GetWorkingSetSize() const;
// Returns private usage, in bytes. Private bytes is the amount
// of memory currently allocated to a process that cannot be shared.
// Note: returns 0 on unsupported OSes: prior to XP SP2.
- size_t GetPrivateBytes();
+ size_t GetPrivateBytes() const;
// Fills a CommittedKBytes with both resident and paged
// memory usage as per definition of CommittedBytes.
- void GetCommittedKBytes(CommittedKBytes* usage);
+ void GetCommittedKBytes(CommittedKBytes* usage) const;
// Fills a WorkingSetKBytes containing resident private and shared memory
// usage in bytes, as per definition of WorkingSetBytes.
- bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage);
+ bool GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const;
// Computes the current process available memory for allocation.
// It does a linear scan of the address space querying each memory region
// for its free (unallocated) status. It is useful for estimating the memory
// load and fragmentation.
- bool CalculateFreeMemory(FreeMBytes* free);
+ bool CalculateFreeMemory(FreeMBytes* free) const;
// Returns the CPU usage in percent since the last time this method was
// called. The first time this method is called it returns 0 and will return
@@ -325,7 +325,7 @@ class ProcessMetrics {
// If IO information is retrieved successfully, the function returns true
// and fills in the IO_COUNTERS passed in. The function returns false
// otherwise.
- bool GetIOCounters(IoCounters* io_counters);
+ bool GetIOCounters(IoCounters* io_counters) const;
private:
explicit ProcessMetrics(ProcessHandle process);
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index 7e43885..dcac3bd 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -202,7 +202,7 @@ bool NamedProcessIterator::IncludeEntry() {
// To have /proc/self/io file you must enable CONFIG_TASK_IO_ACCOUNTING
// in your kernel configuration.
-bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) {
+bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
std::string proc_io_contents;
if (!file_util::ReadFileToString(L"/proc/self/io", &proc_io_contents))
return false;
diff --git a/base/process_util_mac.mm b/base/process_util_mac.mm
index ff78c07..98714c8 100644
--- a/base/process_util_mac.mm
+++ b/base/process_util_mac.mm
@@ -226,7 +226,7 @@ bool NamedProcessIterator::IncludeEntry() {
return filter_->Includes(entry_.pid, entry_.ppid);
}
-bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) {
+bool ProcessMetrics::GetIOCounters(IoCounters* io_counters) const {
// TODO(pinkerton): can we implement this? On linux it relies on /proc.
NOTIMPLEMENTED();
return false;
diff --git a/base/process_util_win.cc b/base/process_util_win.cc
index 0ced788..beb4ea3 100644
--- a/base/process_util_win.cc
+++ b/base/process_util_win.cc
@@ -388,7 +388,7 @@ ProcessMetrics* ProcessMetrics::CreateProcessMetrics(ProcessHandle process) {
ProcessMetrics::~ProcessMetrics() { }
-size_t ProcessMetrics::GetPagefileUsage() {
+size_t ProcessMetrics::GetPagefileUsage() const {
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(process_, &pmc, sizeof(pmc))) {
return pmc.PagefileUsage;
@@ -397,7 +397,7 @@ size_t ProcessMetrics::GetPagefileUsage() {
}
// Returns the peak space allocated for the pagefile, in bytes.
-size_t ProcessMetrics::GetPeakPagefileUsage() {
+size_t ProcessMetrics::GetPeakPagefileUsage() const {
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(process_, &pmc, sizeof(pmc))) {
return pmc.PeakPagefileUsage;
@@ -406,7 +406,7 @@ size_t ProcessMetrics::GetPeakPagefileUsage() {
}
// Returns the current working set size, in bytes.
-size_t ProcessMetrics::GetWorkingSetSize() {
+size_t ProcessMetrics::GetWorkingSetSize() const {
PROCESS_MEMORY_COUNTERS pmc;
if (GetProcessMemoryInfo(process_, &pmc, sizeof(pmc))) {
return pmc.WorkingSetSize;
@@ -414,7 +414,7 @@ size_t ProcessMetrics::GetWorkingSetSize() {
return 0;
}
-size_t ProcessMetrics::GetPrivateBytes() {
+size_t ProcessMetrics::GetPrivateBytes() const {
// PROCESS_MEMORY_COUNTERS_EX is not supported until XP SP2.
// GetProcessMemoryInfo() will simply fail on prior OS. So the requested
// information is simply not available. Hence, we will return 0 on unsupported
@@ -428,7 +428,7 @@ size_t ProcessMetrics::GetPrivateBytes() {
return 0;
}
-void ProcessMetrics::GetCommittedKBytes(CommittedKBytes* usage) {
+void ProcessMetrics::GetCommittedKBytes(CommittedKBytes* usage) const {
MEMORY_BASIC_INFORMATION mbi = {0};
size_t committed_private = 0;
size_t committed_mapped = 0;
@@ -455,7 +455,7 @@ void ProcessMetrics::GetCommittedKBytes(CommittedKBytes* usage) {
usage->priv = committed_private / 1024;
}
-bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) {
+bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const {
size_t ws_private = 0;
size_t ws_shareable = 0;
size_t ws_shared = 0;
@@ -574,11 +574,11 @@ int ProcessMetrics::GetCPUUsage() {
return cpu;
}
-bool ProcessMetrics::GetIOCounters(IO_COUNTERS* io_counters) {
+bool ProcessMetrics::GetIOCounters(IO_COUNTERS* io_counters) const {
return GetProcessIoCounters(process_, io_counters) != FALSE;
}
-bool ProcessMetrics::CalculateFreeMemory(FreeMBytes* free) {
+bool ProcessMetrics::CalculateFreeMemory(FreeMBytes* free) const {
const SIZE_T kTopAdress = 0x7F000000;
const SIZE_T kMegabyte = 1024 * 1024;
SIZE_T accumulated = 0;