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

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

Issue 2704443006: Make time_to_first_suspension's default 1800sec (Closed)
Patch Set: Fixed style. Created 3 years, 10 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 | « chrome/browser/memory/tab_manager.h ('k') | chrome/browser/memory/tab_manager_unittest.cc » ('j') | 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 base::MemoryPressureListener::MemoryPressureLevel level) { 132 base::MemoryPressureListener::MemoryPressureLevel level) {
133 content::MemoryPressureController::SendPressureNotification( 133 content::MemoryPressureController::SendPressureNotification(
134 render_process_host, level); 134 render_process_host, level);
135 } 135 }
136 136
137 } // namespace 137 } // namespace
138 138
139 //////////////////////////////////////////////////////////////////////////////// 139 ////////////////////////////////////////////////////////////////////////////////
140 // TabManager 140 // TabManager
141 141
142 constexpr base::TimeDelta TabManager::kDefaultTimeToFirstPurge;
143
142 TabManager::TabManager() 144 TabManager::TabManager()
143 : discard_count_(0), 145 : discard_count_(0),
144 recent_tab_discard_(false), 146 recent_tab_discard_(false),
145 discard_once_(false), 147 discard_once_(false),
146 #if !defined(OS_CHROMEOS) 148 #if !defined(OS_CHROMEOS)
147 minimum_protection_time_(base::TimeDelta::FromMinutes(10)), 149 minimum_protection_time_(base::TimeDelta::FromMinutes(10)),
148 #endif 150 #endif
149 browser_tab_strip_tracker_(this, nullptr, nullptr), 151 browser_tab_strip_tracker_(this, nullptr, nullptr),
150 test_tick_clock_(nullptr), 152 test_tick_clock_(nullptr),
151 under_memory_pressure_(false), 153 under_memory_pressure_(false),
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 if (level == base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) { 221 if (level == base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_CRITICAL) {
220 OnMemoryPressure(level); 222 OnMemoryPressure(level);
221 } 223 }
222 } 224 }
223 #endif 225 #endif
224 // purge-and-suspend param is used for Purge+Suspend finch experiment 226 // purge-and-suspend param is used for Purge+Suspend finch experiment
225 // in the following way: 227 // in the following way:
226 // https://docs.google.com/document/d/1hPHkKtXXBTlsZx9s-9U17XC-ofEIzPo9FYbBEc7 PPbk/edit?usp=sharing 228 // https://docs.google.com/document/d/1hPHkKtXXBTlsZx9s-9U17XC-ofEIzPo9FYbBEc7 PPbk/edit?usp=sharing
227 std::string purge_and_suspend_time = variations::GetVariationParamValue( 229 std::string purge_and_suspend_time = variations::GetVariationParamValue(
228 "PurgeAndSuspend", "purge-and-suspend-time"); 230 "PurgeAndSuspend", "purge-and-suspend-time");
229 unsigned time_to_first_suspension_sec; 231 unsigned int time_to_first_purge_sec = 0;
230 if (purge_and_suspend_time.empty() || 232 if (purge_and_suspend_time.empty() ||
231 !base::StringToUint(purge_and_suspend_time, 233 !base::StringToUint(purge_and_suspend_time, &time_to_first_purge_sec))
232 &time_to_first_suspension_sec)) 234 time_to_first_suspension_ = kDefaultTimeToFirstPurge;
233 time_to_first_suspension_sec = 108000; 235 else
234 time_to_first_suspension_ = 236 time_to_first_suspension_ =
235 base::TimeDelta::FromSeconds(time_to_first_suspension_sec); 237 base::TimeDelta::FromSeconds(time_to_first_purge_sec);
236 } 238 }
237 239
238 void TabManager::Stop() { 240 void TabManager::Stop() {
239 update_timer_.Stop(); 241 update_timer_.Stop();
240 recent_tab_discard_timer_.Stop(); 242 recent_tab_discard_timer_.Stop();
241 memory_pressure_listener_.reset(); 243 memory_pressure_listener_.reset();
242 } 244 }
243 245
244 TabStatsList TabManager::GetTabStats() const { 246 TabStatsList TabManager::GetTabStats() const {
245 TabStatsList stats_list(GetUnsortedTabStats()); 247 TabStatsList stats_list(GetUnsortedTabStats());
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after
1030 // platform. 1032 // platform.
1031 std::string allow_multiple_discards = variations::GetVariationParamValue( 1033 std::string allow_multiple_discards = variations::GetVariationParamValue(
1032 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards"); 1034 features::kAutomaticTabDiscarding.name, "AllowMultipleDiscards");
1033 return (allow_multiple_discards != "true"); 1035 return (allow_multiple_discards != "true");
1034 #else 1036 #else
1035 return false; 1037 return false;
1036 #endif 1038 #endif
1037 } 1039 }
1038 1040
1039 } // namespace memory 1041 } // namespace memory
OLDNEW
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | chrome/browser/memory/tab_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698