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

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

Issue 2711093002: Purge once random minutes(between 30min and 60min) after backgrounded. (Closed)
Patch Set: Fixed Created 3 years, 9 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.h
diff --git a/chrome/browser/memory/tab_manager_web_contents_data.h b/chrome/browser/memory/tab_manager_web_contents_data.h
index 8f68c1239dec7c76096869da0df22681c15ff81c..3e509149c633808952e671458100a0eeff6cea01 100644
--- a/chrome/browser/memory/tab_manager_web_contents_data.h
+++ b/chrome/browser/memory/tab_manager_web_contents_data.h
@@ -79,25 +79,23 @@ class TabManager::WebContentsData
// Sets/clears the auto-discardable state of the tab.
void SetAutoDiscardableState(bool state);
- // Sets the current purge-and-suspend state, and update the timestamp,
- // i.e. the last purge-and-suspend modified time.
- // TODO(tasak): remove this after PurgeAndSuspend code is moved into
+ // Sets the current purge state.
+ // TODO(tasak): remove this after the logic is moved into
// MemoryCoordinator.
- void SetPurgeAndSuspendState(TabManager::PurgeAndSuspendState state);
+ void set_is_purged(bool state) { is_purged_ = state; }
- // Returns the last purge-and-suspend modified time.
- // TODO(tasak): remove this after PurgeAndSuspend code is moved into
+ // Returns the current state of purge.
+ // TODO(tasak): remove this after the logic is moved into
// MemoryCoordinator.
- base::TimeTicks LastPurgeAndSuspendModifiedTime() const;
+ bool is_purged() const { return is_purged_; }
- // Sets the timestamp of the last modified time the purge-and-suspend state
- // of the tab was changed for testing.
- void SetLastPurgeAndSuspendModifiedTimeForTesting(base::TimeTicks timestamp);
+ // Sets the time to purge after the tab is backgrounded.
+ void set_time_to_purge(const base::TimeDelta& time_to_purge) {
+ time_to_purge_ = time_to_purge;
+ }
- // Returns the current state of purge-and-suspend.
- // TODO(tasak): remove this after PurgeAndSuspend code is moved into
- // MemoryCoordinator.
- TabManager::PurgeAndSuspendState GetPurgeAndSuspendState() const;
+ // Returns the time to first purge after the tab is backgrounded.
+ base::TimeDelta time_to_purge() const { return time_to_purge_; }
private:
// Needed to access tab_data_.
@@ -141,11 +139,11 @@ class TabManager::WebContentsData
// this test clock. Otherwise it returns the system clock's value.
base::TickClock* test_tick_clock_;
- // The last time purge-and-suspend state was modified.
- base::TimeTicks last_purge_and_suspend_modified_time_;
+ // The time to purge after the tab is backgrounded.
+ base::TimeDelta time_to_purge_;
- // The current state of purge-and-suspend.
- PurgeAndSuspendState purge_and_suspend_state_;
+ // True if the tab has been purged.
+ bool is_purged_;
DISALLOW_COPY_AND_ASSIGN(WebContentsData);
};
« no previous file with comments | « chrome/browser/memory/tab_manager_unittest.cc ('k') | chrome/browser/memory/tab_manager_web_contents_data.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698