mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 10:38:11 +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
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