1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 15:57:45 +00:00

LibJS: Add DeferGC, a RAII way to prevent GC temporarily

This commit is contained in:
Andreas Kling 2020-04-19 11:30:47 +02:00
parent 15daf88e93
commit 2a9e29fbb8
4 changed files with 78 additions and 0 deletions

View file

@ -68,6 +68,9 @@ public:
void did_create_handle(Badge<HandleImpl>, HandleImpl&);
void did_destroy_handle(Badge<HandleImpl>, HandleImpl&);
void defer_gc(Badge<DeferGC>);
void undefer_gc(Badge<DeferGC>);
private:
Cell* allocate_cell(size_t);
@ -86,6 +89,9 @@ private:
Interpreter& m_interpreter;
Vector<NonnullOwnPtr<HeapBlock>> m_blocks;
HashTable<HandleImpl*> m_handles;
size_t m_gc_deferrals { 0 };
bool m_should_gc_when_deferral_ends { false };
};
}