summaryrefslogtreecommitdiffstats
path: root/base/sys_info.cc
diff options
context:
space:
mode:
authorc.shu@samsung.com <c.shu@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-26 16:55:27 +0000
committerc.shu@samsung.com <c.shu@samsung.com@0039d316-1c4b-4281-b951-d872f2087c98>2014-06-26 16:55:27 +0000
commit35b4f0cda0ee3711e330a36bf8a182c05852efa4 (patch)
tree53157d83d6b3d39a6300ceab12b8811bb538ea20 /base/sys_info.cc
parent8851dbe0c2351690da1488c9d58c686044fec9b5 (diff)
downloadchromium_src-35b4f0cda0ee3711e330a36bf8a182c05852efa4.zip
chromium_src-35b4f0cda0ee3711e330a36bf8a182c05852efa4.tar.gz
chromium_src-35b4f0cda0ee3711e330a36bf8a182c05852efa4.tar.bz2
Expose a low-end device mode override flags for non-android OSs as well
BUG=324824 Review URL: https://codereview.chromium.org/258663002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@280024 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/sys_info.cc')
-rw-r--r--base/sys_info.cc36
1 files changed, 36 insertions, 0 deletions
diff --git a/base/sys_info.cc b/base/sys_info.cc
index d43e932..0b3b317 100644
--- a/base/sys_info.cc
+++ b/base/sys_info.cc
@@ -4,10 +4,46 @@
#include "base/sys_info.h"
+#include "base/base_switches.h"
+#include "base/command_line.h"
+#include "base/lazy_instance.h"
+#include "base/strings/string_number_conversions.h"
+#include "base/sys_info_internal.h"
#include "base/time/time.h"
namespace base {
+#if !defined(OS_ANDROID)
+
+static const int kLowMemoryDeviceThresholdMB = 512;
+
+bool DetectLowEndDevice() {
+ CommandLine* command_line = CommandLine::ForCurrentProcess();
+ int int_value = 0;
+ if (command_line->HasSwitch(switches::kLowEndDeviceMode)) {
+ std::string string_value =
+ command_line->GetSwitchValueASCII(switches::kLowEndDeviceMode);
+ StringToInt(string_value, &int_value);
+ }
+ if (int_value == 1)
+ return true;
+ if (int_value != 2)
+ return false;
+
+ int ram_size_mb = SysInfo::AmountOfPhysicalMemoryMB();
+ return (ram_size_mb > 0 && ram_size_mb < kLowMemoryDeviceThresholdMB);
+}
+
+static LazyInstance<
+ internal::LazySysInfoValue<bool, DetectLowEndDevice> >::Leaky
+ g_lazy_low_end_device = LAZY_INSTANCE_INITIALIZER;
+
+// static
+bool SysInfo::IsLowEndDevice() {
+ return g_lazy_low_end_device.Get().value();
+}
+#endif
+
// static
int64 SysInfo::Uptime() {
// This code relies on an implementation detail of TimeTicks::Now() - that