Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2606)

Unified Diff: base/process/process_metrics_mac.cc

Issue 885443002: Roll Chrome into Mojo. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Rebase to ToT mojo Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics_mac.cc
diff --git a/base/process/process_metrics_mac.cc b/base/process/process_metrics_mac.cc
index a07d3cd1049274e00046071efb593dc744bd82e8..f84b435a109fee2d0c598050e166fea65d459870 100644
--- a/base/process/process_metrics_mac.cc
+++ b/base/process/process_metrics_mac.cc
@@ -209,15 +209,32 @@ bool ProcessMetrics::GetMemoryBytes(size_t* private_bytes,
}
void ProcessMetrics::GetCommittedKBytes(CommittedKBytes* usage) const {
+ WorkingSetKBytes unused;
+ if (!GetCommittedAndWorkingSetKBytes(usage, &unused)) {
+ *usage = CommittedKBytes();
+ }
}
bool ProcessMetrics::GetWorkingSetKBytes(WorkingSetKBytes* ws_usage) const {
- size_t priv = GetWorkingSetSize();
- if (!priv)
+ CommittedKBytes unused;
+ return GetCommittedAndWorkingSetKBytes(&unused, ws_usage);
+}
+
+bool ProcessMetrics::GetCommittedAndWorkingSetKBytes(
+ CommittedKBytes* usage,
+ WorkingSetKBytes* ws_usage) const {
+ task_basic_info_64 task_info_data;
+ if (!GetTaskInfo(TaskForPid(process_), &task_info_data))
return false;
- ws_usage->priv = priv / 1024;
+
+ usage->priv = task_info_data.virtual_size / 1024;
+ usage->mapped = 0;
+ usage->image = 0;
+
+ ws_usage->priv = task_info_data.resident_size / 1024;
ws_usage->shareable = 0;
ws_usage->shared = 0;
+
return true;
}
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698