Bug 1787974 - Do a linear search in RemoveTimerInternal to stop going through the holder r=smaug

Note that it's about 4 times slower in practice! But this will be balanced in later patches.

Differential Revision: https://phabricator.services.mozilla.com/D164285
This commit is contained in:
Gerald Squelart 2023-01-20 17:11:08 +00:00
parent bfb631bb92
commit fdae1596bd

View File

@ -835,8 +835,14 @@ bool TimerThread::RemoveTimerInternal(nsTimerImpl* aTimer) {
return false;
}
AUTO_TIMERS_STATS(TimerThread_RemoveTimerInternal_in_list);
aTimer->mHolder->Forget(aTimer);
return true;
for (auto& entry : mTimers) {
if (entry->Value() == aTimer) {
entry->Forget(aTimer);
return true;
}
}
MOZ_ASSERT(!aTimer->mHolder, "There is a holder, but timer is not in list!?");
return false;
}
void TimerThread::RemoveLeadingCanceledTimersInternal() {