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:
parent
15daf88e93
commit
2a9e29fbb8
4 changed files with 78 additions and 0 deletions
|
@ -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 };
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue