mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 00:25:12 +00:00
LibWeb: Make Agent's MutationObserver list weak
Before this change, Agent held on to all of the live MutationObserver objects via GC::Root. This prevented them from ever getting garbage-collected. Instead of roots, we now use a simple IntrusiveList and remove them from it in the finalizer for MutationObserver. This fixes a massive GC leak on Speedometer.
This commit is contained in:
committed by
Andreas Kling
parent
f1801fb1d2
commit
53c9c6f3ee
@@ -53,6 +53,7 @@ private:
|
||||
|
||||
virtual void initialize(JS::Realm&) override;
|
||||
virtual void visit_edges(Cell::Visitor&) override;
|
||||
virtual void finalize() override;
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-mo-callback
|
||||
GC::Ptr<WebIDL::CallbackType> m_callback;
|
||||
@@ -64,6 +65,11 @@ private:
|
||||
|
||||
// https://dom.spec.whatwg.org/#concept-mo-queue
|
||||
Vector<GC::Ref<MutationRecord>> m_record_queue;
|
||||
|
||||
IntrusiveListNode<MutationObserver> m_list_node;
|
||||
|
||||
public:
|
||||
using List = IntrusiveList<&MutationObserver::m_list_node>;
|
||||
};
|
||||
|
||||
// https://dom.spec.whatwg.org/#registered-observer
|
||||
|
||||
Reference in New Issue
Block a user