Bug 1260113 - Part 2 - Don't zombify tabs playing audio even under memory pressure. r=margaret
authorJan Henning <jh+bugzilla@buttercookie.de>
Sun, 27 Mar 2016 17:15:41 +0100
changeset 290860 d6acac6649a37bfda6c6c8cb6cde9972bb56ffbb
parent 290859 e47ddbd75bb0cd2b1afe4c720ed38c87e94d87a2
child 290861 ccd1d2db9f2932b491d445fe83739131ccf18f89
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmargaret
bugs1260113, 1253278
milestone48.0a1
Bug 1260113 - Part 2 - Don't zombify tabs playing audio even under memory pressure. r=margaret Bug 1253278 added support for not zombifying least recently used tabs if they were playing audio. This patch extends this behaviour to also cover the case where we want to zombify *all* background tabs under memory-pressure. Therefore, a tab which is currently playing audio should now never get zombified, which also means that the issue about the audio playing indicator fixed in part 1 is now sidestepped. MozReview-Commit-ID: LBeEX2KPh2J
mobile/android/chrome/content/MemoryObserver.js
--- a/mobile/android/chrome/content/MemoryObserver.js
+++ b/mobile/android/chrome/content/MemoryObserver.js
@@ -18,17 +18,17 @@ var MemoryObserver = {
     }
   },
 
   handleLowMemory: function() {
     // do things to reduce memory usage here
     let tabs = BrowserApp.tabs;
     let selected = BrowserApp.selectedTab;
     for (let i = 0; i < tabs.length; i++) {
-      if (tabs[i] != selected) {
+      if (tabs[i] != selected && !tabs[i].playingAudio) {
         this.zombify(tabs[i]);
       }
     }
 
     // Change some preferences temporarily for only this session
     let defaults = Services.prefs.getDefaultBranch(null);
 
     // Reduce the amount of decoded image data we keep around