Skip to content

Commit

Permalink
[TabManager] Enable tab discarding by default.
Browse files Browse the repository at this point in the history
This CL enables tab discarding by default and keeps the existing feature only as a kill switch.

BUG=551995

Review-Url: https://codereview.chromium.org/2373653002
Cr-Commit-Position: refs/heads/master@{#421178}
  • Loading branch information
georgesak authored and Commit bot committed Sep 27, 2016
1 parent 6a45441 commit ea47d44
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 14 deletions.
8 changes: 6 additions & 2 deletions chrome/browser/memory/tab_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,7 @@ TabManager::TabManager()
: discard_count_(0),
recent_tab_discard_(false),
discard_once_(false),
minimum_protection_time_(base::TimeDelta::FromMinutes(10)),
browser_tab_strip_tracker_(this, nullptr, nullptr),
test_tick_clock_(nullptr),
under_memory_pressure_(false),
Expand All @@ -157,12 +158,15 @@ TabManager::~TabManager() {

void TabManager::Start() {
#if defined(OS_WIN) || defined(OS_MACOSX)
// If the feature is not enabled, do nothing.
// Note that discarding is now enabled by default. This check is kept as a
// kill switch.
// TODO(georgesak): remote this when deemed not needed anymore.
if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding))
return;

// Check the variation parameter to see if a tab is to be protected for an
// amount of time after being backgrounded. The value is in seconds.
// amount of time after being backgrounded. The value is in seconds. Default
// is 10 minutes if the variation is absent.
std::string minimum_protection_time_string =
variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name,
"MinimumProtectionTime");
Expand Down
10 changes: 0 additions & 10 deletions chrome/browser/memory/tab_manager_browsertest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,6 @@ using content::OpenURLParams;
namespace memory {

class TabManagerTest : public InProcessBrowserTest {
public:
// Tab discarding is enabled by default on CrOS. On other platforms, force it
// by turning on the corresponding experiment as some tests assume this
// behavior it turned on.
void SetUpCommandLine(base::CommandLine* command_line) override {
#if !defined(OS_LINUX)
command_line->AppendSwitchASCII(switches::kEnableFeatures,
features::kAutomaticTabDiscarding.name);
#endif
}
};

IN_PROC_BROWSER_TEST_F(TabManagerTest, TabManagerBasics) {
Expand Down
2 changes: 1 addition & 1 deletion chrome/browser/memory/tab_manager_unittest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ TEST_F(TabManagerTest, DiscardedTabKeepsLastActiveTime) {

// Test to see if a tab can only be discarded once. On Windows and Mac, this
// defaults to true unless overridden through a variation parameter. On other
// platforms, it's always false
// platforms, it's always false.
#if defined(OS_WIN) || defined(OS_MACOSX)
TEST_F(TabManagerTest, CanOnlyDiscardOnce) {
TabManager tab_manager;
Expand Down
2 changes: 1 addition & 1 deletion chrome/common/chrome_features.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const base::Feature kArcMemoryManagement{
#if defined(OS_WIN) || defined(OS_MACOSX)
// Enables automatic tab discarding, when the system is in low memory state.
const base::Feature kAutomaticTabDiscarding{"AutomaticTabDiscarding",
base::FEATURE_DISABLED_BY_DEFAULT};
base::FEATURE_ENABLED_BY_DEFAULT};
#endif // defined(OS_WIN) || defined(OS_MACOSX)

#if defined(OS_WIN) || defined(OS_LINUX)
Expand Down

0 comments on commit ea47d44

Please sign in to comment.