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

Unified Diff: chrome/browser/memory/tab_manager.cc

Issue 2483003004: Make purge-and-suspend-time finch experiment parameter (Closed)
Patch Set: Rebaselined Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/tab_manager.cc
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
index 207ae5d7bfd86e6a6951965eb4f1f980d4014ff3..1c15cafd5cdba51bd200d3abfa37598c089fb1f7 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -731,21 +731,17 @@ TabManager::PurgeAndSuspendState TabManager::GetNextPurgeAndSuspendState(
}
void TabManager::PurgeAndSuspendBackgroundedTabs() {
- const base::CommandLine& command_line =
- *base::CommandLine::ForCurrentProcess();
- if (!command_line.HasSwitch(switches::kPurgeAndSuspendTime))
+ std::string purge_and_suspend_time = variations::GetVariationParamValue(
chrisha 2016/11/23 19:38:09 Maybe do this once in some kind of initialization
tasak 2016/11/24 02:16:20 I see. Done.
+ "PurgeAndSuspend", "purge-and-suspend-time");
+ int time_to_first_suspension_sec = 0;
+ if (purge_and_suspend_time.empty() ||
+ !base::StringToInt(purge_and_suspend_time, &time_to_first_suspension_sec))
return;
- int purge_and_suspend_time = 0;
- if (!base::StringToInt(
- command_line.GetSwitchValueASCII(switches::kPurgeAndSuspendTime),
- &purge_and_suspend_time)) {
- return;
- }
- if (purge_and_suspend_time <= 0)
+ if (time_to_first_suspension_sec <= 0)
return;
base::TimeTicks current_time = NowTicks();
base::TimeDelta time_to_first_suspension =
- base::TimeDelta::FromSeconds(purge_and_suspend_time);
+ base::TimeDelta::FromSeconds(time_to_first_suspension_sec);
auto tab_stats = GetUnsortedTabStats();
for (auto& tab : tab_stats) {
if (!tab.render_process_host->IsProcessBackgrounded())
« no previous file with comments | « no previous file | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698