mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 08:37:45 +00:00
LibJS: Use HashTable::remove_all_matching() in WeakSet :^)
This commit is contained in:
parent
54cf42fac1
commit
e08d325124
1 changed files with 3 additions and 8 deletions
|
@ -25,14 +25,9 @@ WeakSet::~WeakSet()
|
||||||
|
|
||||||
void WeakSet::remove_dead_cells(Badge<Heap>)
|
void WeakSet::remove_dead_cells(Badge<Heap>)
|
||||||
{
|
{
|
||||||
// FIXME: Do this in a single pass.
|
m_values.remove_all_matching([](Cell* cell) {
|
||||||
Vector<Cell*> to_remove;
|
return cell->state() != Cell::State::Live;
|
||||||
for (auto* cell : m_values) {
|
});
|
||||||
if (cell->state() != Cell::State::Live)
|
|
||||||
to_remove.append(cell);
|
|
||||||
}
|
|
||||||
for (auto* cell : to_remove)
|
|
||||||
m_values.remove(cell);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue