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 #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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 344 | 344 |
| 345 bool MemoryPressureHandlingEnabled() { | 345 bool MemoryPressureHandlingEnabled() { |
| 346 if ((base::CommandLine::ForCurrentProcess()->HasSwitch( | 346 if ((base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 347 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) || | 347 chromeos::switches::kDisableMemoryPressureSystemChromeOS)) || |
| 348 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) == | 348 (base::FieldTrialList::FindFullName(kMemoryPressureExperimentName) == |
| 349 kMemoryPressureHandlingOff)) | 349 kMemoryPressureHandlingOff)) |
| 350 return false; | 350 return false; |
| 351 return true; | 351 return true; |
| 352 } | 352 } |
| 353 | 353 |
| 354 base::MemoryPressureMonitorChromeOS::MemoryPressureThresholds | 354 base::chromeos::MemoryPressureMonitor::MemoryPressureThresholds |
| 355 GetMemoryPressureThresholds() { | 355 GetMemoryPressureThresholds() { |
| 356 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( | 356 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( |
|
grt (UTC plus 2)
2015/05/14 14:07:40
nit: consider adding
using MemoryPressureMonitor
chrisha
2015/05/14 15:27:17
Done.
| |
| 357 kMemoryPressureThresholds)) { | 357 kMemoryPressureThresholds)) { |
| 358 const std::string group_name = | 358 const std::string group_name = |
| 359 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName); | 359 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName); |
| 360 if (group_name == kConservativeThreshold) | 360 if (group_name == kConservativeThreshold) |
| 361 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; | 361 return base::chromeos::MemoryPressureMonitor::THRESHOLD_CONSERVATIVE; |
| 362 if (group_name == kAggressiveCacheDiscardThreshold) | 362 if (group_name == kAggressiveCacheDiscardThreshold) |
| 363 return base::MemoryPressureMonitorChromeOS:: | 363 return base::chromeos::MemoryPressureMonitor:: |
| 364 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 364 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |
| 365 if (group_name == kAggressiveTabDiscardThreshold) | 365 if (group_name == kAggressiveTabDiscardThreshold) |
| 366 return base::MemoryPressureMonitorChromeOS:: | 366 return base::chromeos::MemoryPressureMonitor:: |
| 367 THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 367 THRESHOLD_AGGRESSIVE_TAB_DISCARD; |
| 368 if (group_name == kAggressiveThreshold) | 368 if (group_name == kAggressiveThreshold) |
| 369 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; | 369 return base::chromeos::MemoryPressureMonitor::THRESHOLD_AGGRESSIVE; |
| 370 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; | 370 return base::chromeos::MemoryPressureMonitor::THRESHOLD_DEFAULT; |
| 371 } | 371 } |
| 372 | 372 |
| 373 const std::string option = | 373 const std::string option = |
| 374 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 374 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
| 375 kMemoryPressureThresholds); | 375 kMemoryPressureThresholds); |
| 376 if (option == kConservativeThreshold) | 376 if (option == kConservativeThreshold) |
| 377 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; | 377 return base::chromeos::MemoryPressureMonitor::THRESHOLD_CONSERVATIVE; |
| 378 if (option == kAggressiveCacheDiscardThreshold) | 378 if (option == kAggressiveCacheDiscardThreshold) |
| 379 return base::MemoryPressureMonitorChromeOS:: | 379 return base::chromeos::MemoryPressureMonitor:: |
| 380 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; | 380 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; |
| 381 if (option == kAggressiveTabDiscardThreshold) | 381 if (option == kAggressiveTabDiscardThreshold) |
| 382 return base::MemoryPressureMonitorChromeOS:: | 382 return base::chromeos::MemoryPressureMonitor:: |
| 383 THRESHOLD_AGGRESSIVE_TAB_DISCARD; | 383 THRESHOLD_AGGRESSIVE_TAB_DISCARD; |
| 384 if (option == kAggressiveThreshold) | 384 if (option == kAggressiveThreshold) |
| 385 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; | 385 return base::chromeos::MemoryPressureMonitor::THRESHOLD_AGGRESSIVE; |
| 386 | 386 |
| 387 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; | 387 return base::chromeos::MemoryPressureMonitor::THRESHOLD_DEFAULT; |
| 388 } | 388 } |
| 389 | 389 |
| 390 } // namespace switches | 390 } // namespace switches |
| 391 } // namespace chromeos | 391 } // namespace chromeos |
| OLD | NEW |