24 constexpr
const uint64_t kGcIntervalMs = 30 * 1000;
30 : context_(JSGlobalContextCreate(nullptr)),
31 thread_id_(
std::this_thread::get_id()) {
33 VLOG(1) <<
"Begin GC run";
37 heap_tracer->TraceAll(object_tracker->GetAliveObjects());
38 object_tracker->FreeDeadObjects(heap_tracer->alive());
44 VLOG(1) <<
"End GC run";
51 impl->MainThread()->AddRepeatedTimer(kGcIntervalMs, std::move(task));
55 JSGlobalContextRelease(context_);
59 return JSContextGetGlobalObject(context());
63 return JSContextGetGlobalObject(context());
66 JSContextRef JsEngine::context()
const {
Handle< JsObject > global_handle()
static JsManagerImpl * InstanceOrNull()
memory::HeapTracer * HeapTracer()
ReturnVal< JsValue > global_value()
static ObjectTracker * Instance()
JSContextRef GetContext()