diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-09 00:21:57 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-09 02:18:31 +0200 |
commit | 7bcde2bcfb7c993d81cb8cd7b9e0f40fc821d61c (patch) | |
tree | 2634eb3aa1c12c177ca72b72c71f25fbd91d01da /Userland | |
parent | 0554d96a2e1d845f254829cf2291c7d61280bca6 (diff) | |
download | serenity-7bcde2bcfb7c993d81cb8cd7b9e0f40fc821d61c.zip |
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.
Diffstat (limited to 'Userland')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h index 4b67df201d..a22178b1c8 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h @@ -13,9 +13,20 @@ namespace Web::HTML { class EventLoop { 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(); + Type type() const { return m_type; } + TaskQueue& task_queue() { 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; } private: + Type m_type { Type::Window }; + TaskQueue m_task_queue; // https://html.spec.whatwg.org/multipage/webappapis.html#currently-running-task |