summaryrefslogtreecommitdiffstats
path: root/chrome/browser/task_manager.cc
diff options
context:
space:
mode:
authorbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 03:25:15 +0000
committerbrettw@google.com <brettw@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2008-11-14 03:25:15 +0000
commit176aa48371da91eb98d675d87b4e70c7b26d696f (patch)
tree4c972de6ecd5a54650ab1dc7d421187f5d25834f /chrome/browser/task_manager.cc
parent9a3f0ac2899139ace97e399015259d028b4d5704 (diff)
downloadchromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.zip
chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.gz
chromium_src-176aa48371da91eb98d675d87b4e70c7b26d696f.tar.bz2
Add Terminate() to the Process object, have RenderProcessHost use this to avoid some more Windows specific code.
Move Process and SharedMemory into the base namespace (most changes). Review URL: http://codereview.chromium.org/10895 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@5446 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/task_manager.cc')
-rw-r--r--chrome/browser/task_manager.cc40
1 files changed, 20 insertions, 20 deletions
diff --git a/chrome/browser/task_manager.cc b/chrome/browser/task_manager.cc
index fb55942..b1994da 100644
--- a/chrome/browser/task_manager.cc
+++ b/chrome/browser/task_manager.cc
@@ -96,7 +96,7 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) {
ResourceList* group = group_map_[resource->GetProcess()];
DCHECK(group && !group->empty());
bool first_in_group = ((*group)[0] == resource);
- process_util::ProcessMetrics* process_metrics = NULL;
+ base::ProcessMetrics* process_metrics = NULL;
if (first_in_group) {
MetricsMap::iterator iter = metrics_map_.find(resource->GetProcess());
DCHECK(iter != metrics_map_.end());
@@ -148,7 +148,7 @@ std::wstring TaskManagerTableModel::GetText(int row, int col_id) {
case IDS_TASK_MANAGER_PROCESS_ID_COLUMN:
if (!first_in_group)
return std::wstring();
- return IntToWString(process_util::GetProcId(resource->GetProcess()));
+ return IntToWString(base::GetProcId(resource->GetProcess()));
case kGoatsTeleportedColumn: // Goats Teleported.
goats_teleported_ += rand();
@@ -175,23 +175,23 @@ int TaskManagerTableModel::GetCPUUsage(TaskManager::Resource* resource) {
}
size_t TaskManagerTableModel::GetPrivateMemory(
- process_util::ProcessMetrics* process_metrics) {
+ base::ProcessMetrics* process_metrics) {
return process_metrics->GetPrivateBytes() / 1024;
}
size_t TaskManagerTableModel::GetSharedMemory(
- process_util::ProcessMetrics* process_metrics) {
- process_util::WorkingSetKBytes ws_usage;
+ base::ProcessMetrics* process_metrics) {
+ base::WorkingSetKBytes ws_usage;
process_metrics->GetWorkingSetKBytes(&ws_usage);
return ws_usage.shared;
}
size_t TaskManagerTableModel::GetPhysicalMemory(
- process_util::ProcessMetrics* process_metrics) {
+ base::ProcessMetrics* process_metrics) {
// Memory = working_set.private + working_set.shareable.
// We exclude the shared memory.
size_t total_kbytes = process_metrics->GetWorkingSetSize() / 1024;
- process_util::WorkingSetKBytes ws_usage;
+ base::WorkingSetKBytes ws_usage;
process_metrics->GetWorkingSetKBytes(&ws_usage);
total_kbytes -= ws_usage.shared;
return total_kbytes;
@@ -204,7 +204,7 @@ int TaskManagerTableModel::GetStatsValue(TaskManager::Resource* resource,
const wchar_t* counter = table->GetRowName(col_id);
if (counter != NULL && counter[0] != '\0') {
return table->GetCounterValue(counter,
- process_util::GetProcId(resource->GetProcess()));
+ base::GetProcId(resource->GetProcess()));
} else {
NOTREACHED() << "Invalid column.";
}
@@ -344,8 +344,8 @@ void TaskManagerTableModel::AddResource(TaskManager::Resource* resource) {
new_entry_index = static_cast<int>(iter - resources_.begin());
resources_.insert(++iter, resource);
}
- process_util::ProcessMetrics* pm =
- process_util::ProcessMetrics::CreateProcessMetrics(process);
+ base::ProcessMetrics* pm =
+ base::ProcessMetrics::CreateProcessMetrics(process);
metrics_map_[process] = pm;
// Notify the table that the contents have changed for it to redraw.
@@ -503,8 +503,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) {
GetCPUUsage(resources_[row2]));
case IDS_TASK_MANAGER_PRIVATE_MEM_COLUMN: {
- process_util::ProcessMetrics* pm1;
- process_util::ProcessMetrics* pm2;
+ base::ProcessMetrics* pm1;
+ base::ProcessMetrics* pm2;
if (!GetProcessMetricsForRows(row1, row2, &pm1, &pm2))
return 0;
return ValueCompare<size_t>(GetPrivateMemory(pm1),
@@ -512,8 +512,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) {
}
case IDS_TASK_MANAGER_SHARED_MEM_COLUMN: {
- process_util::ProcessMetrics* pm1;
- process_util::ProcessMetrics* pm2;
+ base::ProcessMetrics* pm1;
+ base::ProcessMetrics* pm2;
if (!GetProcessMetricsForRows(row1, row2, &pm1, &pm2))
return 0;
return ValueCompare<size_t>(GetSharedMemory(pm1),
@@ -521,8 +521,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) {
}
case IDS_TASK_MANAGER_PHYSICAL_MEM_COLUMN: {
- process_util::ProcessMetrics* pm1;
- process_util::ProcessMetrics* pm2;
+ base::ProcessMetrics* pm1;
+ base::ProcessMetrics* pm2;
if (!GetProcessMetricsForRows(row1, row2, &pm1, &pm2))
return 0;
return ValueCompare<size_t>(GetPhysicalMemory(pm1),
@@ -530,8 +530,8 @@ int TaskManagerTableModel::CompareValues(int row1, int row2, int column_id) {
}
case IDS_TASK_MANAGER_PROCESS_ID_COLUMN: {
- int proc1_id = process_util::GetProcId(resources_[row1]->GetProcess());
- int proc2_id = process_util::GetProcId(resources_[row2]->GetProcess());
+ int proc1_id = base::GetProcId(resources_[row1]->GetProcess());
+ int proc2_id = base::GetProcId(resources_[row2]->GetProcess());
return ValueCompare<int>(proc1_id, proc2_id);
}
@@ -632,8 +632,8 @@ void TaskManagerTableModel::OnBytesRead(URLRequestJob* job, int byte_count) {
bool TaskManagerTableModel::GetProcessMetricsForRows(
int row1, int row2,
- process_util::ProcessMetrics** proc_metrics1,
- process_util::ProcessMetrics** proc_metrics2) {
+ base::ProcessMetrics** proc_metrics1,
+ base::ProcessMetrics** proc_metrics2) {
DCHECK(row1 < static_cast<int>(resources_.size()) &&
row2 < static_cast<int>(resources_.size()));