JS_TracerInit 编辑

Obsolete since JSAPI 31
This feature is obsolete. Although it may still work in some browsers, its use is discouraged since it could be removed at any time. Try to avoid using it.

This article covers features introduced in SpiderMonkey 1.8

Note: in JSAPI 12, the macro JS_TRACER_INIT has been replaced by the function JS_TracerInit

Initialize a JSTracer for object graph tracing.

Syntax

void
JS_TracerInit(JSTracer *trc, JSRuntime *rt, JSTraceCallback callback);
NameTypeDescription
trcJSTracer *The tracer to be initialized.
cxJSContext *The context in which to perform tracing.
callbackJSTraceCallbackA callback, described below, which the tracing APIs will call each time a pointer is found from one GC thing to another.

Callback syntax

typedef void
(*JSTraceCallback)(JSTracer *trc, void *thing, uint32 kind);
NameTypeDescription
trcJSTracer *The tracer visiting obj.
thingvoid *A GC thing.
kinduint32One of the constants JSTRACE_OBJECT, JSTRACE_DOUBLE, JSTRACE_STRING; or a tag denoting an internal implementation-specific traversal kind. In the latter case, the only operations the callback may perform on thing are to call JS_TraceChildren or the DEBUG-only JS_PrintTraceThingInfo function.

Description

JS_TraceChildren and other tracing APIs call the tracer callback for each traceable thing directly referenced by a particular object or runtime structure. It is the callback's responsibility to ensure the traversal of the full object graph, if desired, by eventually calling JS_TraceChildren on the passed thing. In this case the callback must be prepared to deal with cycles in the traversal graph.

See Also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:55 次

字数:4125

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文