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

Unified Diff: extensions/browser/api/system_cpu/cpu_info_provider.cc

Issue 2802593005: extensions: Add CPU temperatures field to system.cpu.getInfo() function (Closed)
Patch Set: Remove changes to base::SysInfo Created 3 years, 8 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
Index: extensions/browser/api/system_cpu/cpu_info_provider.cc
diff --git a/extensions/browser/api/system_cpu/cpu_info_provider.cc b/extensions/browser/api/system_cpu/cpu_info_provider.cc
index e926aaac66be2398f62a9c15ada10caaa43b5c88..f9b3c08b429d1d97d315f032bb0d61eae4e54e6b 100644
--- a/extensions/browser/api/system_cpu/cpu_info_provider.cc
+++ b/extensions/browser/api/system_cpu/cpu_info_provider.cc
@@ -6,6 +6,10 @@
#include "base/sys_info.h"
+#if defined(OS_CHROMEOS)
+#include "chromeos/system/cpu_temperature_reader.h"
+#endif // defined(OS_CHROMEOS)
+
namespace extensions {
using api::system_cpu::CpuInfo;
@@ -39,6 +43,16 @@ bool CpuInfoProvider::QueryInfo() {
// Initialize the ProcessorInfos, or return an empty array if that fails.
if (!QueryCpuTimePerProcessor(&info_.processors))
info_.processors.clear();
+
+#if defined(OS_CHROMEOS)
+ info_.temperatures.clear();
Devlin 2017/04/26 02:04:59 what is this clear()ing?
Simon Que 2017/04/26 02:27:21 CpuInfoProvider is a singleton class. |info_| reta
+ auto cpu_temp_info =
+ chromeos::system::CPUTemperatureReader().GetCPUTemperatures();
Devlin 2017/04/26 02:04:58 GetCPUTemperatures() doesn't make it clear what th
Simon Que 2017/04/26 02:27:21 Done.
+ for (const auto& info : cpu_temp_info) {
Devlin 2017/04/26 02:04:59 info_.temperatures.reserve(cpu_temp_info.size())
Simon Que 2017/04/26 02:27:21 Done.
+ info_.temperatures.push_back(info.temp_celsius);
+ }
+#endif // defined(OS_CHROMEOS)
+
return true;
}
« no previous file with comments | « no previous file | extensions/browser/api/system_cpu/system_cpu_apitest.cc » ('j') | extensions/common/api/system_cpu.idl » ('J')

Powered by Google App Engine
This is Rietveld 408576698