I think we should add some thread safety check for RefCounted.
Namely, we should avoid creating an object and ref / deref it in two different threads.
Such objects should be using ThreadSafeRefCounted instead.
Note that it's technically correct to create an object in one thread, pass it to another thread if the new thread has an exclusive ownership / access right. However, such a code is error prone so I'd argue that we shouldn't have such a code without such code using ThreadSafeRefCounted instead.
WTF::String has a non-atomic ref couter, but it is a quite common pattern to pass a WTF::String cross-threads by using isolatedCopy().
(In reply to Fujii Hironori from comment #2)
> WTF::String has a non-atomic ref couter, but it is a quite common pattern to
> pass a WTF::String cross-threads by using isolatedCopy().
That's a good point. Maybe we need to allow this usage in some classes, or perhaps isolatedCopy needs some magic to unset the thread identity.
But perhaps the opposite is possible: WebCore could annotate certain important objects upon allocation as being tied to a thread.
*** This bug has been marked as a duplicate of bug 200507 ***