Bug 1759581 - Use different timeForOutsideTick variables in the different paths. r=smaug

Differential Revision: https://phabricator.services.mozilla.com/D141014
This commit is contained in:
Markus Stange 2022-04-20 16:16:39 +00:00
Родитель c2d0f30e77
Коммит 7160d718e1
1 изменённых файлов: 8 добавлений и 5 удалений

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

@ -765,7 +765,6 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
// period).
double rate = mVsyncRefreshDriverTimer->GetTimerRate().ToMilliseconds();
TimeDuration gracePeriod = TimeDuration::FromMilliseconds(rate / 100.0f);
TimeDuration timeForOutsideTick = gracePeriod;
if (shouldGiveNonVSyncTasksMoreTime) {
if (!mLastTickEnd.IsNull() && XRE_IsContentProcess() &&
@ -776,7 +775,7 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
// In case normal tasks are doing lots of work, we still want to paint
// every now and then, so only at maximum 4 * rate of work is counted
// here.
timeForOutsideTick = tickStart - mLastTickEnd;
TimeDuration timeForOutsideTick = tickStart - mLastTickEnd;
TimeDuration maxOutsideTick =
TimeDuration::FromMilliseconds(4 * rate);
if (timeForOutsideTick > maxOutsideTick) {
@ -789,11 +788,15 @@ class VsyncRefreshDriverTimer : public RefreshDriverTimer {
// a grace period.
timeForOutsideTick = timeForOutsideTick - gracePeriod;
}
mSuspendVsyncPriorityTicksUntil = aVsyncTimestamp +
timeForOutsideTick +
(tickEnd - mostRecentTickStart);
} else {
mSuspendVsyncPriorityTicksUntil =
aVsyncTimestamp + gracePeriod + (tickEnd - mostRecentTickStart);
}
mSuspendVsyncPriorityTicksUntil = aVsyncTimestamp + timeForOutsideTick +
(tickEnd - mostRecentTickStart);
} else {
mSuspendVsyncPriorityTicksUntil = aVsyncTimestamp + timeForOutsideTick;
mSuspendVsyncPriorityTicksUntil = aVsyncTimestamp + gracePeriod;
}
mLastIdleTaskCount =