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

Side by Side Diff: chrome/browser/memory/tab_manager.cc

Issue 1980143002: [TabManager] Fix discard only once regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/memory/tab_manager.h" 5 #include "chrome/browser/memory/tab_manager.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <set> 10 #include <set>
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 #if defined(OS_WIN) || defined(OS_MACOSX) 163 #if defined(OS_WIN) || defined(OS_MACOSX)
164 // If the feature is not enabled, do nothing. 164 // If the feature is not enabled, do nothing.
165 if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding)) 165 if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding))
166 return; 166 return;
167 167
168 // Check the variation parameter to see if a tab be discarded more than once. 168 // Check the variation parameter to see if a tab be discarded more than once.
169 // Default is to only discard once per tab. 169 // Default is to only discard once per tab.
170 std::string allow_multiple_discards = variations::GetVariationParamValue( 170 std::string allow_multiple_discards = variations::GetVariationParamValue(
171 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); 171 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards");
172 if (allow_multiple_discards == "true") 172 if (allow_multiple_discards == "true")
173 discard_once_ = false;
174 else
173 discard_once_ = true; 175 discard_once_ = true;
174 else
175 discard_once_ = false;
176 176
177 // Check the variation parameter to see if a tab is to be protected for an 177 // Check the variation parameter to see if a tab is to be protected for an
178 // amount of time after being backgrounded. The value is in seconds. 178 // amount of time after being backgrounded. The value is in seconds.
179 std::string minimum_protection_time_string = 179 std::string minimum_protection_time_string =
180 variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name, 180 variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name,
181 "MinimumProtectionTime"); 181 "MinimumProtectionTime");
182 if (!minimum_protection_time_string.empty()) { 182 if (!minimum_protection_time_string.empty()) {
183 unsigned int minimum_protection_time_seconds = 0; 183 unsigned int minimum_protection_time_seconds = 0;
184 if (base::StringToUint(minimum_protection_time_string, 184 if (base::StringToUint(minimum_protection_time_string,
185 &minimum_protection_time_seconds)) { 185 &minimum_protection_time_seconds)) {
(...skipping 692 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 } 878 }
879 } else { 879 } else {
880 // The code here can only be tested under a full browser test. 880 // The code here can only be tested under a full browser test.
881 AddTabStats(&stats_list); 881 AddTabStats(&stats_list);
882 } 882 }
883 883
884 return stats_list; 884 return stats_list;
885 } 885 }
886 886
887 } // namespace memory 887 } // namespace memory
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698