Bug 1447193 - Remove all displayport suppression logic from AsyncTabSwitcher. r?dthayer
It looks like TabChild::RenderLayers already does the work of suppressing the displayport,
so all of the suppression and bookkeeping that AsyncTabSwitcher is doing is superfluous
and probably opening us up to weird graphical glitches (like the one associated with this
bug).
MozReview-Commit-ID: 5qIVguSMsnr
--- a/browser/modules/AsyncTabSwitcher.jsm
+++ b/browser/modules/AsyncTabSwitcher.jsm
@@ -97,21 +97,16 @@ class AsyncTabSwitcher {
this.unloadTimer = null; // UNLOAD_DELAY nsITimer instance.
// Map from tabs to STATE_* (below).
this.tabState = new Map();
// True if we're in the midst of switching tabs.
this.switchInProgress = false;
- // Keep an exact list of content processes (tabParent) in which
- // we're actively suppressing the display port. This gives a robust
- // way to make sure we don't forget to un-suppress.
- this.activeSuppressDisplayport = new Set();
-
// Set of tabs that might be visible right now. We maintain
// this set because we can't be sure when a tab is actually
// drawn. A tab is added to this set when we ask to make it
// visible. All tabs but the most recently shown tab are
// removed from the set upon MozAfterPaint.
this.maybeVisibleTabs = new Set([tabbrowser.selectedTab]);
// This holds onto the set of tabs that we've been asked to warm up,
@@ -183,21 +178,16 @@ class AsyncTabSwitcher {
this.window.removeEventListener("MozLayerTreeCleared", this);
this.window.removeEventListener("TabRemotenessChange", this);
this.window.removeEventListener("sizemodechange", this);
this.window.removeEventListener("occlusionstatechange", this);
this.window.removeEventListener("SwapDocShells", this, true);
this.window.removeEventListener("EndSwapDocShells", this, true);
this.tabbrowser._switcher = null;
-
- this.activeSuppressDisplayport.forEach(function(tabParent) {
- tabParent.suppressDisplayport(false);
- });
- this.activeSuppressDisplayport.clear();
}
// Wraps nsITimer. Must not use the vanilla setTimeout and
// clearTimeout, because they will be blocked by nsIPromptService
// dialogs.
setTimer(callback, timeout) {
let event = {
notify: callback
@@ -871,17 +861,17 @@ class AsyncTabSwitcher {
if (!this.shouldWarmTab(tab)) {
return;
}
this.logState("warmupTab " + this.tinfo(tab));
this.warmingTabs.add(tab);
this.setTabState(tab, this.STATE_LOADING);
- this.suppressDisplayPortAndQueueUnload(tab, gTabWarmingUnloadDelayMs);
+ this.queueUnload(gTabWarmingUnloadDelayMs);
}
// Called when the user asks to switch to a given tab.
requestTab(tab) {
if (tab === this.requestedTab) {
return;
}
@@ -917,29 +907,21 @@ class AsyncTabSwitcher {
this.requestedTab = tab;
tab.linkedBrowser.setAttribute("primary", "true");
if (this.lastPrimaryTab && this.lastPrimaryTab != tab) {
this.lastPrimaryTab.linkedBrowser.removeAttribute("primary");
}
this.lastPrimaryTab = tab;
- this.suppressDisplayPortAndQueueUnload(this.requestedTab, this.UNLOAD_DELAY);
+ this.queueUnload(this.UNLOAD_DELAY);
this._requestingTab = false;
}
- suppressDisplayPortAndQueueUnload(tab, unloadTimeout) {
- let browser = tab.linkedBrowser;
- let fl = browser.frameLoader;
-
- if (fl && fl.tabParent && !this.activeSuppressDisplayport.has(fl.tabParent)) {
- fl.tabParent.suppressDisplayport(true);
- this.activeSuppressDisplayport.add(fl.tabParent);
- }
-
+ queueUnload(unloadTimeout) {
this.preActions();
if (this.unloadTimer) {
this.clearTimer(this.unloadTimer);
}
this.unloadTimer = this.setTimer(() => this.onUnloadTimeout(), unloadTimeout);
this.postActions();