diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-09 00:27:06 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-09 02:18:31 +0200 |
commit | e0c7f8dafa5c5f6168c41ccf2986cffec86bf038 (patch) | |
tree | 709ee7b4c90f1aa2151f2e5dd71ae208b9c2980f /Userland/Libraries/LibWeb/HTML/EventLoop | |
parent | 7bcde2bcfb7c993d81cb8cd7b9e0f40fc821d61c (diff) | |
download | serenity-e0c7f8dafa5c5f6168c41ccf2986cffec86bf038.zip |
LibWeb: Give HTML::EventLoop a pointer to the JS::VM
This will be required for event loop processing.
Diffstat (limited to 'Userland/Libraries/LibWeb/HTML/EventLoop')
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp | 6 | ||||
-rw-r--r-- | Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h | 7 |
2 files changed, 13 insertions, 0 deletions
diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp index 72e808ee76..ed74909e97 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.cpp @@ -18,6 +18,12 @@ EventLoop::~EventLoop() { } +void EventLoop::set_vm(JS::VM& vm) +{ + VERIFY(!m_vm); + m_vm = &vm; +} + EventLoop& main_thread_event_loop() { return static_cast<Bindings::WebEngineCustomData*>(Bindings::main_thread_vm().custom_data())->event_loop; diff --git a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h index a22178b1c8..26ee3ebdd7 100644 --- a/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h +++ b/Userland/Libraries/LibWeb/HTML/EventLoop/EventLoop.h @@ -35,6 +35,11 @@ public: Task const* currently_running_task() const { return m_currently_running_task; } + JS::VM& vm() { return *m_vm; } + JS::VM const& vm() const { return *m_vm; } + + void set_vm(JS::VM&); + private: Type m_type { Type::Window }; @@ -42,6 +47,8 @@ private: // https://html.spec.whatwg.org/multipage/webappapis.html#currently-running-task Task* m_currently_running_task { nullptr }; + + JS::VM* m_vm { nullptr }; }; EventLoop& main_thread_event_loop(); |