/src/serenity/Userland/Libraries/LibJS/Runtime/WeakSet.cpp
Line | Count | Source (jump to first uncovered line) |
1 | | /* |
2 | | * Copyright (c) 2021, Idan Horowitz <idan.horowitz@serenityos.org> |
3 | | * |
4 | | * SPDX-License-Identifier: BSD-2-Clause |
5 | | */ |
6 | | |
7 | | #include <LibJS/Runtime/WeakSet.h> |
8 | | |
9 | | namespace JS { |
10 | | |
11 | | JS_DEFINE_ALLOCATOR(WeakSet); |
12 | | |
13 | | NonnullGCPtr<WeakSet> WeakSet::create(Realm& realm) |
14 | 0 | { |
15 | 0 | return realm.heap().allocate<WeakSet>(realm, realm.intrinsics().weak_set_prototype()); |
16 | 0 | } |
17 | | |
18 | | WeakSet::WeakSet(Object& prototype) |
19 | 0 | : Object(ConstructWithPrototypeTag::Tag, prototype) |
20 | 0 | , WeakContainer(heap()) |
21 | 0 | { |
22 | 0 | } |
23 | | |
24 | | void WeakSet::remove_dead_cells(Badge<Heap>) |
25 | 0 | { |
26 | 0 | m_values.remove_all_matching([](Cell* cell) { |
27 | 0 | return cell->state() != Cell::State::Live; |
28 | 0 | }); |
29 | 0 | } |
30 | | |
31 | | } |