mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-05-03 13:02:09 +02:00
LibWeb: Add a flag to pause an HTML event loop's execution
This will be used to unblock the WebContent IPC event loop while waiting for a dialog response.
This commit is contained in:
committed by
Linus Groh
parent
894bddf62c
commit
4b8729aea6
Notes:
sideshowbarker
2024-07-17 04:25:33 +09:00
Author: https://github.com/trflynn89 Commit: https://github.com/SerenityOS/serenity/commit/4b8729aea6 Pull-request: https://github.com/SerenityOS/serenity/pull/16091 Reviewed-by: https://github.com/linusg
@@ -24,6 +24,9 @@ void TaskQueue::add(NonnullOwnPtr<Task> task)
|
||||
|
||||
OwnPtr<Task> TaskQueue::take_first_runnable()
|
||||
{
|
||||
if (m_event_loop.execution_paused())
|
||||
return nullptr;
|
||||
|
||||
for (size_t i = 0; i < m_tasks.size(); ++i) {
|
||||
if (m_tasks[i]->is_runnable())
|
||||
return m_tasks.take(i);
|
||||
@@ -33,6 +36,9 @@ OwnPtr<Task> TaskQueue::take_first_runnable()
|
||||
|
||||
bool TaskQueue::has_runnable_tasks() const
|
||||
{
|
||||
if (m_event_loop.execution_paused())
|
||||
return false;
|
||||
|
||||
for (auto& task : m_tasks) {
|
||||
if (task->is_runnable())
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user