diff options
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/WeakMap.cpp | 7 | ||||
-rw-r--r-- | Userland/Libraries/LibJS/Runtime/WeakMap.h | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/Userland/Libraries/LibJS/Runtime/WeakMap.cpp b/Userland/Libraries/LibJS/Runtime/WeakMap.cpp index 8bd9a7a9c7..f9e232cd95 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMap.cpp +++ b/Userland/Libraries/LibJS/Runtime/WeakMap.cpp @@ -29,4 +29,11 @@ void WeakMap::remove_swept_cells(Badge<Heap>, Span<Cell*> cells) m_values.remove(cell); } +void WeakMap::visit_edges(Visitor& visitor) +{ + Base::visit_edges(visitor); + for (auto& entry : m_values) + visitor.visit(entry.value); +} + } diff --git a/Userland/Libraries/LibJS/Runtime/WeakMap.h b/Userland/Libraries/LibJS/Runtime/WeakMap.h index 2f7c01b2d1..d946c5241f 100644 --- a/Userland/Libraries/LibJS/Runtime/WeakMap.h +++ b/Userland/Libraries/LibJS/Runtime/WeakMap.h @@ -31,6 +31,7 @@ public: private: virtual void did_become_zombie() override { deregister(); } + void visit_edges(Visitor&) override; HashMap<Cell*, Value> m_values; // This stores Cell pointers instead of Object pointers to aide with sweeping }; |