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

Side by Side Diff: chromeos/chromeos_switches.cc

Issue 1124163003: Rename OS-specific MemoryPressureMonitor implementations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address grt@'s comments from patchset 4. Created 5 years, 7 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 unified diff | Download patch
OLDNEW
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
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 using MemoryPressureMonitor = base::chromeos::MemoryPressureMonitor;
grt (UTC plus 2) 2015/05/14 15:40:21 I think it's best to keep aliases like this either
chrisha 2015/05/14 19:53:15 Done.
355 GetMemoryPressureThresholds() { 355
356 MemoryPressureMonitor::MemoryPressureThresholds GetMemoryPressureThresholds() {
356 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 357 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
357 kMemoryPressureThresholds)) { 358 kMemoryPressureThresholds)) {
358 const std::string group_name = 359 const std::string group_name =
359 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName); 360 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName);
360 if (group_name == kConservativeThreshold) 361 if (group_name == kConservativeThreshold)
361 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; 362 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
362 if (group_name == kAggressiveCacheDiscardThreshold) 363 if (group_name == kAggressiveCacheDiscardThreshold)
363 return base::MemoryPressureMonitorChromeOS:: 364 return MemoryPressureMonitor::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 MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
367 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
368 if (group_name == kAggressiveThreshold) 367 if (group_name == kAggressiveThreshold)
369 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; 368 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
370 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; 369 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
371 } 370 }
372 371
373 const std::string option = 372 const std::string option =
374 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 373 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
375 kMemoryPressureThresholds); 374 kMemoryPressureThresholds);
376 if (option == kConservativeThreshold) 375 if (option == kConservativeThreshold)
377 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; 376 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
378 if (option == kAggressiveCacheDiscardThreshold) 377 if (option == kAggressiveCacheDiscardThreshold)
379 return base::MemoryPressureMonitorChromeOS:: 378 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
380 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
381 if (option == kAggressiveTabDiscardThreshold) 379 if (option == kAggressiveTabDiscardThreshold)
382 return base::MemoryPressureMonitorChromeOS:: 380 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
383 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
384 if (option == kAggressiveThreshold) 381 if (option == kAggressiveThreshold)
385 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; 382 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
386 383
387 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; 384 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
388 } 385 }
389 386
390 } // namespace switches 387 } // namespace switches
391 } // namespace chromeos 388 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698