Fri Mar 7 15:32:22 PST 2014
JSObjectRef to have a private table/array which holds other
JSObjectRefs. Basically, I want a strong reference list so any objects
in that list won't be collected until after my object is collected.
My initial implementation was to create a standard C-array which held
the JSObjectRef's for my list. I used JSValueProtect on each element
as I added them to my array. My plan was to then call JSValueUnprotect
for each item in my array in the finalizer. However, I discovered that
I don't get the context in the finalizer callback and I'm not supposed
to call any functions that use a context.
Can you suggest how I should implement this instead? (Or if I can
somehow get the context, will this finalizer solution work anyway?)
I started looking at the objectDefinition.staticValues and the
JSObjectGetProperty/JSObjectSetProperty and their callbacks, thinking
I could use JSObjectMakeArray with this to hold my references instead
of using JSValueProtect. But I don't understand how the life-cycle
management deals with anything I write in these callback functions, so
I don't know if this will work.
Beginning iPhone Games Development
More information about the webkit-help