Index: chrome/browser/memory/tab_manager.cc |
diff --git a/chrome/browser/memory/tab_manager.cc b/chrome/browser/memory/tab_manager.cc |
index a2299862de6deec44a10eb2a4db511c985a7d215..a5610185afee6fcff6fefe766f2a3758829756a8 100644 |
--- a/chrome/browser/memory/tab_manager.cc |
+++ b/chrome/browser/memory/tab_manager.cc |
@@ -480,7 +480,7 @@ void TabManager::AddTabStats(const TabStripModel* model, |
bool is_app, |
bool active_model, |
TabStatsList* stats_list) { |
-for (int i = 0; i < model->count(); i++) { |
+ for (int i = 0; i < model->count(); i++) { |
WebContents* contents = model->GetWebContentsAt(i); |
if (!contents->IsCrashed()) { |
TabStats stats; |
@@ -532,6 +532,20 @@ void TabManager::UpdateTimerCallback() { |
} |
last_adjust_time_ = NowTicks(); |
+#if defined(OS_ANDROID) |
Georges Khalil
2016/04/19 13:55:19
Move this to an android delegate, similar to chrom
|
+ auto tab_stats = GetUnsortedTabStats(); |
+ for (auto& tab : tab_stats) { |
+ if (!tab.render_process_host->IsProcessBackgrounded()) |
+ continue; |
+ if (NowTicks() - tab.last_active < |
+ base::TimeDelta::FromSeconds( |
+ kSuspendTimersWhenBackgroundedDelayInSeconds)) { |
+ continue; |
+ } |
+ tab.render_process_host->Suspend(); |
+ } |
+#endif |
+ |
#if defined(OS_CHROMEOS) |
TabStatsList stats_list = GetTabStats(); |
// This starts the CrOS specific OOM adjustments in /proc/<pid>/oom_score_adj. |