Backed out 2 changesets (bug 1580117) for mochitest and webrender failures CLOSED TREE

Backed out changeset aba57d4f19cb (bug 1580117)
Backed out changeset 70b864f4b6a5 (bug 1580117)
This commit is contained in:
Bogdan Tara 2020-09-01 15:15:29 +03:00
parent ad76c1dcba
commit e30a2f5c84
5 changed files with 30 additions and 132 deletions

View File

@ -288,16 +288,11 @@ this.ActivityStreamMessageChannel = class ActivityStreamMessageChannel {
*/
onNewTabLoad(msg) {
let { browser } = msg.target;
if (
this.isPreloadedBrowser(browser) &&
browser.ownerGlobal.windowState !== browser.ownerGlobal.STATE_MINIMIZED &&
!browser.ownerGlobal.isFullyOccluded
) {
if (this.isPreloadedBrowser(browser)) {
// As a perceived performance optimization, if this loaded Activity Stream
// happens to be a preloaded browser in a window that is not minimized or
// occluded, have it render its layers to the compositor now to increase
// the odds that by the time we switch to the tab, the layers are already
// ready to present to the user.
// happens to be a preloaded browser, have it render its layers to the
// compositor now to increase the odds that by the time we switch to
// the tab, the layers are already ready to present to the user.
browser.renderLayers = true;
}

View File

@ -127,20 +127,14 @@ describe("ActivityStreamMessageChannel", () => {
loaded: false,
portID: "inited",
simulated: true,
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
},
browser: { getAttribute: () => "preloaded" },
});
RPmessagePorts.push({
url: "about:sheep",
loaded: true,
portID: "loaded",
simulated: true,
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
},
browser: { getAttribute: () => "preloaded" },
});
mm.simulateMessagesForExistingTabs();
@ -158,10 +152,7 @@ describe("ActivityStreamMessageChannel", () => {
RPmessagePorts.push({
loaded: true,
portID: "foo",
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
},
browser: { getAttribute: () => "preloaded" },
});
mm.simulateMessagesForExistingTabs();
@ -176,17 +167,7 @@ describe("ActivityStreamMessageChannel", () => {
RPmessagePorts.push({
loaded: true,
portID: "foo",
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {
STATE_MAXIMIZED: 1,
STATE_MINIMIZED: 2,
STATE_NORMAL: 3,
STATE_FULLSCREEN: 4,
windowState: 3,
isFullyOccluded: false,
},
},
browser: { getAttribute: () => "preloaded" },
});
mm.simulateMessagesForExistingTabs();
assert.equal(RPmessagePorts[0].browser.renderLayers, true);
@ -241,8 +222,9 @@ describe("ActivityStreamMessageChannel", () => {
it("should get a preloaded browser if it exists", () => {
const port = {
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
getAttribute() {
return "preloaded";
},
},
};
mm.createChannel();
@ -252,8 +234,9 @@ describe("ActivityStreamMessageChannel", () => {
it("should get all the preloaded browsers across windows if they exist", () => {
const port = {
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
getAttribute() {
return "preloaded";
},
},
};
mm.createChannel();
@ -264,8 +247,9 @@ describe("ActivityStreamMessageChannel", () => {
it("should return null if there is no preloaded browser", () => {
const port = {
browser: {
getAttribute: () => "consumed",
ownerGlobal: {},
getAttribute() {
return "consumed";
},
},
};
mm.createChannel();
@ -290,10 +274,7 @@ describe("ActivityStreamMessageChannel", () => {
it("should dispatch a NEW_TAB_LOAD action", () => {
const t = {
portID: "foo",
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
},
browser: { getAttribute: () => "preloaded" },
};
sinon.stub(mm, "onActionFromContent");
mm.onNewTabLoad({ target: t });
@ -385,8 +366,9 @@ describe("ActivityStreamMessageChannel", () => {
it("should send the message to the preloaded browser if there's data and a preloaded browser exists", () => {
const port = {
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
getAttribute() {
return "preloaded";
},
},
sendAsyncMessage: sinon.spy(),
};
@ -403,8 +385,9 @@ describe("ActivityStreamMessageChannel", () => {
it("should send the message to all the preloaded browsers if there's data and they exist", () => {
const port = {
browser: {
getAttribute: () => "preloaded",
ownerGlobal: {},
getAttribute() {
return "preloaded";
},
},
sendAsyncMessage: sinon.spy(),
};
@ -417,8 +400,9 @@ describe("ActivityStreamMessageChannel", () => {
it("should not send the message to the preloaded browser if there's no data and a preloaded browser does not exists", () => {
const port = {
browser: {
getAttribute: () => "consumed",
ownerGlobal: {},
getAttribute() {
return "consumed";
},
},
sendAsyncMessage: sinon.spy(),
};

View File

@ -101,15 +101,12 @@ let NewTabPagePreloading = {
},
maybeCreatePreloadedBrowser(window) {
// If we're not enabled, have already got one, are in a popup window, or the
// window is minimized / occluded, don't bother creating a preload browser -
// there's no point.
// If we're not enabled, have already got one, or are in a popup window,
// don't bother creating a preload browser - there's no point.
if (
!this.enabled ||
window.gBrowser.preloadedBrowser ||
!window.toolbar.visible ||
window.windowState == window.STATE_MINIMIZED ||
window.isFullyOccluded
!window.toolbar.visible
) {
return;
}

View File

@ -340,9 +340,6 @@ class nsCocoaWindow final : public nsBaseWidget, public nsPIWidgetCocoa {
bool InFullScreenMode() const { return mInFullScreenMode; }
void PauseCompositor();
void ResumeCompositor();
protected:
virtual ~nsCocoaWindow();

View File

@ -34,8 +34,6 @@
#include "nsIScreenManager.h"
#include "nsIWidgetListener.h"
#include "VibrancyManager.h"
#include "nsPresContext.h"
#include "nsDocShell.h"
#include "gfxPlatform.h"
#include "qcms.h"
@ -46,7 +44,6 @@
#include "mozilla/StaticPrefs_gfx.h"
#include "mozilla/StaticPrefs_widget.h"
#include "mozilla/PresShell.h"
#include "mozilla/layers/CompositorBridgeChild.h"
#include <algorithm>
namespace mozilla {
@ -2093,12 +2090,6 @@ void nsCocoaWindow::DispatchOcclusionEvent() {
if (mWidgetListener) {
mWidgetListener->OcclusionStateChanged(mIsFullyOccluded);
}
if (mIsFullyOccluded) {
PauseCompositor();
} else {
ResumeCompositor();
}
}
void nsCocoaWindow::ReportSizeEvent() {
@ -2114,72 +2105,6 @@ void nsCocoaWindow::ReportSizeEvent() {
NS_OBJC_END_TRY_ABORT_BLOCK;
}
void nsCocoaWindow::PauseCompositor() {
nsIWidget* mainChildView = static_cast<nsIWidget*>([[mWindow mainChildView] widget]);
if (!mainChildView) {
return;
}
CompositorBridgeChild* remoteRenderer = mainChildView->GetRemoteRenderer();
if (!remoteRenderer) {
return;
}
remoteRenderer->SendPause();
// Now that the compositor has paused, we also try to mark the browser window
// docshell inactive to stop any animations. This does not affect docshells
// for browsers in other processes, but browser UI code should be managing
// their active state appropriately.
if (!mWidgetListener) {
return;
}
PresShell* presShell = mWidgetListener->GetPresShell();
if (!presShell) {
return;
}
nsPresContext* presContext = presShell->GetPresContext();
if (!presContext) {
return;
}
nsDocShell* docShell = presContext->GetDocShell();
if (!docShell) {
return;
}
docShell->SetIsActive(false);
}
void nsCocoaWindow::ResumeCompositor() {
nsIWidget* mainChildView = static_cast<nsIWidget*>([[mWindow mainChildView] widget]);
if (!mainChildView) {
return;
}
CompositorBridgeChild* remoteRenderer = mainChildView->GetRemoteRenderer();
if (!remoteRenderer) {
return;
}
remoteRenderer->SendResume();
// Now that the compositor has resumed, we also try to mark the browser window
// docshell active to restart any animations. This does not affect docshells
// for browsers in other processes, but browser UI code should be managing
// their active state appropriately.
if (!mWidgetListener) {
return;
}
PresShell* presShell = mWidgetListener->GetPresShell();
if (!presShell) {
return;
}
nsPresContext* presContext = presShell->GetPresContext();
if (!presContext) {
return;
}
nsDocShell* docShell = presContext->GetDocShell();
if (!docShell) {
return;
}
docShell->SetIsActive(true);
}
void nsCocoaWindow::SetMenuBar(nsMenuBarX* aMenuBar) {
if (mMenuBar) mMenuBar->SetParent(nullptr);
if (!mWindow) {