mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 04:27:45 +00:00
LibJS: Add the WeakRef built-in object
This commit is contained in:
parent
6913f06b6f
commit
7eba63a8a3
12 changed files with 268 additions and 1 deletions
|
@ -19,12 +19,22 @@ public:
|
|||
}
|
||||
virtual ~WeakContainer()
|
||||
{
|
||||
m_heap.did_destroy_weak_container({}, *this);
|
||||
deregister();
|
||||
}
|
||||
|
||||
virtual void remove_sweeped_cells(Badge<Heap>, Vector<Cell*>&) = 0;
|
||||
|
||||
protected:
|
||||
void deregister()
|
||||
{
|
||||
if (!m_registered)
|
||||
return;
|
||||
m_heap.did_destroy_weak_container({}, *this);
|
||||
m_registered = false;
|
||||
}
|
||||
|
||||
private:
|
||||
bool m_registered { true };
|
||||
Heap& m_heap;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue