Bug 1521786 - Keep RefreshDriver ticking before first contentful paint, r=farre

--HG--
extra : rebase_source : 51e9d056b7ec7874e76a746740de5e2bb965f4e3
This commit is contained in:
Olli Pettay 2019-01-29 23:57:26 +02:00
Родитель f658ec7c25
Коммит a3dd58ad75
2 изменённых файлов: 18 добавлений и 1 удалений

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

@ -1773,7 +1773,23 @@ void nsRefreshDriver::Tick(VsyncId aId, TimeStamp aNowTime) {
// situation we don't want to thrash our timer. So instead we
// wait until we get a Notify() call when we have no observers
// before stopping the timer.
// On top level content pages keep the timer running initially so that we
// paint the page soon enough.
if (!XRE_IsContentProcess() || !presShell || mTestControllingRefreshes ||
!mPresContext->Document()->IsTopLevelContentDocument() || mThrottled ||
gfxPlatform::IsInLayoutAsapMode()) {
StopTimer();
} else if (mPresContext->Document()->GetReadyStateEnum() <
Document::READYSTATE_COMPLETE &&
!mPresContext->HadContentfulPaint()) {
if (mInitialTimerRunningLimit.IsNull()) {
mInitialTimerRunningLimit =
TimeStamp::Now() + TimeDuration::FromSeconds(4.0f);
// Don't let the timer to run forever, so limit to 4s for now.
} else if (mInitialTimerRunningLimit < TimeStamp::Now()) {
StopTimer();
}
}
return;
}

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

@ -539,6 +539,7 @@ class nsRefreshDriver final : public mozilla::layers::TransactionIdAllocator,
mozilla::TimeStamp mTickVsyncTime;
mozilla::TimeStamp mNextThrottledFrameRequestTick;
mozilla::TimeStamp mNextRecomputeVisibilityTick;
mozilla::TimeStamp mInitialTimerRunningLimit;
// separate arrays for each flush type we support
ObserverArray mObservers[4];