Add a ThreadSafeRefCountedBase

A version of RefCountedBase that uses std::atomic_int to store its
reference count.