summaryrefslogtreecommitdiffstats
path: root/base
diff options
context:
space:
mode:
authorssid <ssid@chromium.org>2014-12-16 08:04:02 -0800
committerCommit bot <commit-bot@chromium.org>2014-12-16 16:04:34 +0000
commitfeb3f47d155857c7b59d101b3d5e933245bac836 (patch)
treeea336bdc7ad700c8776d5b1feade83c08e6c48df /base
parentfddf2473ddeedafe13558f247fa57e04c782545c (diff)
downloadchromium_src-feb3f47d155857c7b59d101b3d5e933245bac836.zip
chromium_src-feb3f47d155857c7b59d101b3d5e933245bac836.tar.gz
chromium_src-feb3f47d155857c7b59d101b3d5e933245bac836.tar.bz2
Removed discrepancy in low-end-device-mode flag
Removed the flag low-end-device-mode and added two flags enable-low-end-device-mode and disable-low-end-device-mode. This removes discrepancies between the flag values (integers) when used in different platforms and makes it simple to use with the just the flags and no values passed. BUG=437778 Review URL: https://codereview.chromium.org/761783004 Cr-Commit-Position: refs/heads/master@{#308593}
Diffstat (limited to 'base')
-rw-r--r--base/android/java/src/org/chromium/base/BaseSwitches.java9
-rw-r--r--base/android/java/src/org/chromium/base/SysUtils.java11
-rw-r--r--base/base_switches.cc9
-rw-r--r--base/base_switches.h3
-rw-r--r--base/sys_info.cc10
5 files changed, 19 insertions, 23 deletions
diff --git a/base/android/java/src/org/chromium/base/BaseSwitches.java b/base/android/java/src/org/chromium/base/BaseSwitches.java
index 11e10f5..ad73e15 100644
--- a/base/android/java/src/org/chromium/base/BaseSwitches.java
+++ b/base/android/java/src/org/chromium/base/BaseSwitches.java
@@ -15,10 +15,11 @@ public abstract class BaseSwitches {
// Block ChildProcessMain thread of render process service until a Java debugger is attached.
public static final String RENDERER_WAIT_FOR_JAVA_DEBUGGER = "renderer-wait-for-java-debugger";
- // Force low-end device when set to 1;
- // Force non-low-end device when set to 0;
- // Auto-detect low-end device when set to other values or empty;
- public static final String LOW_END_DEVICE_MODE = "low-end-device-mode";
+ // Force low-end device mode when set.
+ public static final String ENABLE_LOW_END_DEVICE_MODE = "enable-low-end-device-mode";
+
+ // Force disabling of low-end device mode when set.
+ public static final String DISABLE_LOW_END_DEVICE_MODE = "disable-low-end-device-mode";
// Adds additional thread idle time information into the trace event output.
public static final String ENABLE_IDLE_TRACING = "enable-idle-tracing";
diff --git a/base/android/java/src/org/chromium/base/SysUtils.java b/base/android/java/src/org/chromium/base/SysUtils.java
index 0d04204..1455a61 100644
--- a/base/android/java/src/org/chromium/base/SysUtils.java
+++ b/base/android/java/src/org/chromium/base/SysUtils.java
@@ -109,13 +109,12 @@ public class SysUtils {
private static boolean detectLowEndDevice() {
assert CommandLine.isInitialized();
- if (CommandLine.getInstance().hasSwitch(BaseSwitches.LOW_END_DEVICE_MODE)) {
- int mode = Integer.parseInt(CommandLine.getInstance().getSwitchValue(
- BaseSwitches.LOW_END_DEVICE_MODE));
- if (mode == 1) return true;
- if (mode == 0) return false;
+ if (CommandLine.getInstance().hasSwitch(BaseSwitches.ENABLE_LOW_END_DEVICE_MODE)) {
+ return true;
+ }
+ if (CommandLine.getInstance().hasSwitch(BaseSwitches.DISABLE_LOW_END_DEVICE_MODE)) {
+ return false;
}
-
if (Build.VERSION.SDK_INT <= ANDROID_LOW_MEMORY_ANDROID_SDK_THRESHOLD) {
return false;
}
diff --git a/base/base_switches.cc b/base/base_switches.cc
index 27f52cd..3076540 100644
--- a/base/base_switches.cc
+++ b/base/base_switches.cc
@@ -17,10 +17,11 @@ const char kEnableCrashReporter[] = "enable-crash-reporter";
// Generates full memory crash dump.
const char kFullMemoryCrashReport[] = "full-memory-crash-report";
-// Force low-end device when set to 1;
-// Auto-detect low-end device when set to 2;
-// Force non-low-end device when set to other values or empty;
-const char kLowEndDeviceMode[] = "low-end-device-mode";
+// Force low-end device mode when set.
+const char kEnableLowEndDeviceMode[] = "enable-low-end-device-mode";
+
+// Force disabling of low-end device mode when set.
+const char kDisableLowEndDeviceMode[] = "disable-low-end-device-mode";
// Suppresses all error dialogs when present.
const char kNoErrorDialogs[] = "noerrdialogs";
diff --git a/base/base_switches.h b/base/base_switches.h
index 96cbd5b..c579f6a 100644
--- a/base/base_switches.h
+++ b/base/base_switches.h
@@ -14,7 +14,8 @@ namespace switches {
extern const char kDisableBreakpad[];
extern const char kEnableCrashReporter[];
extern const char kFullMemoryCrashReport[];
-extern const char kLowEndDeviceMode[];
+extern const char kEnableLowEndDeviceMode[];
+extern const char kDisableLowEndDeviceMode[];
extern const char kNoErrorDialogs[];
extern const char kProfilerTiming[];
extern const char kProfilerTimingDisabledValue[];
diff --git a/base/sys_info.cc b/base/sys_info.cc
index cb93480..72a9944 100644
--- a/base/sys_info.cc
+++ b/base/sys_info.cc
@@ -19,15 +19,9 @@ 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)
+ if (command_line->HasSwitch(switches::kEnableLowEndDeviceMode))
return true;
- if (int_value != 2)
+ if (command_line->HasSwitch(switches::kDisableLowEndDeviceMode))
return false;
int ram_size_mb = SysInfo::AmountOfPhysicalMemoryMB();