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

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: Fix compile error on ChromeOS. 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 base::chromeos::MemoryPressureMonitor::MemoryPressureThresholds
355 GetMemoryPressureThresholds() { 355 GetMemoryPressureThresholds() {
356 using MemoryPressureMonitor = base::chromeos::MemoryPressureMonitor;
357
356 if (!base::CommandLine::ForCurrentProcess()->HasSwitch( 358 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
357 kMemoryPressureThresholds)) { 359 kMemoryPressureThresholds)) {
358 const std::string group_name = 360 const std::string group_name =
359 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName); 361 base::FieldTrialList::FindFullName(kMemoryPressureExperimentName);
360 if (group_name == kConservativeThreshold) 362 if (group_name == kConservativeThreshold)
361 return base::MemoryPressureMonitorChromeOS::THRESHOLD_CONSERVATIVE; 363 return MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
362 if (group_name == kAggressiveCacheDiscardThreshold) 364 if (group_name == kAggressiveCacheDiscardThreshold)
363 return base::MemoryPressureMonitorChromeOS:: 365 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
364 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
365 if (group_name == kAggressiveTabDiscardThreshold) 366 if (group_name == kAggressiveTabDiscardThreshold)
366 return base::MemoryPressureMonitorChromeOS:: 367 return MemoryPressureMonitor::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 MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
370 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; 370 return 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 MemoryPressureMonitor::THRESHOLD_CONSERVATIVE;
378 if (option == kAggressiveCacheDiscardThreshold) 378 if (option == kAggressiveCacheDiscardThreshold)
379 return base::MemoryPressureMonitorChromeOS:: 379 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
380 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
381 if (option == kAggressiveTabDiscardThreshold) 380 if (option == kAggressiveTabDiscardThreshold)
382 return base::MemoryPressureMonitorChromeOS:: 381 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE_TAB_DISCARD;
383 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
384 if (option == kAggressiveThreshold) 382 if (option == kAggressiveThreshold)
385 return base::MemoryPressureMonitorChromeOS::THRESHOLD_AGGRESSIVE; 383 return MemoryPressureMonitor::THRESHOLD_AGGRESSIVE;
386 384
387 return base::MemoryPressureMonitorChromeOS::THRESHOLD_DEFAULT; 385 return MemoryPressureMonitor::THRESHOLD_DEFAULT;
388 } 386 }
389 387
390 } // namespace switches 388 } // namespace switches
391 } // namespace chromeos 389 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698