mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 06:07:44 +00:00
LibJS: Generify the garbage collector's weak container notifications
This will allow us to use the same interface for other JS weak containers like the WeakMap & WeakRef.
This commit is contained in:
parent
06fdc26656
commit
1a8ee5d8d7
6 changed files with 51 additions and 17 deletions
|
@ -9,10 +9,13 @@
|
|||
#include <AK/HashTable.h>
|
||||
#include <LibJS/Runtime/GlobalObject.h>
|
||||
#include <LibJS/Runtime/Object.h>
|
||||
#include <LibJS/Runtime/WeakContainer.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class WeakSet : public Object {
|
||||
class WeakSet final
|
||||
: public Object
|
||||
, public WeakContainer {
|
||||
JS_OBJECT(WeakSet, Object);
|
||||
|
||||
public:
|
||||
|
@ -24,7 +27,7 @@ public:
|
|||
HashTable<Cell*> const& values() const { return m_values; };
|
||||
HashTable<Cell*>& values() { return m_values; };
|
||||
|
||||
void remove_sweeped_cells(Badge<Heap>, Vector<Cell*>&);
|
||||
virtual void remove_sweeped_cells(Badge<Heap>, Vector<Cell*>&) override;
|
||||
|
||||
private:
|
||||
HashTable<Cell*> m_values; // This stores Cell pointers instead of Object pointers to aide with sweeping
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue