Recent regression (bug 31615) showed that it's way too easy to pass references to Document and other TreeShared-derived classes using RefPtr/PassRefPtr between main thread and worker threads, causing refcounting of TreeShared to be used unsafe cross-thread. Need to add asserts in at least ref(0 and deref() methods of TreeShared since they are very easy to misuse. Consider adding asserts to other methods as mentioned in bug 31615.
Created attachment 43471 [details] Proposed patch. Added ASSERT to constructor, destructor, setParent, parent, ref and deref. Measured run-webkit-tests on debug build - the difference is not measurable. On my machine, it takes 11 min 20 sec, +/- 10 seconds from run to run, I can not see the difference.
Comment on attachment 43471 [details] Proposed patch. r=me
So this assertion is not hit at all anywhere in the regression tests?
(In reply to comment #3) > So this assertion is not hit at all anywhere in the regression tests? No, not now. It would before rollback of r50919.
Landed: http://trac.webkit.org/changeset/51158