Changeset 51869 in webkit for trunk/JavaScriptCore/runtime


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/runtime/Structure.cpp

    r50704 r51869  
    147147    else
    148148        structureCounter.increment();
     149
     150    // Use of addressOfCount() in this class prevents thread verification in RefCounted
     151    // since it modifies refcount via other means than ref()/deref().
     152    disableThreadVerification();
    149153#endif
    150154
Note: See TracChangeset for help on using the changeset viewer.