mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-05 15:28:39 +09:00
1311425 - Make requestIdleCallback aware of timeouts.
Prepare for handling several sources of idleness. Make idle callbacks aware of nsITimers. Add pref for how far into the timer queue. 1311425 - Avoid expiration timers when scheduling idle runnables. review comment fix to ensure low priority timers aren't taken into account when calling NS_GetTimerDeadlineHintOnCurrentThread.
This commit is contained in:
parent
464b839bbd
commit
5499c5f9a3
12 changed files with 188 additions and 60 deletions
|
|
@ -223,12 +223,12 @@ public:
|
|||
return mLastFireSkipped;
|
||||
}
|
||||
|
||||
Maybe<TimeStamp> GetIdleDeadlineHint()
|
||||
TimeStamp GetIdleDeadlineHint(TimeStamp aDefault)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (LastTickSkippedAnyPaints()) {
|
||||
return Some(TimeStamp());
|
||||
return TimeStamp::Now();
|
||||
}
|
||||
|
||||
TimeStamp mostRecentRefresh = MostRecentRefresh();
|
||||
|
|
@ -238,11 +238,12 @@ public:
|
|||
if (idleEnd +
|
||||
refreshRate * nsLayoutUtils::QuiescentFramesBeforeIdlePeriod() <
|
||||
TimeStamp::Now()) {
|
||||
return Nothing();
|
||||
return aDefault;
|
||||
}
|
||||
|
||||
return Some(idleEnd - TimeDuration::FromMilliseconds(
|
||||
nsLayoutUtils::IdlePeriodDeadlineLimit()));
|
||||
idleEnd = idleEnd - TimeDuration::FromMilliseconds(
|
||||
nsLayoutUtils::IdlePeriodDeadlineLimit());
|
||||
return idleEnd < aDefault ? idleEnd : aDefault;
|
||||
}
|
||||
|
||||
protected:
|
||||
|
|
@ -2333,13 +2334,14 @@ nsRefreshDriver::CancelPendingEvents(nsIDocument* aDocument)
|
|||
}
|
||||
}
|
||||
|
||||
/* static */ Maybe<TimeStamp>
|
||||
nsRefreshDriver::GetIdleDeadlineHint()
|
||||
/* static */ TimeStamp
|
||||
nsRefreshDriver::GetIdleDeadlineHint(TimeStamp aDefault)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
MOZ_ASSERT(!aDefault.IsNull());
|
||||
|
||||
if (!sRegularRateTimer) {
|
||||
return Nothing();
|
||||
return aDefault;
|
||||
}
|
||||
|
||||
// For computing idleness of refresh drivers we only care about
|
||||
|
|
@ -2348,7 +2350,7 @@ nsRefreshDriver::GetIdleDeadlineHint()
|
|||
// resulting from a tick on the sRegularRateTimer counts as being
|
||||
// busy but tasks resulting from a tick on sThrottledRateTimer
|
||||
// counts as being idle.
|
||||
return sRegularRateTimer->GetIdleDeadlineHint();
|
||||
return sRegularRateTimer->GetIdleDeadlineHint(aDefault);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue