mirror of
https://github.com/RGBCube/serenity
synced 2025-05-20 17:55:08 +00:00

This abstracts a vector of Cell* with a strongly typed span() accessor that gives you Span<T*> instead of Span<Cell*>. It is intended to replace MarkedValueList in situations where you only need to store pointers to Cell (or an even more specific type of Cell). The API can definitely be improved, it's just the bare basics for now.
30 lines
584 B
C++
30 lines
584 B
C++
/*
|
|
* Copyright (c) 2021, Andreas Kling <kling@serenityos.org>
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#include <LibJS/Heap/Heap.h>
|
|
#include <LibJS/Heap/MarkedVector.h>
|
|
|
|
namespace JS {
|
|
|
|
MarkedVectorBase::MarkedVectorBase(Heap& heap)
|
|
: m_heap(heap)
|
|
{
|
|
m_heap.did_create_marked_vector({}, *this);
|
|
}
|
|
|
|
MarkedVectorBase::MarkedVectorBase(MarkedVectorBase&& other)
|
|
: m_heap(other.m_heap)
|
|
, m_cells(move(other.m_cells))
|
|
{
|
|
m_heap.did_create_marked_vector({}, *this);
|
|
}
|
|
|
|
MarkedVectorBase::~MarkedVectorBase()
|
|
{
|
|
m_heap.did_destroy_marked_vector({}, *this);
|
|
}
|
|
|
|
}
|