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

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: change Value* AsValue() to scoped_ptr<Value> ToValue() 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..54766876893e6da569aa6eb2fee8c16bf50bfaf6 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", committed_memory_);
+#if defined(OS_LINUX) || defined(OS_ANDROID)
+ res->Set("meminfo", memory_info_.ToValue().release());
darin (slow to review) 2013/09/05 07:32:10 I see. DictionaryValue::Set should probably take s
+ 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