mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-07-29 12:19:54 +00:00
LibWeb: Only take runnable tasks from the HTML task queue
We were previously willing to execute tasks before they had become runnable.
This commit is contained in:
parent
6283c098ad
commit
bbfde63f79
Notes:
sideshowbarker
2024-07-18 03:08:55 +09:00
Author: https://github.com/awesomekling
Commit: bbfde63f79
5 changed files with 23 additions and 6 deletions
|
@ -19,20 +19,20 @@ public:
|
|||
bool is_empty() const { return m_tasks.is_empty(); }
|
||||
|
||||
void add(NonnullOwnPtr<HTML::Task>);
|
||||
OwnPtr<HTML::Task> take_first_runnable() { return m_tasks.dequeue(); }
|
||||
OwnPtr<HTML::Task> take_first_runnable();
|
||||
|
||||
void enqueue(NonnullOwnPtr<HTML::Task> task) { add(move(task)); }
|
||||
OwnPtr<HTML::Task> dequeue()
|
||||
{
|
||||
if (m_tasks.is_empty())
|
||||
return {};
|
||||
return m_tasks.dequeue();
|
||||
return m_tasks.take_first();
|
||||
}
|
||||
|
||||
private:
|
||||
HTML::EventLoop& m_event_loop;
|
||||
|
||||
Queue<NonnullOwnPtr<HTML::Task>> m_tasks;
|
||||
Vector<NonnullOwnPtr<HTML::Task>> m_tasks;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue