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

Unified Diff: base/process/process_metrics.cc

Issue 23155002: Implement ToValue() for SystemMetrics, SystemMemoryInfoKB, DiskInfo, and SwapInfo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@meminfo
Patch Set: cast size_t to int Created 7 years, 3 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_metrics_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/process_metrics.cc
diff --git a/base/process/process_metrics.cc b/base/process/process_metrics.cc
index e87a2bba737aab71237b6cdce4d42b3c0ecce263..127fb4649f70b04f054db74b9f97b4132173d1fa 100644
--- a/base/process/process_metrics.cc
+++ b/base/process/process_metrics.cc
@@ -27,4 +27,19 @@ SystemMetrics SystemMetrics::Sample() {
return system_metrics;
}
+scoped_ptr<Value> SystemMetrics::ToValue() const {
+ scoped_ptr<DictionaryValue> res(new DictionaryValue());
+
+ res->SetInteger("committed_memory", static_cast<int>(committed_memory_));
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ res->Set("meminfo", memory_info_.ToValue().release());
+ res->Set("diskinfo", disk_info_.ToValue().release());
+#endif
+#if defined(OS_CHROMEOS)
+ res->Set("swapinfo", swap_info_.ToValue().release());
+#endif
+
+ return res.PassAs<Value>();
+}
+
} // namespace base
« no previous file with comments | « base/process/process_metrics.h ('k') | base/process/process_metrics_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698