diff options
author | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-28 06:53:39 (GMT) |
---|---|---|
committer | Jan-Arve Sæther <jan-arve.saether@nokia.com> | 2009-10-28 06:53:39 (GMT) |
commit | 262d0df3b166fecb3502e81b2ab85cadd71ae70f (patch) | |
tree | 17f8cba9c8f1ff4f46b45386c79ff9ebb3f998be /src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h | |
parent | df0001a3d62938c713b351c7e59228b803ec5670 (diff) | |
parent | 1607216cc6292ef9a4af68ce6d29dc79fffea92c (diff) | |
download | Qt-262d0df3b166fecb3502e81b2ab85cadd71ae70f.zip Qt-262d0df3b166fecb3502e81b2ab85cadd71ae70f.tar.gz Qt-262d0df3b166fecb3502e81b2ab85cadd71ae70f.tar.bz2 |
Merge branch 'fixes' of git://gitorious.org/~fleury/qt/fleury-openbossa-clone into openbossa-fleury-fixes3
Conflicts:
src/gui/graphicsview/qgraphicsanchorlayout_p.cpp
src/gui/graphicsview/qgraphicsanchorlayout_p.h
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h')
-rw-r--r-- | src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h b/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h index 6a05211..f682f0d 100644 --- a/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h +++ b/src/3rdparty/webkit/JavaScriptCore/wtf/CrossThreadRefCounted.h @@ -70,10 +70,6 @@ namespace WTF { return !m_refCounter.hasOneRef() || (m_threadSafeRefCounter && !m_threadSafeRefCounter->hasOneRef()); } -#ifndef NDEBUG - bool mayBePassedToAnotherThread() const { ASSERT(!m_threadId); return m_refCounter.hasOneRef(); } -#endif - private: CrossThreadRefCounted(T* data, ThreadSafeSharedBase* threadedCounter) : m_threadSafeRefCounter(threadedCounter) @@ -92,6 +88,10 @@ namespace WTF { void threadSafeDeref(); +#ifndef NDEBUG + bool isOwnedByCurrentThread() const { return !m_threadId || m_threadId == currentThread(); } +#endif + RefCountedBase m_refCounter; ThreadSafeSharedBase* m_threadSafeRefCounter; T* m_data; @@ -103,7 +103,7 @@ namespace WTF { template<class T> void CrossThreadRefCounted<T>::ref() { - ASSERT(!m_threadId || m_threadId == currentThread()); + ASSERT(isOwnedByCurrentThread()); m_refCounter.ref(); #ifndef NDEBUG // Store the threadId as soon as the ref count gets to 2. @@ -119,7 +119,7 @@ namespace WTF { template<class T> void CrossThreadRefCounted<T>::deref() { - ASSERT(!m_threadId || m_threadId == currentThread()); + ASSERT(isOwnedByCurrentThread()); if (m_refCounter.derefBase()) { threadSafeDeref(); delete this; @@ -146,10 +146,12 @@ namespace WTF { template<class T> PassRefPtr<CrossThreadRefCounted<T> > CrossThreadRefCounted<T>::crossThreadCopy() { + ASSERT(isOwnedByCurrentThread()); if (m_threadSafeRefCounter) m_threadSafeRefCounter->ref(); else m_threadSafeRefCounter = new ThreadSafeSharedBase(2); + return adoptRef(new CrossThreadRefCounted<T>(m_data, m_threadSafeRefCounter)); } |