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

Unified Diff: chrome/browser/component_updater/component_updater_utils.cc

Issue 271573003: The component update checks should include the amount of installed memory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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: 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,

Powered by Google App Engine
This is Rietveld 408576698