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
--- 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