mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 17:27:35 +00:00
LibJS: Don't use a Handle<Realm> in FinalizationRegistry
Instead just treat it like a normal GC cell edge.
This commit is contained in:
parent
63cc2650e3
commit
7fce5f102f
2 changed files with 6 additions and 4 deletions
|
@ -12,7 +12,7 @@ namespace JS {
|
|||
FinalizationRegistry::FinalizationRegistry(Realm& realm, JobCallback cleanup_callback, Object& prototype)
|
||||
: Object(prototype)
|
||||
, WeakContainer(heap())
|
||||
, m_realm(make_handle(realm))
|
||||
, m_realm(realm)
|
||||
, m_cleanup_callback(move(cleanup_callback))
|
||||
{
|
||||
}
|
||||
|
@ -82,6 +82,7 @@ ThrowCompletionOr<void> FinalizationRegistry::cleanup(Optional<JobCallback> call
|
|||
void FinalizationRegistry::visit_edges(Cell::Visitor& visitor)
|
||||
{
|
||||
Base::visit_edges(visitor);
|
||||
visitor.visit(m_realm.ptr());
|
||||
for (auto& record : m_records) {
|
||||
visitor.visit(record.held_value);
|
||||
visitor.visit(record.unregister_token);
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/JobCallback.h>
|
||||
|
@ -30,8 +31,8 @@ public:
|
|||
|
||||
virtual void remove_dead_cells(Badge<Heap>) override;
|
||||
|
||||
Realm& realm() { return *m_realm.cell(); }
|
||||
Realm const& realm() const { return *m_realm.cell(); }
|
||||
Realm& realm() { return *m_realm; }
|
||||
Realm const& realm() const { return *m_realm; }
|
||||
|
||||
JobCallback& cleanup_callback() { return m_cleanup_callback; }
|
||||
JobCallback const& cleanup_callback() const { return m_cleanup_callback; }
|
||||
|
@ -41,7 +42,7 @@ private:
|
|||
|
||||
virtual void visit_edges(Visitor& visitor) override;
|
||||
|
||||
Handle<Realm> m_realm;
|
||||
NonnullGCPtr<Realm> m_realm;
|
||||
JobCallback m_cleanup_callback;
|
||||
|
||||
struct FinalizationRecord {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue