summaryrefslogtreecommitdiff
path: root/Userland/Libraries/LibWeb/DOM/MutationObserver.h
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2022-08-08 14:12:01 +0200
committerAndreas Kling <kling@serenityos.org>2022-09-06 00:27:09 +0200
commit8cda70c892c029478e9b87c909b752e000050b38 (patch)
tree6b0686ffeb8c79cf17887cd252bde228b49ab2fb /Userland/Libraries/LibWeb/DOM/MutationObserver.h
parent967a3e5a45af23f7922cffab9d77c0870ecbf3f2 (diff)
downloadserenity-8cda70c892c029478e9b87c909b752e000050b38.zip
LibWeb: Move event listeners, handlers and callbacks to the GC heap
This patch moves the following things to being GC-allocated: - Bindings::CallbackType - HTML::EventHandler - DOM::IDLEventListener - DOM::DOMEventListener - DOM::NodeFilter Note that we only use PlatformObject for things that might be exposed to web content. Anything that is only used internally inherits directly from JS::Cell instead, making them a bit more lightweight.
Diffstat (limited to 'Userland/Libraries/LibWeb/DOM/MutationObserver.h')
-rw-r--r--Userland/Libraries/LibWeb/DOM/MutationObserver.h10
1 files changed, 5 insertions, 5 deletions
diff --git a/Userland/Libraries/LibWeb/DOM/MutationObserver.h b/Userland/Libraries/LibWeb/DOM/MutationObserver.h
index e7dcf942ee..961220fda6 100644
--- a/Userland/Libraries/LibWeb/DOM/MutationObserver.h
+++ b/Userland/Libraries/LibWeb/DOM/MutationObserver.h
@@ -34,9 +34,9 @@ class MutationObserver final
public:
using WrapperType = Bindings::MutationObserverWrapper;
- static NonnullRefPtr<MutationObserver> create_with_global_object(Bindings::WindowObject& window_object, Bindings::CallbackType callback)
+ static NonnullRefPtr<MutationObserver> create_with_global_object(Bindings::WindowObject& window_object, Bindings::CallbackType* callback)
{
- return adopt_ref(*new MutationObserver(window_object, move(callback)));
+ return adopt_ref(*new MutationObserver(window_object, JS::make_handle(callback)));
}
virtual ~MutationObserver() override = default;
@@ -48,7 +48,7 @@ public:
Vector<WeakPtr<Node>>& node_list() { return m_node_list; }
Vector<WeakPtr<Node>> const& node_list() const { return m_node_list; }
- Bindings::CallbackType& callback() { return m_callback; }
+ Bindings::CallbackType& callback() { return *m_callback; }
void enqueue_record(Badge<Node>, NonnullRefPtr<MutationRecord> mutation_record)
{
@@ -56,10 +56,10 @@ public:
}
private:
- MutationObserver(Bindings::WindowObject& window_object, Bindings::CallbackType callback);
+ MutationObserver(Bindings::WindowObject& window_object, JS::Handle<Bindings::CallbackType> callback);
// https://dom.spec.whatwg.org/#concept-mo-callback
- Bindings::CallbackType m_callback;
+ JS::Handle<Bindings::CallbackType> m_callback;
// https://dom.spec.whatwg.org/#mutationobserver-node-list
Vector<WeakPtr<Node>> m_node_list;