Index: chrome/browser/component_updater/component_updater_utils.cc |
diff --git a/chrome/browser/component_updater/component_updater_utils.cc b/chrome/browser/component_updater/component_updater_utils.cc |
index d6cb1e0ee220d1d83f1babc51870441a63ef340e..ec6d497ac329fb6931331ece0c8b9d7bd091207c 100644 |
--- a/chrome/browser/component_updater/component_updater_utils.cc |
+++ b/chrome/browser/component_updater/component_updater_utils.cc |
@@ -4,6 +4,8 @@ |
#include "chrome/browser/component_updater/component_updater_utils.h" |
+#include <cmath> |
+ |
#include "base/file_util.h" |
#include "base/files/file_path.h" |
#include "base/guid.h" |
@@ -25,6 +27,17 @@ |
namespace component_updater { |
+namespace { |
+ |
+// Returns the amount of physical memory in GB, rounded to the nearest GB. |
+int GetPhysicalMemoryGB() { |
+ const double kOneGB = 1024 * 1024 * 1024; |
+ const int64 phys_mem = base::SysInfo::AmountOfPhysicalMemory(); |
+ return static_cast<int>(std::floor(0.5 + phys_mem / kOneGB)); |
+} |
+ |
+} // namespace |
+ |
std::string BuildProtocolRequest(const std::string& request_body, |
const std::string& additional_attributes) { |
const std::string prod_id(chrome::OmahaQueryParams::GetProdIdString( |
@@ -63,6 +76,11 @@ std::string BuildProtocolRequest(const std::string& request_body, |
#endif |
base::StringAppendF(&request, ">"); |
+ // HW platform information. |
+ base::StringAppendF(&request, |
+ "<hw physmemory=\"%d\"/>", |
+ GetPhysicalMemoryGB()); // "physmem" in GB. |
+ |
// OS version and platform information. |
base::StringAppendF( |
&request, |