Chromium Code Reviews| Index: chromeos/chromeos_switches.cc |
| diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc |
| index 43042cf68c90ab519493bd5e4114f5bb97fad211..34a27dbd5cae00a4c93baa7e5208831be3194a52 100644 |
| --- a/chromeos/chromeos_switches.cc |
| +++ b/chromeos/chromeos_switches.cc |
| @@ -213,6 +213,10 @@ const char kLoginProfile[] = "login-profile"; |
| // Specifies the user which is already logged in. |
| const char kLoginUser[] = "login-user"; |
| +// The memory pressure thresholds selection which is used to decide when a |
| +// memory pressure event needs to get fired. |
| +const char kMemoryPressureThresholds[] = "memory-pressure-thresholds"; |
| + |
| // Enables natural scroll by default. |
| const char kNaturalScrollDefault[] = "enable-natural-scroll-default"; |
| @@ -292,5 +296,28 @@ bool WakeOnWifiEnabled() { |
| return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); |
| } |
| +base::MemoryPressureObserverChromeOS::MemoryPressureThresholds |
| +GetMemoryPressureThresholds() { |
| + if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| + kMemoryPressureThresholds)) { |
| + return base::MemoryPressureObserverChromeOS:: |
| + MEMORY_PRESSURE_THRESHOLD_DEFAULT; |
| + } |
| + const std::string option = |
| + base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| + kMemoryPressureThresholds); |
| + if (option == "1") |
|
Charlie Reis
2015/01/21 19:37:55
nit: These all need braces because the body doesn'
Mr4D (OOO till 08-26)
2015/01/21 21:01:35
Done.
|
| + return base::MemoryPressureObserverChromeOS:: |
| + MEMORY_PRESSURE_THRESHOLD_CONSERVATIVE; |
| + if (option == "2") |
| + return base::MemoryPressureObserverChromeOS:: |
| + MEMORY_PRESSURE_THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |
| + if (option == "3") |
| + return base::MemoryPressureObserverChromeOS:: |
| + MEMORY_PRESSURE_THRESHOLD_AGGRESSIVE_TAB_DISCARD; |
| + return base::MemoryPressureObserverChromeOS:: |
| + MEMORY_PRESSURE_THRESHOLD_AGGRESSIVE; |
| +} |
| + |
| } // namespace switches |
| } // namespace chromeos |