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);
Name | Type | Description |
---|---|---|
trc | JSTracer * | The tracer to be initialized. |
cx | JSContext * | The context in which to perform tracing. |
callback | JSTraceCallback | A 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);
Name | Type | Description |
---|---|---|
trc | JSTracer * | The tracer visiting obj . |
thing | void * | A GC thing. |
kind | uint32 | One 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论