mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 12:07:45 +00:00
LibJS: Resolve a circular include problem between HeapBlock and Cell
Cell::heap() and Cell::vm() needed to access member functions from HeapBlock, and wanted to be inline, so they were moved to VM.h. That approach will no longer work with VM.h not being included in every file (starting from the next commit), so this commit fixes that circular import issue by introducing secondary base classes to host the references to Heap and VM, respectively.
This commit is contained in:
parent
41f9dcd89b
commit
392b5c3b19
7 changed files with 64 additions and 25 deletions
|
@ -19,12 +19,13 @@
|
|||
#include <LibJS/Heap/Cell.h>
|
||||
#include <LibJS/Heap/CellAllocator.h>
|
||||
#include <LibJS/Heap/Handle.h>
|
||||
#include <LibJS/Heap/Internals.h>
|
||||
#include <LibJS/Heap/MarkedVector.h>
|
||||
#include <LibJS/Runtime/WeakContainer.h>
|
||||
|
||||
namespace JS {
|
||||
|
||||
class Heap {
|
||||
class Heap : public HeapBase {
|
||||
AK_MAKE_NONCOPYABLE(Heap);
|
||||
AK_MAKE_NONMOVABLE(Heap);
|
||||
|
||||
|
@ -57,8 +58,6 @@ public:
|
|||
|
||||
void collect_garbage(CollectionType = CollectionType::CollectGarbage, bool print_report = false);
|
||||
|
||||
VM& vm() { return m_vm; }
|
||||
|
||||
bool should_collect_on_every_allocation() const { return m_should_collect_on_every_allocation; }
|
||||
void set_should_collect_on_every_allocation(bool b) { m_should_collect_on_every_allocation = b; }
|
||||
|
||||
|
@ -106,8 +105,6 @@ private:
|
|||
|
||||
bool m_should_collect_on_every_allocation { false };
|
||||
|
||||
VM& m_vm;
|
||||
|
||||
Vector<NonnullOwnPtr<CellAllocator>> m_allocators;
|
||||
|
||||
HandleImpl::List m_handles;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue