[webkit-help] JSValueRef / JSObjectRef used as map key, safe or not ?

Jean-Philippe Déry jeanphilippe.dery at gmail.com
Mon Dec 7 12:05:27 PST 2015


Hi,

I’m trying to find a way to store private data on a JSObjectRef other than JSObjectSetPrivate since it's not possible to store data on an object that was not created with JSObjectMake. I’m left to using an unordered_map with the JSObjectRef as key. It’s seems to be working fine so far but I was wondering if the JSObjectRef's address could change and be invalid. This concern comes from the fact that, on V8, doing such thing is discouraged because the address of a value may change when garbage collection occurs.

Is it safe ?

Thanks




More information about the webkit-help mailing list