Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chromeos/chromeos_switches.h" | 5 #include "chromeos/chromeos_switches.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/metrics/field_trial.h" | |
| 8 | 9 |
| 9 // TODO(rsorokin): alphabetize all of these switches so they | 10 // TODO(rsorokin): alphabetize all of these switches so they |
| 10 // match the order from the .h file | 11 // match the order from the .h file |
| 11 | 12 |
| 12 namespace chromeos { | 13 namespace chromeos { |
| 13 namespace switches { | 14 namespace switches { |
| 14 | 15 |
| 15 // Path for app's OEM manifest file. | 16 // Path for app's OEM manifest file. |
| 16 const char kAppOemManifestFile[] = "app-mode-oem-manifest"; | 17 const char kAppOemManifestFile[] = "app-mode-oem-manifest"; |
| 17 | 18 |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 214 // Specifies the profile to use once a chromeos user is logged in. | 215 // Specifies the profile to use once a chromeos user is logged in. |
| 215 // This parameter is ignored if user goes through login screen since user_id | 216 // This parameter is ignored if user goes through login screen since user_id |
| 216 // hash defines which profile directory to use. | 217 // hash defines which profile directory to use. |
| 217 // In case of browser restart within active session this parameter is used | 218 // In case of browser restart within active session this parameter is used |
| 218 // to pass user_id hash for primary user. | 219 // to pass user_id hash for primary user. |
| 219 const char kLoginProfile[] = "login-profile"; | 220 const char kLoginProfile[] = "login-profile"; |
| 220 | 221 |
| 221 // Specifies the user which is already logged in. | 222 // Specifies the user which is already logged in. |
| 222 const char kLoginUser[] = "login-user"; | 223 const char kLoginUser[] = "login-user"; |
| 223 | 224 |
| 224 // The memory pressure thresholds selection which is used to decide when a | 225 // The memory pressure thresholds selection which is used to decide whether and |
| 225 // memory pressure event needs to get fired. | 226 // when a memory pressure event needs to get fired. |
| 227 const char kMemoryPressureHandlingOff[] = "memory-pressure-off"; | |
| 226 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds"; | 228 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds"; |
| 229 const char kConservativeThreshold[] = "conservative"; | |
| 230 const char kAggressiveCacheDiscardThreshold[] = "aggressive-cache-discard"; | |
| 231 const char kAggressiveTabDiscardThreshold[] = "aggressive-tab-discard"; | |
| 232 const char kAggressiveThreshold[] = "aggressive"; | |
| 227 | 233 |
| 228 // Enables natural scroll by default. | 234 // Enables natural scroll by default. |
| 229 const char kNaturalScrollDefault[] = "enable-natural-scroll-default"; | 235 const char kNaturalScrollDefault[] = "enable-natural-scroll-default"; |
| 230 | 236 |
| 231 // Skips all other OOBE pages after user login. | 237 // Skips all other OOBE pages after user login. |
| 232 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin"; | 238 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin"; |
| 233 | 239 |
| 234 // Disable GAIA services such as enrollment and OAuth session restore. Used by | 240 // Disable GAIA services such as enrollment and OAuth session restore. Used by |
| 235 // 'fake' telemetry login. | 241 // 'fake' telemetry login. |
| 236 const char kDisableGaiaServices[] = "disable-gaia-services"; | 242 const char kDisableGaiaServices[] = "disable-gaia-services"; |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 305 "enable-captive-portal-bypass-proxy"; | 311 "enable-captive-portal-bypass-proxy"; |
| 306 | 312 |
| 307 // Disable automatic timezone update. | 313 // Disable automatic timezone update. |
| 308 const char kDisableTimeZoneTrackingOption[] = | 314 const char kDisableTimeZoneTrackingOption[] = |
| 309 "disable-timezone-tracking-option"; | 315 "disable-timezone-tracking-option"; |
| 310 | 316 |
| 311 bool WakeOnWifiEnabled() { | 317 bool WakeOnWifiEnabled() { |
| 312 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); | 318 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); |
| 313 } | 319 } |
| 314 | 320 |
| 321 bool MemoryPressureHandlingEnabled() { | |
| 322 if ((base::CommandLine::ForCurrentProcess()->HasSwitch( | |
| 323 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) || | |
| 324 (base::FieldTrialList::FindFullName(kMemoryPressureThresholds) == | |
| 325 kMemoryPressureHandlingOff)) | |
| 326 return false; | |
| 327 return true; | |
| 328 } | |
| 329 | |
| 315 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds | 330 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds |
| 316 GetMemoryPressureThresholds() { | 331 GetMemoryPressureThresholds() { |
| 317 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | |
|
Mr4D (OOO till 08-26)
2015/02/09 22:16:22
As stated earlier - this code should remain and yo
| |
| 318 kMemoryPressureThresholds)) { | |
| 319 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; | |
| 320 } | |
| 321 const std::string option = | 332 const std::string option = |
| 322 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 333 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 323 kMemoryPressureThresholds); | 334 kMemoryPressureThresholds); |
| 324 if (option == "1") { | 335 if (option == kConservativeThreshold) |
| 325 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; | 336 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; |
| 326 } | 337 if (option == kAggressiveCacheDiscardThreshold) |
| 327 if (option == "2") { | |
| 328 return base::MemoryPressureObserverChromeOS:: | 338 return base::MemoryPressureObserverChromeOS:: |
| 329 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 339 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |
| 330 } | 340 if (option == kAggressiveTabDiscardThreshold) |
| 331 if (option == "3") { | |
| 332 return base::MemoryPressureObserverChromeOS:: | 341 return base::MemoryPressureObserverChromeOS:: |
| 333 THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 342 THRESHOLD_AGGRESSIVE_TAB_DISCARD; |
| 334 } | 343 if (option == kAggressiveThreshold) |
| 335 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; | 344 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; |
| 345 | |
| 346 const std::string group_name = | |
| 347 base::FieldTrialList::FindFullName(kMemoryPressureThresholds); | |
| 348 if (group_name == kConservativeThreshold) | |
| 349 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; | |
| 350 if (group_name == kAggressiveCacheDiscardThreshold) | |
| 351 return base::MemoryPressureObserverChromeOS:: | |
| 352 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | |
| 353 if (group_name == kAggressiveTabDiscardThreshold) | |
| 354 return base::MemoryPressureObserverChromeOS:: | |
| 355 THRESHOLD_AGGRESSIVE_TAB_DISCARD; | |
| 356 if (group_name == kAggressiveThreshold) | |
| 357 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; | |
| 358 | |
| 359 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; | |
| 336 } | 360 } |
| 337 | 361 |
| 338 } // namespace switches | 362 } // namespace switches |
| 339 } // namespace chromeos | 363 } // namespace chromeos |
| OLD | NEW |