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

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

Issue 2483003004: Make purge-and-suspend-time finch experiment parameter (Closed)
Patch Set: Make purge-and-suspend-time=0 immediately purge+suspend. Instead default value is 30min. Created 4 years 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 | « chrome/browser/memory/tab_manager.h ('k') | 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..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;
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698