18#ifndef INCLUDED_SCRIPTCONTEXT
19#define INCLUDED_SCRIPTCONTEXT
constexpr int DEFAULT_HEAP_GROWTH_BYTES_GCTRIGGER
Definition: ScriptContext.h:28
constexpr int DEFAULT_CONTEXT_SIZE
Definition: ScriptContext.h:27
thread_local std::shared_ptr< ScriptContext > g_ScriptContext
Definition: GameSetup.cpp:108
Abstraction around a SpiderMonkey JSContext.
Definition: ScriptContext.h:46
double m_LastGCCheck
Definition: ScriptContext.h:110
int m_ContextSize
Definition: ScriptContext.h:107
void UnRegisterRealm(JS::Realm *realm)
Definition: ScriptContext.cpp:152
const std::unique_ptr< Script::JobQueue > m_JobQueue
Definition: ScriptContext.h:102
void RunJobs()
Runs the promise continuation.
Definition: ScriptContext.cpp:274
ScriptContext(int contextSize, int heapGrowthBytesGCTrigger)
Definition: ScriptContext.cpp:86
std::list< JS::Realm * > m_Realms
Definition: ScriptContext.h:105
~ScriptContext()
Definition: ScriptContext.cpp:138
JSContext * m_cx
Definition: ScriptContext.h:101
void PrepareZonesForIncrementalGC() const
Definition: ScriptContext.cpp:279
void MaybeIncrementalGC(double delay)
MaybeIncrementalGC tries to determine whether a context-wide garbage collection would free up enough ...
Definition: ScriptContext.cpp:162
int m_HeapGrowthBytesGCTrigger
Definition: ScriptContext.h:108
void RegisterRealm(JS::Realm *realm)
This is used to keep track of realms which should be prepared for a GC.
Definition: ScriptContext.cpp:146
int m_LastGCBytes
Definition: ScriptContext.h:109
void ShrinkingGC()
Definition: ScriptContext.cpp:264
static std::shared_ptr< ScriptContext > CreateContext(int contextSize=DEFAULT_CONTEXT_SIZE, int heapGrowthBytesGCTrigger=DEFAULT_HEAP_GROWTH_BYTES_GCTRIGGER)
Returns a context, in which any number of ScriptInterfaces compartments can live.
Definition: ScriptContext.cpp:81
JSContext * GetGeneralJSContext() const
GetGeneralJSContext returns the context without starting a GC request and without entering any compar...
Definition: ScriptContext.h:97
Wraps SM APIs for manipulating JS objects.
Definition: JSON.h:35