| Index: third_party/WebKit/Source/wtf/ThreadSafeRefCounted.h
|
| diff --git a/third_party/WebKit/Source/wtf/ThreadSafeRefCounted.h b/third_party/WebKit/Source/wtf/ThreadSafeRefCounted.h
|
| index d9c9cc2e0a8b29e5fc31559eaa63f40295a0446f..c7814bd8851a0ee968069c37f57eb97dede51c32 100644
|
| --- a/third_party/WebKit/Source/wtf/ThreadSafeRefCounted.h
|
| +++ b/third_party/WebKit/Source/wtf/ThreadSafeRefCounted.h
|
| @@ -39,61 +39,48 @@
|
| namespace WTF {
|
|
|
| class WTF_EXPORT ThreadSafeRefCountedBase {
|
| - WTF_MAKE_NONCOPYABLE(ThreadSafeRefCountedBase);
|
| - USING_FAST_MALLOC(ThreadSafeRefCountedBase);
|
| -public:
|
| - ThreadSafeRefCountedBase(int initialRefCount = 1)
|
| - : m_refCount(initialRefCount)
|
| - {
|
| - }
|
| + WTF_MAKE_NONCOPYABLE(ThreadSafeRefCountedBase);
|
| + USING_FAST_MALLOC(ThreadSafeRefCountedBase);
|
|
|
| - void ref()
|
| - {
|
| - atomicIncrement(&m_refCount);
|
| - }
|
| + public:
|
| + ThreadSafeRefCountedBase(int initialRefCount = 1)
|
| + : m_refCount(initialRefCount) {}
|
|
|
| - bool hasOneRef()
|
| - {
|
| - return refCount() == 1;
|
| - }
|
| + void ref() { atomicIncrement(&m_refCount); }
|
|
|
| - int refCount() const
|
| - {
|
| - return static_cast<int const volatile &>(m_refCount);
|
| - }
|
| + bool hasOneRef() { return refCount() == 1; }
|
|
|
| -protected:
|
| - // Returns whether the pointer should be freed or not.
|
| - bool derefBase()
|
| - {
|
| - WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount);
|
| - if (atomicDecrement(&m_refCount) <= 0) {
|
| - WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount);
|
| - return true;
|
| - }
|
| - return false;
|
| + int refCount() const { return static_cast<int const volatile&>(m_refCount); }
|
| +
|
| + protected:
|
| + // Returns whether the pointer should be freed or not.
|
| + bool derefBase() {
|
| + WTF_ANNOTATE_HAPPENS_BEFORE(&m_refCount);
|
| + if (atomicDecrement(&m_refCount) <= 0) {
|
| + WTF_ANNOTATE_HAPPENS_AFTER(&m_refCount);
|
| + return true;
|
| }
|
| + return false;
|
| + }
|
|
|
| -private:
|
| - int m_refCount;
|
| + private:
|
| + int m_refCount;
|
| };
|
|
|
| -template<class T> class ThreadSafeRefCounted : public ThreadSafeRefCountedBase {
|
| -public:
|
| - void deref()
|
| - {
|
| - if (derefBase())
|
| - delete static_cast<T*>(this);
|
| - }
|
| +template <class T>
|
| +class ThreadSafeRefCounted : public ThreadSafeRefCountedBase {
|
| + public:
|
| + void deref() {
|
| + if (derefBase())
|
| + delete static_cast<T*>(this);
|
| + }
|
|
|
| -protected:
|
| - ThreadSafeRefCounted()
|
| - {
|
| - }
|
| + protected:
|
| + ThreadSafeRefCounted() {}
|
| };
|
|
|
| -} // namespace WTF
|
| +} // namespace WTF
|
|
|
| using WTF::ThreadSafeRefCounted;
|
|
|
| -#endif // ThreadSafeRefCounted_h
|
| +#endif // ThreadSafeRefCounted_h
|
|
|