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

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

Issue 2483003004: Make purge-and-suspend-time finch experiment parameter (Closed)
Patch Set: Move GetVariationParamValue to initialization phase 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 | « 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..c551175455530b5f700808ae935ade0e5fe66d32 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -221,6 +221,17 @@ void TabManager::Start() {
}
}
#endif
+ std::string purge_and_suspend_time = variations::GetVariationParamValue(
chrisha 2016/11/24 17:13:09 Should we have a default time that this is initial
tasak 2016/11/25 01:15:24 As far as I understand, base::TimeDelta() initiali
chrisha 2016/11/29 14:13:57 Okay, that makes sense. I was thinking that there'
tasak 2016/12/02 02:49:24 Yes... currently the zero means that the purge+sus
+ "PurgeAndSuspend", "purge-and-suspend-time");
+ if (!purge_and_suspend_time.empty()) {
+ int time_to_first_suspension_sec = 0;
+ if (base::StringToInt(purge_and_suspend_time,
+ &time_to_first_suspension_sec)) {
+ if (time_to_first_suspension_sec > 0)
+ time_to_first_suspension_ =
+ base::TimeDelta::FromSeconds(time_to_first_suspension_sec);
+ }
+ }
}
void TabManager::Stop() {
@@ -731,21 +742,10 @@ 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)
+ if (time_to_first_suspension_.InSeconds() <= 0)
chrisha 2016/11/24 17:13:09 Do we need this check? This function simply should
tasak 2016/11/25 01:15:24 I would like to confirm. You mean, we should check
tasak 2016/11/25 01:19:44 So my first patch is trying to always record B. I
chrisha 2016/11/29 14:13:57 I'm not sure I follow this entire chain of logic?
tasak 2016/12/02 02:49:24 I see.... I'm trying to keep the existing behavior
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 +766,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