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

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

Issue 2711093002: Purge once random minutes(between 30min and 60min) after backgrounded. (Closed)
Patch Set: s/RUNNING/NOT_PURGED/g 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/memory/tab_manager_web_contents_data.cc
diff --git a/chrome/browser/memory/tab_manager_web_contents_data.cc b/chrome/browser/memory/tab_manager_web_contents_data.cc
index 92ebc887cf0a8566ac907b3f32d449f356dc62d6..95786a29279bab5c7fbbe3476180d4e27edf51ac 100644
--- a/chrome/browser/memory/tab_manager_web_contents_data.cc
+++ b/chrome/browser/memory/tab_manager_web_contents_data.cc
@@ -22,9 +22,8 @@ namespace memory {
TabManager::WebContentsData::WebContentsData(content::WebContents* web_contents)
: WebContentsObserver(web_contents),
test_tick_clock_(nullptr),
- last_purge_and_suspend_modified_time_(
- base::TimeTicks::FromInternalValue(0)),
- purge_and_suspend_state_(RUNNING) {}
+ time_to_first_purge_(base::TimeDelta::FromMinutes(30)),
+ purge_state_(NOT_PURGED) {}
TabManager::WebContentsData::~WebContentsData() {}
@@ -202,25 +201,21 @@ bool TabManager::WebContentsData::IsAutoDiscardable() {
return tab_data_.is_auto_discardable;
}
-void TabManager::WebContentsData::SetPurgeAndSuspendState(
- PurgeAndSuspendState state) {
- last_purge_and_suspend_modified_time_ = NowTicks();
- purge_and_suspend_state_ = state;
+void TabManager::WebContentsData::SetPurgeState(PurgeState state) {
+ purge_state_ = state;
}
-base::TimeTicks TabManager::WebContentsData::LastPurgeAndSuspendModifiedTime()
- const {
- return last_purge_and_suspend_modified_time_;
+void TabManager::WebContentsData::SetTimeToFirstPurge(
+ const base::TimeDelta& time_to_first_purge) {
+ time_to_first_purge_ = time_to_first_purge;
}
-void TabManager::WebContentsData::SetLastPurgeAndSuspendModifiedTimeForTesting(
- base::TimeTicks timestamp) {
- last_purge_and_suspend_modified_time_ = timestamp;
+base::TimeDelta TabManager::WebContentsData::TimeToFirstPurge() const {
+ return time_to_first_purge_;
}
-TabManager::PurgeAndSuspendState
-TabManager::WebContentsData::GetPurgeAndSuspendState() const {
- return purge_and_suspend_state_;
+TabManager::PurgeState TabManager::WebContentsData::GetPurgeState() const {
+ return purge_state_;
}
} // namespace memory

Powered by Google App Engine
This is Rietveld 408576698