mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 05:39:11 +00:00
LibGC+Everywhere: Factor out a LibGC from LibJS
Resulting in a massive rename across almost everywhere! Alongside the namespace change, we now have the following names: * JS::NonnullGCPtr -> GC::Ref * JS::GCPtr -> GC::Ptr * JS::HeapFunction -> GC::Function * JS::CellImpl -> GC::Cell * JS::Handle -> GC::Root
This commit is contained in:
parent
ce23efc5f6
commit
f87041bf3a
Notes:
github-actions[bot]
2024-11-15 13:50:17 +00:00
Author: https://github.com/shannonbooth
Commit: f87041bf3a
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/2345
1722 changed files with 9939 additions and 9906 deletions
|
@ -7,8 +7,8 @@
|
|||
#pragma once
|
||||
|
||||
#include <AK/SinglyLinkedList.h>
|
||||
#include <LibJS/Heap/GCPtr.h>
|
||||
#include <LibJS/Heap/WeakContainer.h>
|
||||
#include <LibGC/Ptr.h>
|
||||
#include <LibGC/WeakContainer.h>
|
||||
#include <LibJS/Runtime/FunctionObject.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/JobCallback.h>
|
||||
|
@ -19,18 +19,18 @@ namespace JS {
|
|||
|
||||
class FinalizationRegistry final
|
||||
: public Object
|
||||
, public WeakContainer {
|
||||
, public GC::WeakContainer {
|
||||
JS_OBJECT(FinalizationRegistry, Object);
|
||||
JS_DECLARE_ALLOCATOR(FinalizationRegistry);
|
||||
GC_DECLARE_ALLOCATOR(FinalizationRegistry);
|
||||
|
||||
public:
|
||||
virtual ~FinalizationRegistry() override = default;
|
||||
|
||||
void add_finalization_record(Cell& target, Value held_value, Cell* unregister_token);
|
||||
bool remove_by_token(Cell& unregister_token);
|
||||
ThrowCompletionOr<void> cleanup(GCPtr<JobCallback> = {});
|
||||
ThrowCompletionOr<void> cleanup(GC::Ptr<JobCallback> = {});
|
||||
|
||||
virtual void remove_dead_cells(Badge<Heap>) override;
|
||||
virtual void remove_dead_cells(Badge<GC::Heap>) override;
|
||||
|
||||
Realm& realm() { return *m_realm; }
|
||||
Realm const& realm() const { return *m_realm; }
|
||||
|
@ -39,17 +39,17 @@ public:
|
|||
JobCallback const& cleanup_callback() const { return *m_cleanup_callback; }
|
||||
|
||||
private:
|
||||
FinalizationRegistry(Realm&, NonnullGCPtr<JobCallback>, Object& prototype);
|
||||
FinalizationRegistry(Realm&, GC::Ref<JobCallback>, Object& prototype);
|
||||
|
||||
virtual void visit_edges(Visitor& visitor) override;
|
||||
|
||||
NonnullGCPtr<Realm> m_realm;
|
||||
NonnullGCPtr<JobCallback> m_cleanup_callback;
|
||||
GC::Ref<Realm> m_realm;
|
||||
GC::Ref<JobCallback> m_cleanup_callback;
|
||||
|
||||
struct FinalizationRecord {
|
||||
GCPtr<Cell> target;
|
||||
GC::Ptr<Cell> target;
|
||||
Value held_value;
|
||||
GCPtr<Cell> unregister_token;
|
||||
GC::Ptr<Cell> unregister_token;
|
||||
};
|
||||
SinglyLinkedList<FinalizationRecord> m_records;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue