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

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: 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.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..dd8e8e5553c407c860743bceaad01efbb3c6378d 100644
--- a/chrome/browser/memory/tab_manager_web_contents_data.h
+++ b/chrome/browser/memory/tab_manager_web_contents_data.h
@@ -79,25 +79,21 @@ 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 SetPurgeState(TabManager::PurgeState state);
- // Returns the last purge-and-suspend modified time.
- // TODO(tasak): remove this after PurgeAndSuspend code is moved into
- // MemoryCoordinator.
- base::TimeTicks LastPurgeAndSuspendModifiedTime() const;
+ // Sets the time to first purge after the tab is backgrounded.
+ void SetTimeToFirstPurge(const base::TimeDelta& time_to_first_purge);
Wez 2017/02/27 22:20:56 since these are simple setter & getter, they can b
tasak 2017/02/28 09:45:40 Done.
- // 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);
+ // Returns the time to first purge after the tab is backgrounded.
+ base::TimeDelta TimeToFirstPurge() const;
- // Returns the current state of purge-and-suspend.
- // 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.
- TabManager::PurgeAndSuspendState GetPurgeAndSuspendState() const;
+ TabManager::PurgeState GetPurgeState() const;
Wez 2017/02/27 22:20:56 Why not put the setter and getter for PurgeState n
tasak 2017/02/28 09:45:41 Done.
private:
// Needed to access tab_data_.
@@ -141,11 +137,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 first purge after the tab is backgrounded.
+ base::TimeDelta time_to_first_purge_;
- // The current state of purge-and-suspend.
- PurgeAndSuspendState purge_and_suspend_state_;
+ // The current state of purge.
+ PurgeState purge_state_;
Wez 2017/02/27 22:20:56 Putting these fields here, rather than in tab_data
tasak 2017/02/28 09:45:42 Done.
DISALLOW_COPY_AND_ASSIGN(WebContentsData);
};

Powered by Google App Engine
This is Rietveld 408576698