Chromium Code Reviews| Index: chrome/browser/memory/tab_manager.h |
| diff --git a/chrome/browser/memory/tab_manager.h b/chrome/browser/memory/tab_manager.h |
| index 9dc86df35fb7da85d33e17f02a3eae04f168d72e..cd3a3028f6c653dc567684907cc85ea958699771 100644 |
| --- a/chrome/browser/memory/tab_manager.h |
| +++ b/chrome/browser/memory/tab_manager.h |
| @@ -174,8 +174,9 @@ class TabManager : public TabStripModelObserver { |
| FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ReloadDiscardedTabContextMenu); |
| FRIEND_TEST_ALL_PREFIXES(TabManagerTest, TabManagerBasics); |
| - // This is needed so WebContentsData can call OnDiscardedStateChange. |
| - friend class WebContensData; |
| + // This is needed so WebContentsData can call OnDiscardedStateChange, and |
| + // can use PurgeAndSuspendState. |
| + friend class WebContentsData; |
| // Called by WebContentsData whenever the discard state of a WebContents |
| // changes, so that observers can be informed. |
| @@ -247,6 +248,22 @@ class TabManager : public TabStripModelObserver { |
| // that need to be run periodically (see comment in implementation). |
| void UpdateTimerCallback(); |
| + // Returns WebContents whose contents id matches the given tab-contents-id. |
| + content::WebContents* GetWebContentsByContentsId(int64_t tab_contents_id); |
| + |
| + enum PurgeAndSuspendState { |
|
haraken
2016/10/19 10:40:30
Add a comment about how the state transition happe
|
| + BACKGROUNDED, |
|
haraken
2016/10/19 10:40:30
I'd prefer renaming BACKGROUNDED to RUNNING (or so
tasak
2016/10/20 11:28:46
Done.
|
| + RESUMED, |
| + SUSPENDED, |
| + }; |
| + // Determines whether to update purge-and-suspend state and returns the |
| + // next state. |
| + bool ShouldUpdatePurgeAndSuspendState( |
| + const base::TimeTicks& current_time, |
| + const TabStats& tab, |
| + const base::TimeDelta& purge_and_suspend_threshold, |
| + PurgeAndSuspendState* next_state); |
| + |
| // Purges and suspends renderers in backgrounded tabs. |
| void PurgeAndSuspendBackgroundedTabs(); |