[webkit-dev] Breaking cycles in mutation observers in JSC

Gavin Barraclough barraclough at apple.com
Thu Aug 23 13:33:11 PDT 2012


JSC already supports private named properties – you just need allocate a 'PrivateName' object & use this as a property name.

cheers,
G.


On Aug 23, 2012, at 1:04 PM, Adam Barth <abarth at webkit.org> wrote:

> Another approach might be to implement hidden properties in
> JavaScriptCore, but I don't know what would be involved in doing that.
> 
> Adam
> 
> 
> On Thu, Aug 23, 2012 at 12:39 PM, Elliott Sprehn <esprehn at chromium.org> wrote:
>> I'm trying to fix the memory leaks in MutationObservers
>> (http://www.w3.org/TR/dom/#mutation-observers),
>> https://bugs.webkit.org/show_bug.cgi?id=93661
>> 
>> This is easy in V8 where I've put a hidden property on the MutationObserver
>> wrapper, and the V8MutationCallback object accesses this hidden property.
>> The MutationObserver is then an ActiveDOMObject which keeps the wrapper
>> alive as long as the observer has DOM nodes it's listening on, even if it's
>> unreachable from JS.
>> 
>> In the JSC side I'm not sure how to handle the cycle problem. Do I need to
>> use a JSC::Weak in JSMutationCallback and then use visitChildren on the
>> JSMutationObserver to call
>> addOpaqueRoot(thisObject->impl()->callback->jsValue) ?
>> 
>> In general if someone could explain visitChildren and
>> isReachableFromOpaqueRoots and when I want slotVistor.append or
>> addOpaqueRoot etc. it would be very helpful.
>> 
>> - E
>> 
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo/webkit-dev
>> 
> _______________________________________________
> webkit-dev mailing list
> webkit-dev at lists.webkit.org
> http://lists.webkit.org/mailman/listinfo/webkit-dev



More information about the webkit-dev mailing list