Bug 1475769 - Bail out from nsRefreshDriver::Tick before updating mMostRecentRefresh when the refresh driver is waiting for paint. r=mattwoodrow

Before this patch, there is a race condition that the refresh driver updates
the most recent refresh time but animations corresponding to the refresh driver
don't update their internal state, that causes the inconsistency that such
animations are regarded as finished on the most recent time whereas their
internal states represent the animations are still in active.  This is the one
of the cause of bug 1466010, i.e. the display item corresponding to the
animation is going to be rebuilt without calling MarkNeedsDisplayItemRebuild.

MozReview-Commit-ID: 9adzDV9E3ka

--HG--
extra : rebase_source : 7120e9f462309d1c4efe995ef64aeead9e29ff8f
This commit is contained in:
Hiroyuki Ikezoe 2018-07-15 20:19:29 +09:00
Родитель 9abd8411b1
Коммит 9f85c749a3
2 изменённых файлов: 8 добавлений и 11 удалений

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

@ -1133,9 +1133,8 @@ nsRefreshDriver::nsRefreshDriver(nsPresContext* aPresContext)
"Need a pres context to tell us to call Disconnect() later "
"and decrement sRefreshDriverCount.");
mMostRecentRefresh = TimeStamp::Now();
mMostRecentTick = mMostRecentRefresh;
mNextThrottledFrameRequestTick = mMostRecentTick;
mNextRecomputeVisibilityTick = mMostRecentTick;
mNextThrottledFrameRequestTick = mMostRecentRefresh;
mNextRecomputeVisibilityTick = mMostRecentRefresh;
++sRefreshDriverCount;
}
@ -1788,17 +1787,16 @@ nsRefreshDriver::Tick(TimeStamp aNowTime)
return;
}
TimeStamp previousRefresh = mMostRecentRefresh;
mMostRecentRefresh = aNowTime;
if (IsWaitingForPaint(aNowTime)) {
// We're currently suspended waiting for earlier Tick's to
// be completed (on the Compositor). Mark that we missed the paint
// and keep waiting.
return;
}
mMostRecentTick = aNowTime;
TimeStamp previousRefresh = mMostRecentRefresh;
mMostRecentRefresh = aNowTime;
if (mRootRefresh) {
mRootRefresh->RemoveRefreshObserver(this, FlushType::Style);
mRootRefresh = nullptr;
@ -2240,10 +2238,10 @@ nsRefreshDriver::IsWaitingForPaint(mozilla::TimeStamp aTime)
}
if (mWaitingForTransaction) {
if (mSkippedPaints && aTime > (mMostRecentTick + TimeDuration::FromMilliseconds(mWarningThreshold * 1000))) {
if (mSkippedPaints && aTime > (mMostRecentRefresh + TimeDuration::FromMilliseconds(mWarningThreshold * 1000))) {
// XXX - Bug 1303369 - too many false positives.
//gfxCriticalNote << "Refresh driver waiting for the compositor for "
// << (aTime - mMostRecentTick).ToSeconds()
// << (aTime - mMostRecentRefresh).ToSeconds()
// << " seconds.";
mWarningThreshold *= 2;
}

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

@ -513,7 +513,6 @@ private:
// The number is doubled every time the threshold is hit.
uint64_t mWarningThreshold;
mozilla::TimeStamp mMostRecentRefresh;
mozilla::TimeStamp mMostRecentTick;
mozilla::TimeStamp mTickStart;
mozilla::TimeStamp mNextThrottledFrameRequestTick;
mozilla::TimeStamp mNextRecomputeVisibilityTick;