| 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..a4da574c119d91332844a6c5f779b02fc122fe72 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,23 @@ void TabManager::SetTabAutoDiscardableState(content::WebContents* contents,
|
| GetWebContentsData(contents)->SetAutoDiscardableState(state);
|
| }
|
|
|
| +bool TabManager::CanSuspendBackgroundedRenderer(int render_process_id) {
|
| + // A renderer can be suspended if it's not playing media.
|
| + auto tab_stats = GetUnsortedTabStats();
|
| + for (auto& tab : tab_stats) {
|
| + if (tab.child_process_host_id != render_process_id)
|
| + continue;
|
| + TabStripModel* model;
|
| + int index = FindTabStripModelById(tab.tab_contents_id, &model);
|
| + if (index == -1)
|
| + return false;
|
| + WebContents* web_contents = model->GetWebContentsAt(index);
|
| + if (IsMediaTab(web_contents))
|
| + return false;
|
| + }
|
| + return true;
|
| +}
|
| +
|
| // static
|
| bool TabManager::CompareTabStats(const TabStats& first,
|
| const TabStats& second) {
|
|
|