1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:58:11 +00:00

LibWeb: Only auto-reschedule HTML::EventLoop when there are runnables

HTML::EventLoop tries to reschedule itself when there are more tasks in
any of its queues, but let's not do it if none of them are runnable.
This commit is contained in:
Andreas Kling 2021-10-03 18:23:25 +02:00
parent 38a732a202
commit 478b36c37b
3 changed files with 12 additions and 1 deletions

View file

@ -200,7 +200,7 @@ void EventLoop::process()
// FIXME: 2. If there are no tasks in the event loop's task queues and the WorkerGlobalScope object's closing flag is true, then destroy the event loop, aborting these steps, resuming the run a worker steps described in the Web workers section below.
// If there are tasks in the queue, schedule a new round of processing. :^)
if (!m_task_queue.is_empty() || !m_microtask_queue.is_empty())
if (m_task_queue.has_runnable_tasks() || !m_microtask_queue.is_empty())
schedule();
}