[webkit-dev] JavaJSObject vs JSObject
per.bothner at oracle.com
Mon Mar 21 16:48:27 PDT 2011
On 03/21/2011 03:17 PM, Darin Adler wrote:
Thanks. It appears the 2 types I need to primarily deal with are
JSObjectRef and JSContextRef.
JSObjectRef seems straight-forward: It's a struct OpaqueJSValue*,
which is the same a JSC::JSObject*, and I get the latter from the
former using toRef from APICast.h.
JSContextRef is a little trickier: It seems equivalent to an ExecState*.
Presumably we'd want a JSGlobalContextRef, so using toGlobalRef
make sense. Our codebase has code like:
JSGlobalContextRef globalContext =
That works, but it would be nice if there were a cleaner way to do it ...
Some Googling found references to webkit_web_frame_get_global_context() and
WebFrame::globalContext() but I didn't find these - maybe they're
Is it better to search for JSGlobalContextRef on each method call, or should
it be stashed in a field of the Java JSObject wrapper? The latter might be
more efficient, but only as long as a the JSGlobalContextRef is stable.
per.bothner at oracle.com per at bothner.com http://per.bothner.com/
More information about the webkit-dev