0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 23:14:13 +01:00

ircd::js: Add handler for runtime Preserve Wrapper callback.

This commit is contained in:
Jason Volk 2016-11-24 18:43:58 -08:00
parent 36a7ffba37
commit 6c54215336
2 changed files with 14 additions and 0 deletions

View file

@ -40,6 +40,7 @@ class runtime
static void handle_compartment_name(JSRuntime *, JSCompartment *, char *buf, size_t) noexcept;
static void handle_compartment_destroy(JSFreeOp *, JSCompartment *) noexcept;
static void handle_gc(JSRuntime *, JSGCStatus, void *) noexcept;
static bool handle_preserve_wrapper(JSContext *, JSObject *) noexcept;
static bool handle_context(JSContext *, uint op, void *) noexcept;
static void handle_activity(void *priv, bool active) noexcept;
static bool handle_interrupt(JSContext *) noexcept;

View file

@ -3167,6 +3167,7 @@ ircd::js::runtime::runtime(const struct opts &opts,
JS::SetLargeAllocationFailureCallback(get(), handle_large_allocation_failure, nullptr);
JS_SetGCCallback(get(), handle_gc, nullptr);
JS_SetAccumulateTelemetryCallback(get(), handle_telemetry);
::js::SetPreserveWrapperCallback(get(), handle_preserve_wrapper);
JS_AddFinalizeCallback(get(), handle_finalize, nullptr);
JS_SetGrayGCRootsTracer(get(), handle_trace_gray, nullptr);
JS_AddExtraGCRootsTracer(get(), handle_trace_extra, nullptr);
@ -3281,6 +3282,18 @@ noexcept
return true;
}
bool
ircd::js::runtime::handle_preserve_wrapper(JSContext *const c,
JSObject *const obj)
noexcept
{
log.debug("context(%p): (object: %p) preserve wrapper",
(const void *)c,
(const void *)obj);
return true;
}
void
ircd::js::runtime::handle_gc(JSRuntime *const rt,
const JSGCStatus status,