Index: chrome/browser/sessions/tab_loader.h |
diff --git a/chrome/browser/sessions/tab_loader.h b/chrome/browser/sessions/tab_loader.h |
index 1ae274c7ef7f742e8bdae3ecffba8c12f726028f..a422931c9f46c624f15cd31704e614964c3e7f47 100644 |
--- a/chrome/browser/sessions/tab_loader.h |
+++ b/chrome/browser/sessions/tab_loader.h |
@@ -12,6 +12,7 @@ |
#include <set> |
#include "base/macros.h" |
+#include "base/memory/memory_coordinator_client.h" |
#include "base/memory/memory_pressure_listener.h" |
#include "base/timer/timer.h" |
#include "chrome/browser/sessions/session_restore_delegate.h" |
@@ -40,7 +41,8 @@ class SessionRestoreStatsCollector; |
// of SessionRestoreImpl doesn't have timing problems. |
class TabLoader : public content::NotificationObserver, |
public base::RefCounted<TabLoader>, |
- public TabLoaderCallback { |
+ public TabLoaderCallback, |
+ public base::MemoryCoordinatorClient { |
public: |
using RestoredTab = SessionRestoreDelegate::RestoredTab; |
@@ -103,14 +105,20 @@ class TabLoader : public content::NotificationObserver, |
// Called when a tab goes away or a load completes. |
void HandleTabClosedOrLoaded(content::NavigationController* controller); |
- // Convenience function returning the current memory pressure level. |
- base::MemoryPressureListener::MemoryPressureLevel |
- CurrentMemoryPressureLevel(); |
+ // Returns true when this is under memory pressure and required to purge |
+ // memory by stopping loading tabs. |
+ bool ShouldStopLoadingTabs() const; |
// React to memory pressure by stopping to load any more tabs. |
void OnMemoryPressure( |
base::MemoryPressureListener::MemoryPressureLevel memory_pressure_level); |
+ // base::MemoryCoordinatorClient implementation: |
+ void OnMemoryStateChange(base::MemoryState state) override; |
+ |
+ // Stops loading tabs to purge memory by stopping to load any more tabs. |
+ void StopLoadingTabs(); |
+ |
std::unique_ptr<TabLoaderDelegate> delegate_; |
// Listens for system under memory pressure notifications and stops loading |