Index: chrome/browser/memory/tab_manager.h |
diff --git a/chrome/browser/memory/tab_manager.h b/chrome/browser/memory/tab_manager.h |
index cd5c3480417bf76976c8a3849ae4d0e5fe6c5057..53793adef8ee733b2b2560f9576f05c211578df4 100644 |
--- a/chrome/browser/memory/tab_manager.h |
+++ b/chrome/browser/memory/tab_manager.h |
@@ -128,7 +128,18 @@ class TabManager : public TabStripModelObserver { |
void AddObserver(TabManagerObserver* observer); |
void RemoveObserver(TabManagerObserver* observer); |
+ // Returns the auto-discardable state of the tab. When true, the tab is |
+ // eligible to be automatically discarded when critical memory pressure hits, |
+ // otherwise the tab is ignored and will never be automatically discarded. |
+ // Note that this property doesn't block the discarding of the tab via other |
+ // methods (about:discards for instance). |
+ bool IsTabAutoDiscardable(content::WebContents* contents) const; |
+ |
+ // Sets/clears the auto-discardable state of the tab. |
+ void SetTabAutoDiscardableState(content::WebContents* contents, bool state); |
+ |
private: |
+ FRIEND_TEST_ALL_PREFIXES(TabManagerTest, AutoDiscardable); |
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, CanOnlyDiscardOnce); |
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, ChildProcessNotifications); |
FRIEND_TEST_ALL_PREFIXES(TabManagerTest, Comparator); |
@@ -151,6 +162,11 @@ class TabManager : public TabStripModelObserver { |
void OnDiscardedStateChange(content::WebContents* contents, |
bool is_discarded); |
+ // Called by WebContentsData whenever the auto-discardable state of a |
+ // WebContents changes, so that observers can be informed. |
+ void OnAutoDiscardableStateChange(content::WebContents* contents, |
+ bool is_auto_discardable); |
+ |
// The time that a renderer is given to react to a memory pressure |
// notification before another renderer is also notified. This prevents all |
// renderers from receiving and acting upon notifications simultaneously, |