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..b6062ab348a7fc4de577743cd6eddddf47e7aff5 100644 |
| --- a/chrome/browser/memory/tab_manager.cc |
| +++ b/chrome/browser/memory/tab_manager.cc |
| @@ -221,6 +221,18 @@ void TabManager::Start() { |
| } |
| } |
| #endif |
| + // purge-and-suspend param is used for Purge+Suspend finch experiment |
| + // in the following way: |
| + // https://docs.google.com/document/d/1hPHkKtXXBTlsZx9s-9U17XC-ofEIzPo9FYbBEc7PPbk/edit?usp=sharing |
| + std::string purge_and_suspend_time = variations::GetVariationParamValue( |
| + "PurgeAndSuspend", "purge-and-suspend-time"); |
| + unsigned time_to_first_suspension_sec; |
| + if (purge_and_suspend_time.empty() || |
| + !base::StringToUint(purge_and_suspend_time, |
| + &time_to_first_suspension_sec)) |
| + time_to_first_suspension_sec = 108000; |
|
Wez
2017/02/15 22:22:52
There doesn't seem to be any explanation here, or
|
| + time_to_first_suspension_ = |
| + base::TimeDelta::FromSeconds(time_to_first_suspension_sec); |
| } |
| void TabManager::Stop() { |
| @@ -731,21 +743,7 @@ TabManager::PurgeAndSuspendState TabManager::GetNextPurgeAndSuspendState( |
| } |
| void TabManager::PurgeAndSuspendBackgroundedTabs() { |
| - const base::CommandLine& command_line = |
| - *base::CommandLine::ForCurrentProcess(); |
| - if (!command_line.HasSwitch(switches::kPurgeAndSuspendTime)) |
| - 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) |
| - return; |
| base::TimeTicks current_time = NowTicks(); |
| - base::TimeDelta time_to_first_suspension = |
| - base::TimeDelta::FromSeconds(purge_and_suspend_time); |
| auto tab_stats = GetUnsortedTabStats(); |
| for (auto& tab : tab_stats) { |
| if (!tab.render_process_host->IsProcessBackgrounded()) |
| @@ -766,7 +764,7 @@ void TabManager::PurgeAndSuspendBackgroundedTabs() { |
| tab.last_hidden < |
| GetWebContentsData(content)->LastPurgeAndSuspendModifiedTime()); |
| PurgeAndSuspendState next_state = GetNextPurgeAndSuspendState( |
| - content, current_time, time_to_first_suspension); |
| + content, current_time, time_to_first_suspension_); |
| if (current_state == next_state) |
| continue; |