[webkit-dev] about referencing objects between JavaScriptCore and WebCore

Geoffrey Garen ggaren at apple.com
Mon Mar 23 10:49:30 PDT 2009


Hi Zhou.

>     I have a question about the objects referencing between  
> Javasciptcore
> and WebCore:
>
>     JSNode uses m_impl to reference a Node in WebCore. And when
> KJS::Collector::collect() is called the function mark() of each  
> JSNode is
> invoked to keep the corresponding Node in WebCore alive in memory.

That's not quite accurate.

m_impl is reference-counted -- nothing specific needs to happen during  
garbage collection in order to keep m_impl alive.

The purpose of marking JSNode objects is to keep alive the JavaScript  
wrapper around m_impl, to preserve custom properties set through the  
DOM API.

Geoff


More information about the webkit-dev mailing list