mirror of
https://github.com/RGBCube/serenity
synced 2025-07-24 15:47:42 +00:00
LibWeb: Let HTML::EventLoop know its type
There are three types of event loop: window, worker and worklet. For now, we only have window event loops.
This commit is contained in:
parent
0554d96a2e
commit
7bcde2bcfb
1 changed files with 13 additions and 0 deletions
|
@ -13,9 +13,20 @@ namespace Web::HTML {
|
||||||
|
|
||||||
class EventLoop {
|
class EventLoop {
|
||||||
public:
|
public:
|
||||||
|
enum class Type {
|
||||||
|
// https://html.spec.whatwg.org/multipage/webappapis.html#window-event-loop
|
||||||
|
Window,
|
||||||
|
// https://html.spec.whatwg.org/multipage/webappapis.html#worker-event-loop
|
||||||
|
Worker,
|
||||||
|
// https://html.spec.whatwg.org/multipage/webappapis.html#worklet-event-loop
|
||||||
|
Worklet,
|
||||||
|
};
|
||||||
|
|
||||||
EventLoop();
|
EventLoop();
|
||||||
~EventLoop();
|
~EventLoop();
|
||||||
|
|
||||||
|
Type type() const { return m_type; }
|
||||||
|
|
||||||
TaskQueue& task_queue() { return m_task_queue; }
|
TaskQueue& task_queue() { return m_task_queue; }
|
||||||
TaskQueue const& task_queue() const { return m_task_queue; }
|
TaskQueue const& task_queue() const { return m_task_queue; }
|
||||||
|
|
||||||
|
@ -25,6 +36,8 @@ public:
|
||||||
Task const* currently_running_task() const { return m_currently_running_task; }
|
Task const* currently_running_task() const { return m_currently_running_task; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Type m_type { Type::Window };
|
||||||
|
|
||||||
TaskQueue m_task_queue;
|
TaskQueue m_task_queue;
|
||||||
|
|
||||||
// https://html.spec.whatwg.org/multipage/webappapis.html#currently-running-task
|
// https://html.spec.whatwg.org/multipage/webappapis.html#currently-running-task
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue