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

Unified Diff: chromeos/chromeos_switches.cc

Issue 803443006: Adding flag to specify the used memory pressure strategy (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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: chromeos/chromeos_switches.cc
diff --git a/chromeos/chromeos_switches.cc b/chromeos/chromeos_switches.cc
index 43042cf68c90ab519493bd5e4114f5bb97fad211..cd0ca1042869b57fbce204bda6490e98de8077e8 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,23 @@ bool WakeOnWifiEnabled() {
return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi);
}
+base::MemoryPressureObserverChromeOS::MemoryPressureThresholds
+GetMemoryPressureThresholds() {
+ if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
+ kMemoryPressureThresholds)) {
+ return base::MemoryPressureObserverChromeOS::DEFAULT_THRESHOLDS;
+ }
+ const std::string option =
+ base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
+ kMemoryPressureThresholds);
+ if (option == "1")
+ return base::MemoryPressureObserverChromeOS::NORMAL_THRESHOLDS;
+ if (option == "2")
+ return base::MemoryPressureObserverChromeOS::AGGRESSIVE_MODERATE_THRESHOLD;
+ if (option == "3")
+ return base::MemoryPressureObserverChromeOS::AGGRESSIVE_CRITICAL_THRESHOLD;
+ return base::MemoryPressureObserverChromeOS::AGGRESSIVE_THRESHOLDS;
+}
+
} // namespace switches
} // namespace chromeos

Powered by Google App Engine
This is Rietveld 408576698