mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-04 14:58:37 +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
|
|
@ -1021,11 +1021,20 @@ nsThread::GetIdleEvent(nsIRunnable** aEvent, MutexAutoLock& aProofOfLock)
|
|||
MOZ_ASSERT(PR_GetCurrentThread() == mThread);
|
||||
MOZ_ASSERT(aEvent);
|
||||
|
||||
if (!mIdleEvents.HasPendingEvent(aProofOfLock)) {
|
||||
aEvent = nullptr;
|
||||
return;
|
||||
}
|
||||
|
||||
TimeStamp idleDeadline;
|
||||
{
|
||||
{
|
||||
// Releasing the lock temporarily since getting the idle period
|
||||
// might need to lock the timer thread. Unlocking here might make
|
||||
// us receive an event on the main queue, but we've committed to
|
||||
// run an idle event anyhow.
|
||||
MutexAutoUnlock unlock(mLock);
|
||||
mIdlePeriod->GetIdlePeriodHint(&idleDeadline);
|
||||
}
|
||||
}
|
||||
|
||||
if (!idleDeadline || idleDeadline < TimeStamp::Now()) {
|
||||
aEvent = nullptr;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue