Backed out changeset 9f0d0ce9c0df (bug 1770658) for causing dt failures on browser_aboutdebugging_devtoolstoolbox_reload.js. CLOSED TREE

This commit is contained in:
Iulian Moraru 2023-02-25 14:30:52 +02:00
parent 09f8e5b108
commit 325021f37a

View file

@ -800,24 +800,22 @@ nsresult TimerThread::AddTimer(nsTimerImpl* aTimer,
return rv; return rv;
} }
// Fire this timer immediately (and skip adding it to our timer list) if the // Awaken the timer thread if:
// delay is 0, which are meant to be run as soon as possible. This has less // - This timer wants to fire *before* the Timer Thread is scheduled to wake
// overhead than waking up the timer thread and handling it there while still // up. We don't track this directly but we know that we will have attempted
// maintaining timer ordering and response time. // to wake up at the timeout for the first time in our list (if it exists),
const bool fireImmediately = aTimer->mDelay.IsZero(); // so we can use that. Note: This is true even if the timer has since been
if (fireImmediately) { // canceled.
RefPtr<nsTimerImpl> timerRef(aTimer); // AND/OR
LogTimerEvent::Run run(aTimer); // - The delay is 0, which is usually meant to be run as soon as possible.
PostTimerEvent(timerRef.forget()); // Note: Even if the thread is scheduled to wake up now/soon, on some
} else { // systems there could be a significant delay compared to notifying, which
// Awaken the timer thread if this timer wants to fire *before* the Timer // is almost immediate; and some users of 0-delay depend on it being this
// Thread is scheduled to wake up. We don't track this directly but we know // fast!
// that we will have attempted to wake up at the timeout for the first time
// in our list (if it exists), so we can use that. Note: This is true even
// if the timer has since been canceled.
const bool wakeUpTimerThread = const bool wakeUpTimerThread =
mWaiting && mWaiting &&
(mTimers.Length() == 0 || aTimer->mTimeout < mTimers[0].Timeout()); (mTimers.Length() == 0 || aTimer->mTimeout < mTimers[0].Timeout() ||
aTimer->mDelay.IsZero());
// Add the timer to our list. // Add the timer to our list.
if (!AddTimerInternal(aTimer)) { if (!AddTimerInternal(aTimer)) {
@ -828,7 +826,6 @@ nsresult TimerThread::AddTimer(nsTimerImpl* aTimer,
mNotified = true; mNotified = true;
mMonitor.Notify(); mMonitor.Notify();
} }
}
if (profiler_thread_is_being_profiled_for_markers(mProfilerThreadId)) { if (profiler_thread_is_being_profiled_for_markers(mProfilerThreadId)) {
nsAutoCString name; nsAutoCString name;