Bug 1912570. Record/warn in reftests/crashtests if compositor is paused or window is fully occluded. r=jwatt

Differential Revision: https://phabricator.services.mozilla.com/D219005
This commit is contained in:
Timothy Nikkel 2024-08-23 09:39:55 +00:00
Родитель 867f400a15
Коммит 7a3f01bbd3
4 изменённых файлов: 60 добавлений и 0 удалений

Просмотреть файл

@ -1708,6 +1708,27 @@ nsDOMWindowUtils::GetIsMozAfterPaintPending(bool* aResult) {
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetIsWindowFullyOccluded(bool* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = false;
if (nsIWidget* widget = GetWidget()) {
*aResult = widget->IsFullyOccluded();
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetIsCompositorPaused(bool* aResult) {
NS_ENSURE_ARG_POINTER(aResult);
*aResult = false;
CompositorBridgeChild* cbc = GetCompositorBridge();
if (cbc) {
*aResult = cbc->IsPaused();
}
return NS_OK;
}
NS_IMETHODIMP
nsDOMWindowUtils::GetIsInputTaskManagerSuspended(bool* aResult) {
*aResult = InputTaskManager::Get()->IsSuspended();

Просмотреть файл

@ -1014,6 +1014,10 @@ interface nsIDOMWindowUtils : nsISupports {
*/
readonly attribute boolean isMozAfterPaintPending;
readonly attribute boolean isWindowFullyOccluded;
readonly attribute boolean isCompositorPaused;
/**
* Returns true if the InputTaskManager is suspended.
*/

Просмотреть файл

@ -886,6 +886,16 @@ async function StartCurrentURI(aURLTargetType) {
}
}
if (g.windowUtils.isWindowFullyOccluded || g.windowUtils.isCompositorPaused) {
logger.warning(
"g.windowUtils.isWindowFullyOccluded " +
g.windowUtils.isWindowFullyOccluded
);
logger.warning(
"g.windowUtils.isCompositorPaused " + g.windowUtils.isCompositorPaused
);
}
if (
!prefSettings.length &&
g.uriCanvases[g.currentURL] &&
@ -912,6 +922,20 @@ async function StartCurrentURI(aURLTargetType) {
"%)\n"
);
TestBuffer("START " + g.currentURL);
if (
g.windowUtils.isWindowFullyOccluded ||
g.windowUtils.isCompositorPaused
) {
TestBuffer(
"g.windowUtils.isWindowFullyOccluded " +
g.windowUtils.isWindowFullyOccluded
);
TestBuffer(
"g.windowUtils.isCompositorPaused " + g.windowUtils.isCompositorPaused
);
}
await updateBrowserRemotenessByURL(g.browser, g.currentURL);
if (prefsRequireRefresh) {
@ -1121,6 +1145,16 @@ async function UpdateWholeCurrentCanvasForInvalidation() {
function RecordResult(testRunTime, errorMsg, typeSpecificResults) {
TestBuffer("RecordResult fired");
if (g.windowUtils.isWindowFullyOccluded || g.windowUtils.isCompositorPaused) {
TestBuffer(
"g.windowUtils.isWindowFullyOccluded " +
g.windowUtils.isWindowFullyOccluded
);
TestBuffer(
"g.windowUtils.isCompositorPaused " + g.windowUtils.isCompositorPaused
);
}
// Keep track of which test was slowest, and how long it took.
if (testRunTime > g.slowestTestTime) {
g.slowestTestTime = testRunTime;

Просмотреть файл

@ -706,6 +706,7 @@ class nsBaseWidget : public nsIWidget, public nsSupportsWeakReference {
bool mUseAttachedEvents;
bool mIMEHasFocus;
bool mIMEHasQuit;
// if the window is fully occluded (rendering may be paused in response)
bool mIsFullyOccluded;
bool mNeedFastSnaphot;
// This flag is only used when APZ is off. It indicates that the current pan