mirror of
https://github.com/LadybirdBrowser/ladybird
synced 2026-04-27 02:05:07 +02:00
LibWeb: Let HTML::EventLoop keep track of live DOM::Document objects
This will be used by the event loop processing model.
This commit is contained in:
Notes:
sideshowbarker
2024-07-18 03:08:50 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/ae71e5f99b5
@@ -7,6 +7,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <AK/Function.h>
|
||||
#include <AK/WeakPtr.h>
|
||||
#include <LibCore/Forward.h>
|
||||
#include <LibJS/Forward.h>
|
||||
#include <LibWeb/HTML/EventLoop/TaskQueue.h>
|
||||
@@ -49,6 +50,11 @@ public:
|
||||
|
||||
void perform_a_microtask_checkpoint();
|
||||
|
||||
void register_document(Badge<DOM::Document>, DOM::Document&);
|
||||
void unregister_document(Badge<DOM::Document>, DOM::Document&);
|
||||
|
||||
NonnullRefPtrVector<DOM::Document> documents_in_this_event_loop() const;
|
||||
|
||||
private:
|
||||
Type m_type { Type::Window };
|
||||
|
||||
@@ -64,6 +70,8 @@ private:
|
||||
|
||||
// https://html.spec.whatwg.org/#performing-a-microtask-checkpoint
|
||||
bool m_performing_a_microtask_checkpoint { false };
|
||||
|
||||
Vector<WeakPtr<DOM::Document>> m_documents;
|
||||
};
|
||||
|
||||
EventLoop& main_thread_event_loop();
|
||||
|
||||
Reference in New Issue
Block a user