| 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..0c2791c84d987e96ca53789920c1d43b95e58170 100644
|
| --- a/chrome/browser/memory/tab_manager.cc
|
| +++ b/chrome/browser/memory/tab_manager.cc
|
| @@ -670,6 +670,23 @@ void TabManager::UpdateTimerCallback() {
|
| PurgeAndSuspendBackgroundedTabs();
|
| }
|
|
|
| +bool TabManager::CanPurgeAndSuspendBackgroundedTab(
|
| + int64_t target_web_contents_id) const {
|
| + TabStripModel* model;
|
| + int idx = FindTabStripModelById(target_web_contents_id, &model);
|
| + if (idx == -1)
|
| + return false;
|
| +
|
| + WebContents* web_contents = model->GetWebContentsAt(idx);
|
| +
|
| + // Do not suspend tabs that are playing either playing audio or accessing the
|
| + // microphone or camera as it's too distruptive to the user experience.
|
| + if (IsMediaTab(web_contents))
|
| + return false;
|
| +
|
| + return true;
|
| +}
|
| +
|
| void TabManager::PurgeAndSuspendBackgroundedTabs() {
|
| const base::CommandLine& command_line =
|
| *base::CommandLine::ForCurrentProcess();
|
| @@ -695,6 +712,8 @@ void TabManager::PurgeAndSuspendBackgroundedTabs() {
|
| // timers if we want necessary and sufficient signals.
|
| if (tab.last_active > purge_and_suspend_time_threshold)
|
| continue;
|
| + if (!CanPurgeAndSuspendBackgroundedTab(tab.tab_contents_id))
|
| + continue;
|
| tab.render_process_host->PurgeAndSuspend();
|
| }
|
| }
|
|
|