SpiderMonkey Rooting API
JS::Rooted<T>
<T>
Declares a variable of type T, whose value is always rooted.
May be automatically coerced to a JS::Handle
<T>
Should be used whenever a local variable's value may be held live across a call which can trigger a GC.
JS::Handle<T>
<T>
A const reference to a JS::Rooted
<T>
Functions which take GC things or values as arguments and need to root those arguments should generally use handles for those arguments and avoid any explicit rooting.
When several such functions call each other then redundant rooting of multiple copies of the GC thing can be avoided
If the caller does not pass a rooted value a compile error will be generated, which is quicker and easier to fix than when relying on a separate rooting analysis.
JS::MutableHandle<T>
<T>
A non-const reference to JS::Rooted
<T>
Used in the same way as JS::Handle
<T>
and includes aset(const T &v)
method to allow updating the value of the referenced JS::Rooted<T>
.
typedef
Last updated
Was this helpful?