mirror of
https://github.com/matrix-construct/construct
synced 2024-11-25 08:12:37 +01:00
ircd::js: Add handler for runtime Preserve Wrapper callback.
This commit is contained in:
parent
36a7ffba37
commit
6c54215336
2 changed files with 14 additions and 0 deletions
|
@ -40,6 +40,7 @@ class runtime
|
||||||
static void handle_compartment_name(JSRuntime *, JSCompartment *, char *buf, size_t) noexcept;
|
static void handle_compartment_name(JSRuntime *, JSCompartment *, char *buf, size_t) noexcept;
|
||||||
static void handle_compartment_destroy(JSFreeOp *, JSCompartment *) noexcept;
|
static void handle_compartment_destroy(JSFreeOp *, JSCompartment *) noexcept;
|
||||||
static void handle_gc(JSRuntime *, JSGCStatus, void *) 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 bool handle_context(JSContext *, uint op, void *) noexcept;
|
||||||
static void handle_activity(void *priv, bool active) noexcept;
|
static void handle_activity(void *priv, bool active) noexcept;
|
||||||
static bool handle_interrupt(JSContext *) noexcept;
|
static bool handle_interrupt(JSContext *) noexcept;
|
||||||
|
|
13
ircd/js.cc
13
ircd/js.cc
|
@ -3167,6 +3167,7 @@ ircd::js::runtime::runtime(const struct opts &opts,
|
||||||
JS::SetLargeAllocationFailureCallback(get(), handle_large_allocation_failure, nullptr);
|
JS::SetLargeAllocationFailureCallback(get(), handle_large_allocation_failure, nullptr);
|
||||||
JS_SetGCCallback(get(), handle_gc, nullptr);
|
JS_SetGCCallback(get(), handle_gc, nullptr);
|
||||||
JS_SetAccumulateTelemetryCallback(get(), handle_telemetry);
|
JS_SetAccumulateTelemetryCallback(get(), handle_telemetry);
|
||||||
|
::js::SetPreserveWrapperCallback(get(), handle_preserve_wrapper);
|
||||||
JS_AddFinalizeCallback(get(), handle_finalize, nullptr);
|
JS_AddFinalizeCallback(get(), handle_finalize, nullptr);
|
||||||
JS_SetGrayGCRootsTracer(get(), handle_trace_gray, nullptr);
|
JS_SetGrayGCRootsTracer(get(), handle_trace_gray, nullptr);
|
||||||
JS_AddExtraGCRootsTracer(get(), handle_trace_extra, nullptr);
|
JS_AddExtraGCRootsTracer(get(), handle_trace_extra, nullptr);
|
||||||
|
@ -3281,6 +3282,18 @@ noexcept
|
||||||
return true;
|
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
|
void
|
||||||
ircd::js::runtime::handle_gc(JSRuntime *const rt,
|
ircd::js::runtime::handle_gc(JSRuntime *const rt,
|
||||||
const JSGCStatus status,
|
const JSGCStatus status,
|
||||||
|
|
Loading…
Reference in a new issue