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

Side by Side Diff: chromeos/chromeos_switches.cc

Issue 897413002: Add a finch experiment for different memory pressure management strategies in ChromeOS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address code reivew's comments. Created 5 years, 10 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
« no previous file with comments | « chromeos/chromeos_switches.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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 199 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 when a
225 // memory pressure event needs to get fired. 226 // memory pressure event needs to get fired.
226 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds"; 227 const char kMemoryPressureThresholds[] = "memory-pressure-thresholds";
228 const char kConservativeThreshold[] = "conservative";
229 const char kAggressiveCacheDiscardThreshold[] = "aggressive-cache-discard";
230 const char kAggressiveTabDiscardThreshold[] = "aggressive-tab-discard";
231 const char kAggressiveThreshold[] = "aggressive";
227 232
228 // Enables natural scroll by default. 233 // Enables natural scroll by default.
229 const char kNaturalScrollDefault[] = "enable-natural-scroll-default"; 234 const char kNaturalScrollDefault[] = "enable-natural-scroll-default";
230 235
231 // Skips all other OOBE pages after user login. 236 // Skips all other OOBE pages after user login.
232 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin"; 237 const char kOobeSkipPostLogin[] = "oobe-skip-postlogin";
233 238
234 // Disable GAIA services such as enrollment and OAuth session restore. Used by 239 // Disable GAIA services such as enrollment and OAuth session restore. Used by
235 // 'fake' telemetry login. 240 // 'fake' telemetry login.
236 const char kDisableGaiaServices[] = "disable-gaia-services"; 241 const char kDisableGaiaServices[] = "disable-gaia-services";
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 311
307 // Enable automatic timezone update. 312 // Enable automatic timezone update.
308 const char kEnableTimeZoneTrackingOption[] = "enable-timezone-tracking-option"; 313 const char kEnableTimeZoneTrackingOption[] = "enable-timezone-tracking-option";
309 314
310 bool WakeOnWifiEnabled() { 315 bool WakeOnWifiEnabled() {
311 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi); 316 return !base::CommandLine::ForCurrentProcess()->HasSwitch(kDisableWakeOnWifi);
312 } 317 }
313 318
314 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds 319 base::MemoryPressureObserverChromeOS::MemoryPressureThresholds
315 GetMemoryPressureThresholds() { 320 GetMemoryPressureThresholds() {
316 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
317 kMemoryPressureThresholds)) {
Mr4D (OOO till 08-26) 2015/02/09 00:54:54 The field trial code should go into the case that
318 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT;
319 }
320 const std::string option = 321 const std::string option =
321 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII( 322 base::CommandLine::ForCurrentProcess()->GetSwitchValueASCII(
322 kMemoryPressureThresholds); 323 kMemoryPressureThresholds);
323 if (option == "1") { 324 if (option == kConservativeThreshold)
324 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE; 325 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE;
325 } 326 if (option == kAggressiveCacheDiscardThreshold)
326 if (option == "2") {
327 return base::MemoryPressureObserverChromeOS:: 327 return base::MemoryPressureObserverChromeOS::
328 THRESHOLD_AGGRESSIVE_CACHE_DISCARD; 328 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
329 } 329 if (option == kAggressiveTabDiscardThreshold)
330 if (option == "3") {
331 return base::MemoryPressureObserverChromeOS:: 330 return base::MemoryPressureObserverChromeOS::
332 THRESHOLD_AGGRESSIVE_TAB_DISCARD; 331 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
333 } 332 if (option == kAggressiveThreshold)
334 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE; 333 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE;
334
335 const std::string group_name =
336 base::FieldTrialList::FindFullName(kMemoryPressureThresholds);
337 if (group_name == kConservativeThreshold)
338 return base::MemoryPressureObserverChromeOS::THRESHOLD_CONSERVATIVE;
339 if (group_name == kAggressiveCacheDiscardThreshold)
340 return base::MemoryPressureObserverChromeOS::
341 THRESHOLD_AGGRESSIVE_CACHE_DISCARD;
342 if (group_name == kAggressiveTabDiscardThreshold)
343 return base::MemoryPressureObserverChromeOS::
344 THRESHOLD_AGGRESSIVE_TAB_DISCARD;
345 if (group_name == kAggressiveThreshold)
346 return base::MemoryPressureObserverChromeOS::THRESHOLD_AGGRESSIVE;
347
348 return base::MemoryPressureObserverChromeOS::THRESHOLD_DEFAULT;
335 } 349 }
336 350
337 } // namespace switches 351 } // namespace switches
338 } // namespace chromeos 352 } // namespace chromeos
OLDNEW
« no previous file with comments | « chromeos/chromeos_switches.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698