1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 02:27:43 +00:00

LibWeb+LibJS: Make the EventTarget hierarchy (incl. DOM) GC-allocated

This is a monster patch that turns all EventTargets into GC-allocated
PlatformObjects. Their C++ wrapper classes are removed, and the LibJS
garbage collector is now responsible for their lifetimes.

There's a fair amount of hacks and band-aids in this patch, and we'll
have a lot of cleanup to do after this.
This commit is contained in:
Andreas Kling 2022-08-28 13:42:07 +02:00
parent bb547ce1c4
commit 6f433c8656
445 changed files with 4797 additions and 4268 deletions

View file

@ -11,9 +11,9 @@
#include <LibJS/Forward.h>
#include <LibJS/Runtime/JobCallback.h>
#include <LibJS/Runtime/VM.h>
#include <LibWeb/Bindings/WindowObject.h>
#include <LibWeb/DOM/MutationObserver.h>
#include <LibWeb/HTML/EventLoop/EventLoop.h>
#include <LibWeb/HTML/Window.h>
namespace Web::Bindings {
@ -35,7 +35,7 @@ struct WebEngineCustomData final : public JS::VM::CustomData {
// This object is used as the global object for GC-allocated objects that don't
// belong to a web-facing global object.
JS::Handle<Bindings::WindowObject> internal_window_object;
JS::Handle<HTML::Window> internal_window_object;
};
struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData {
@ -53,8 +53,8 @@ struct WebEngineCustomJobCallbackData final : public JS::JobCallback::CustomData
HTML::ClassicScript* active_script();
JS::VM& main_thread_vm();
Bindings::WindowObject& main_thread_internal_window_object();
HTML::Window& main_thread_internal_window_object();
void queue_mutation_observer_microtask(DOM::Document&);
NonnullOwnPtr<JS::ExecutionContext> create_a_new_javascript_realm(JS::VM&, Function<JS::GlobalObject*(JS::Realm&)> create_global_object, Function<JS::GlobalObject*(JS::Realm&)> create_global_this_value);
NonnullOwnPtr<JS::ExecutionContext> create_a_new_javascript_realm(JS::VM&, Function<JS::Object*(JS::Realm&)> create_global_object, Function<JS::Object*(JS::Realm&)> create_global_this_value);
}