Ignore:
Timestamp:
Dec 8, 2009, 12:25:10 PM (15 years ago)
Author:
[email protected]
Message:

Add asserts to RefCounted to make sure ref/deref happens on the right thread.
https://bugs.webkit.org/show_bug.cgi?id=31639

Reviewed by Darin Adler.

JavaScriptCore:

  • runtime/Structure.cpp:

(JSC::Structure::Structure): Disable thread verification on this class since it uses addressOfCount().

  • wtf/RefCounted.h:

(WTF::RefCountedBase::ref): Add ASSERT.
(WTF::RefCountedBase::hasOneRef): Ditto.
(WTF::RefCountedBase::refCount): Ditto.
(WTF::RefCountedBase::derefBase): Ditto.
(WTF::RefCountedBase::disableThreadVerification): delegate to ThreadVerifier method.

  • wtf/ThreadVerifier.h: Added.

(WTF::ThreadVerifier::ThreadVerifier): New Debug-only class to verify that ref/deref of RefCounted is done on the same thread.
(WTF::ThreadVerifier::activate): Activates checks. Called when ref count becomes above 2.
(WTF::ThreadVerifier::deactivate): Deactivates checks. Called when ref count drops below 2.
(WTF::ThreadVerifier::disableThreadVerification): used on objects that should not be checked (StringImpl etc)
(WTF::ThreadVerifier::verifyThread):

JavaScriptGlue:

  • ForwardingHeaders/wtf/ThreadVerifier.h: Added.

WebCore:

  • loader/icon/IconRecord.cpp:

(WebCore::IconRecord::IconRecord): Disable thread verification for this class because of its cross-thread use in IconDatabase.

  • platform/SharedBuffer.cpp:

(WebCore::SharedBuffer::SharedBuffer): Ditto.

  • platform/text/StringImpl.cpp:

(WebCore::StringImpl::StringImpl): Disable thread verification for this class, add FIXME to enforce proper usage via crossThreadString.

  • ForwardingHeaders/wtf/ThreadVerifier.h: Added.

WebKit/mac:

  • ForwardingHeaders/wtf/ThreadVerifier.h: Added.

WebKitTools:

  • DumpRenderTree/ForwardingHeaders/wtf/ThreadVerifier.h: Added.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/JavaScriptCore.gypi

    r51423 r51869  
    428428            'wtf/ThreadSpecific.h',
    429429            'wtf/ThreadSpecificWin.cpp',
     430            'wtf/ThreadVerifier.h',
    430431            'wtf/TypeTraits.cpp',
    431432            'wtf/TypeTraits.h',
Note: See TracChangeset for help on using the changeset viewer.