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

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

Issue 1997463002: [TabManager] Fix discard only once regression. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@2704
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 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 #if defined(OS_WIN) || defined(OS_MACOSX) 160 #if defined(OS_WIN) || defined(OS_MACOSX)
161 // If the feature is not enabled, do nothing. 161 // If the feature is not enabled, do nothing.
162 if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding)) 162 if (!base::FeatureList::IsEnabled(features::kAutomaticTabDiscarding))
163 return; 163 return;
164 164
165 // Check the variation parameter to see if a tab be discarded more than once. 165 // Check the variation parameter to see if a tab be discarded more than once.
166 // Default is to only discard once per tab. 166 // Default is to only discard once per tab.
167 std::string allow_multiple_discards = variations::GetVariationParamValue( 167 std::string allow_multiple_discards = variations::GetVariationParamValue(
168 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); 168 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards");
169 if (allow_multiple_discards == "true") 169 if (allow_multiple_discards == "true")
170 discard_once_ = false;
171 else
170 discard_once_ = true; 172 discard_once_ = true;
171 else
172 discard_once_ = false;
173 173
174 // Check the variation parameter to see if a tab is to be protected for an 174 // Check the variation parameter to see if a tab is to be protected for an
175 // amount of time after being backgrounded. The value is in seconds. 175 // amount of time after being backgrounded. The value is in seconds.
176 std::string minimum_protection_time_string = 176 std::string minimum_protection_time_string =
177 variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name, 177 variations::GetVariationParamValue(features::kAutomaticTabDiscarding.name,
178 "MinimumProtectionTime"); 178 "MinimumProtectionTime");
179 if (!minimum_protection_time_string.empty()) { 179 if (!minimum_protection_time_string.empty()) {
180 unsigned int minimum_protection_time_seconds = 0; 180 unsigned int minimum_protection_time_seconds = 0;
181 if (base::StringToUint(minimum_protection_time_string, 181 if (base::StringToUint(minimum_protection_time_string,
182 &minimum_protection_time_seconds)) { 182 &minimum_protection_time_seconds)) {
(...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after
840 } 840 }
841 } else { 841 } else {
842 // The code here can only be tested under a full browser test. 842 // The code here can only be tested under a full browser test.
843 AddTabStats(&stats_list); 843 AddTabStats(&stats_list);
844 } 844 }
845 845
846 return stats_list; 846 return stats_list;
847 } 847 }
848 848
849 } // namespace memory 849 } // 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