| 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 #include "base/metrics/field_trial.h" |
| 9 | 9 |
| 10 // TODO(rsorokin): alphabetize all of these switches so they | 10 // TODO(rsorokin): alphabetize all of these switches so they |
| (...skipping 342 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 353 | 353 |
| 354 bool MemoryPressureHandlingEnabled() { | 354 bool MemoryPressureHandlingEnabled() { |
| 355 if ((base::CommandLine::ForCurrentProcess()->HasSwitch( | 355 if ((base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 356 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) || | 356 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) || |
| 357 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) == | 357 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) == |
| 358 kMemoryPressureHandlingOff)) | 358 kMemoryPressureHandlingOff)) |
| 359 return false; | 359 return false; |
| 360 return true; | 360 return true; |
| 361 } | 361 } |
| 362 | 362 |
| 363 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds | 363 base::MemoryPressureMonitorChromeOS::MemoryPressureThresholds |
| 364 GetMemoryPressureThresholds() { | 364 GetMemoryPressureThresholds() { |
| 365 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 365 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 366 kMemoryPressureThresholds)) { | 366 kMemoryPressureThresholds)) { |
| 367 const std::string group_name = | 367 const std::string group_name = |
| 368 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName); | 368 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName); |
| 369 if (group_name == kConservativeThreshold) | 369 if (group_name == kConservativeThreshold) |
| 370 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; | 370 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; |
| 371 if (group_name == kAggressiveCacheDiscardThreshold) | 371 if (group_name == kAggressiveCacheDiscardThreshold) |
| 372 return base::MemoryPressureObserverChromeOS:: | 372 return base::MemoryPressureMonitorChromeOS:: |
| 373 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 373 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |
| 374 if (group_name == kAggressiveTabDiscardThreshold) | 374 if (group_name == kAggressiveTabDiscardThreshold) |
| 375 return base::MemoryPressureObserverChromeOS:: | 375 return base::MemoryPressureMonitorChromeOS:: |
| 376 THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 376 THRESHOLD_AGGRESSIVE_TAB_DISCARD; |
| 377 if (group_name == kAggressiveThreshold) | 377 if (group_name == kAggressiveThreshold) |
| 378 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; | 378 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; |
| 379 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; | 379 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; |
| 380 } | 380 } |
| 381 | 381 |
| 382 const std::string option = | 382 const std::string option = |
| 383 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 383 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 384 kMemoryPressureThresholds); | 384 kMemoryPressureThresholds); |
| 385 if (option == kConservativeThreshold) | 385 if (option == kConservativeThreshold) |
| 386 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; | 386 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; |
| 387 if (option == kAggressiveCacheDiscardThreshold) | 387 if (option == kAggressiveCacheDiscardThreshold) |
| 388 return base::MemoryPressureObserverChromeOS:: | 388 return base::MemoryPressureMonitorChromeOS:: |
| 389 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 389 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |
| 390 if (option == kAggressiveTabDiscardThreshold) | 390 if (option == kAggressiveTabDiscardThreshold) |
| 391 return base::MemoryPressureObserverChromeOS:: | 391 return base::MemoryPressureMonitorChromeOS:: |
| 392 THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 392 THRESHOLD_AGGRESSIVE_TAB_DISCARD; |
| 393 if (option == kAggressiveThreshold) | 393 if (option == kAggressiveThreshold) |
| 394 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; | 394 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; |
| 395 | 395 |
| 396 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT; | 396 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; |
| 397 } | 397 } |
| 398 | 398 |
| 399 } // namespace switches | 399 } // namespace switches |
| 400 } // namespace chromeos | 400 } // namespace chromeos |
| OLD | NEW |