Chromium Code Reviews| 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()) |