Coverage Report

Created: 2026-06-07 07:41

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/serenity/Userland/Libraries/LibJS/Runtime/WeakMap.cpp
Line
Count
Source
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/WeakMap.h>
8
9
namespace JS {
10
11
JS_DEFINE_ALLOCATOR(WeakMap);
12
13
NonnullGCPtr<WeakMap> WeakMap::create(Realm& realm)
14
0
{
15
0
    return realm.heap().allocate<WeakMap>(realm, realm.intrinsics().weak_map_prototype());
16
0
}
17
18
WeakMap::WeakMap(Object& prototype)
19
0
    : Object(ConstructWithPrototypeTag::Tag, prototype)
20
0
    , WeakContainer(heap())
21
0
{
22
0
}
23
24
void WeakMap::remove_dead_cells(Badge<Heap>)
25
0
{
26
0
    m_values.remove_all_matching([](Cell* key, Value) {
27
0
        return key->state() != Cell::State::Live;
28
0
    });
29
0
}
30
31
void WeakMap::visit_edges(Visitor& visitor)
32
0
{
33
0
    Base::visit_edges(visitor);
34
0
    for (auto& entry : m_values)
35
0
        visitor.visit(entry.value);
36
0
}
37
38
}