[webkit-dev] Ref counting questions

2013-05-22 Thread Bem Jones-Bey
Hey all, I've read the document at http://www.webkit.org/coding/RefPtr.html, but I still have some questions about using RefPtrs. The first one is listed in the Improving this document section of the aforementioned documentation: • Perils of programming with TreeShared. What does that

Re: [webkit-dev] Ref counting questions

2013-05-22 Thread Antti Koivisto
TreeShared is essentially an implementation detail of the DOM tree (the only other client besides Node is SVGElementInstance). It shouldn't be used for anything else. TreeShared keeps Nodes alive when they are part of a tree (have a parent node) even when they have zero refcount. This way nodes

Re: [webkit-dev] Ref counting questions

2013-05-22 Thread Maciej Stachowiak
We could probably phase out TreeShared if we were really careful to avoid refcount thrash during tree construction/manipulation. I believe this can be done with careful use of PassRefPtr and swap() and it would likely be easier to understand if Nodes normally had a refcount of 1 instead of 0.