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

Unified Diff: chrome/browser/memory/tab_manager.cc

Issue 2399293002: Add MemoryCoordinatorDelegate (Closed)
Patch Set: comments addressed Created 4 years, 2 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
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | content/browser/memory/memory_coordinator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/memory/tab_manager.cc
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc
index 582b2e667099f6fa0085f6721c4b9c69a37709c8..9b91aa526398a6d0b9006f23db2f4e69a7a2a264 100644
--- a/chrome/browser/memory/tab_manager.cc
+++ b/chrome/browser/memory/tab_manager.cc
@@ -211,6 +211,7 @@ void TabManager::Start() {
}
}
#endif
+ MemoryCoordinatorDelegate::Set(weak_ptr_factory_.GetWeakPtr());
}
void TabManager::Stop() {
@@ -418,6 +419,17 @@ void TabManager::SetTabAutoDiscardableState(content::WebContents* contents,
GetWebContentsData(contents)->SetAutoDiscardableState(state);
}
+bool TabManager::CanSuspendRenderer(int render_process_id) {
+ auto tab_stats = GetUnsortedTabStats();
+ for (auto& tab : tab_stats) {
+ if (tab.child_process_host_id != render_process_id)
+ continue;
+ if (!CanDiscardTab(tab.tab_contents_id))
chrisha 2016/10/10 23:25:08 Discard and suspend have very different semantics.
bashi 2016/10/11 01:10:06 Agreed. Changed to check IsMediaTab().
+ return false;
+ }
+ return true;
+}
+
// static
bool TabManager::CompareTabStats(const TabStats& first,
const TabStats& second) {
« no previous file with comments | « chrome/browser/memory/tab_manager.h ('k') | content/browser/memory/memory_coordinator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698