#include <Context.h>
◆ Context()
Returns a context, in which any number of ScriptInterfaces compartments can live.
Each context should only ever be used on a single thread.
- Parameters
-
| parentContext | Parent context from the parent thread, with which we share some thread-safe data |
| contextSize | Maximum size in bytes of the new context |
| heapGrowthBytesGCTrigger | Size in bytes of cumulated allocations after which a GC will be triggered |
◆ ~Context()
| Script::Context::~Context |
( |
| ) |
|
◆ GetGeneralJSContext()
| JSContext * Script::Context::GetGeneralJSContext |
( |
| ) |
const |
|
inline |
GetGeneralJSContext returns the context without starting a GC request and without entering any compartment.
It should only be used in specific situations, such as creating a new compartment, or when initializing a persistent rooted. If you need the compartmented context of a Interface, you should create a Request and use the context from that.
◆ MaybeIncrementalGC()
| void Script::Context::MaybeIncrementalGC |
( |
| ) |
|
MaybeIncrementalGC checks if running a GC is worth the time that will take.
The logic is custom as Spidermonkey tends to assume 'idle time' will exist, which is a thing in websites but not really in 0 A.D. This can have a few behaviours:
- doing nothing
- starting a new incremental GC
- running a GC slice
- finishing the incremental GC For details, check the SM doc in e.g. GC.cpp and GCapi.cpp
◆ PrepareZonesForIncrementalGC()
| void Script::Context::PrepareZonesForIncrementalGC |
( |
| ) |
const |
|
private |
◆ RegisterRealm()
| void Script::Context::RegisterRealm |
( |
JS::Realm * |
realm | ) |
|
This is used to keep track of realms which should be prepared for a GC.
◆ RunJobs()
| void Script::Context::RunJobs |
( |
| ) |
|
Runs the promise continuation.
On contexts where promises can be used this function has to be called. This function has to be called frequently.
◆ ShrinkingGC()
| void Script::Context::ShrinkingGC |
( |
| ) |
|
Does a non-incremental, shrinking GC.
A shrinking GC dumps JIT code and tries to defragment memory.
◆ UnRegisterRealm()
| void Script::Context::UnRegisterRealm |
( |
JS::Realm * |
realm | ) |
|
◆ m_ContextSize
| int Script::Context::m_ContextSize |
|
private |
◆ m_cx
| JSContext* Script::Context::m_cx |
|
private |
◆ m_HeapGrowthBytesGCTrigger
| uint32_t Script::Context::m_HeapGrowthBytesGCTrigger |
|
private |
◆ m_JobQueue
| const std::unique_ptr<JobQueue> Script::Context::m_JobQueue |
|
private |
◆ m_LastGCBytes
| uint32_t Script::Context::m_LastGCBytes {0} |
|
private |
◆ m_Realms
| std::list<JS::Realm*> Script::Context::m_Realms |
|
private |
The documentation for this class was generated from the following files:
- /home/jenkins/jenkins/workspace/technical-docs/source/scriptinterface/Context.h
- /home/jenkins/jenkins/workspace/technical-docs/source/scriptinterface/Context.cpp