Bug 1787974 - Fixed small logic change in FindNextFireTimeForCurrentThread(). r=smaug

I also took a stab at documenting the behavior since I found it a bit
difficult to follow.

Differential Revision: https://phabricator.services.mozilla.com/D165120
This commit is contained in:
Justin Link 2023-01-20 17:11:12 +00:00
Родитель 9ca4dc4b49
Коммит e2a49f1133
2 изменённых файлов: 8 добавлений и 4 удалений

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

@ -779,12 +779,12 @@ TimeStamp TimerThread::FindNextFireTimeForCurrentThread(TimeStamp aDefault,
AUTO_TIMERS_STATS(TimerThread_FindNextFireTimeForCurrentThread);
for (const Entry& entry : mTimers) {
if (entry.Timeout() >= aDefault) {
return aDefault;
}
const nsTimerImpl* timer = entry.Value();
if (timer) {
if (entry.Timeout() > aDefault) {
return aDefault;
}
// Don't yield to timers created with the *_LOW_PRIORITY type.
if (!timer->IsLowPriority()) {
bool isOnCurrentThread = false;

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

@ -47,6 +47,10 @@ class TimerThread final : public mozilla::Runnable, public nsIObserver {
MOZ_REQUIRES(aTimer->mMutex);
nsresult RemoveTimer(nsTimerImpl* aTimer, const MutexAutoLock& aProofOfLock)
MOZ_REQUIRES(aTimer->mMutex);
// Considering only the first 'aSearchBound' timers (in firing order), returns
// the timeout of the first non-low-priority timer, on the current thread,
// that will fire before 'aDefault'. If no such timer exists, 'aDefault' is
// returned.
TimeStamp FindNextFireTimeForCurrentThread(TimeStamp aDefault,
uint32_t aSearchBound);