mirror of
https://github.com/fergalmoran/ladybird.git
synced 2025-12-25 02:40:49 +00:00
LibWeb: Add a bare-bones HTML event loop with a task queue
This patch attaches a HTML::EventLoop to the main thread JS::VM used for JavaScript bindings in the web engine. The goal here is to model the various task scheduling mechanisms of the HTML specification.
This commit is contained in:
27
Userland/Libraries/LibWeb/HTML/EventLoop/Task.cpp
Normal file
27
Userland/Libraries/LibWeb/HTML/EventLoop/Task.cpp
Normal file
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
||||
*
|
||||
* SPDX-License-Identifier: BSD-2-Clause
|
||||
*/
|
||||
|
||||
#include <LibWeb/DOM/Document.h>
|
||||
#include <LibWeb/HTML/EventLoop/Task.h>
|
||||
|
||||
namespace Web::HTML {
|
||||
|
||||
Task::Task(DOM::Document* document, Function<void()> steps)
|
||||
: m_steps(move(steps))
|
||||
, m_document(document)
|
||||
{
|
||||
}
|
||||
|
||||
Task::~Task()
|
||||
{
|
||||
}
|
||||
|
||||
void Task::execute()
|
||||
{
|
||||
m_steps();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user