Add asserts to RefCounted to make sure ref/deref happens on the right thread.
authorlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 20:46:22 +0000 (20:46 +0000)
committerlevin@chromium.org <levin@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Apr 2011 20:46:22 +0000 (20:46 +0000)
commitd9004313a0a65c580c63dbab422518b13d675824
treee91b4ccfa53d22a779030f67421650da5b6b032f
parentd1eac1192600e2f0526fe56a0f29b10f3ce9ac96
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.

Source/JavaScriptCore:

* GNUmakefile.list.am: Added new files to the build.
* JavaScriptCore.gypi: Ditto.
* JavaScriptCore.vcproj/WTF/WTF.vcproj: Ditto.
* JavaScriptCore.xcodeproj/project.pbxproj: Ditto.
* jit/ExecutableAllocator.h:
(JSC::ExecutablePool::ExecutablePool): Turned off checks for this
due to not being able to figure out what was guarding it (bug 58091).
* parser/SourceProvider.h:
(JSC::SourceProvider::SourceProvider): Ditto.
* runtime/RegExp.cpp:
(JSC::RegExp::RegExp): Ditto.
* wtf/CMakeLists.txt: Added new files to the build.
* wtf/ThreadRestrictionVerifier.h: Added.
Everything is done in the header to avoid the issue with exports
that are only useful in debug but still needing to export them.
* wtf/RefCounted.h:
(WTF::RefCountedBase::ref): Added checks using the non thread safe verifier.
and filed bug 58171 about making it stricter.
(WTF::RefCountedBase::hasOneRef): Ditto.
(WTF::RefCountedBase::refCount): Ditto.
(WTF::RefCountedBase::setMutexForVerifier): Expose a way to change the checks to be based
on a mutex. This is in the header to avoid adding more exports from JavaScriptCore.
(WTF::RefCountedBase::deprecatedTurnOffVerifier): Temporary way to turn off verification.
Filed bug 58174 to remove this method.
(WTF::RefCountedBase::derefBase):
* wtf/SizeLimits.cpp: Adjusted the debug size check for RefCounted.
* wtf/text/CString.h:
(WTF::CStringBuffer::CStringBuffer): Turned off checks for this while a fix is being
done in Chromium's test_shell (bug 58093).

Source/JavaScriptGlue:

* ForwardingHeaders/wtf/ThreadRestrictionVerifier.h: Added.

Source/WebCore:

No new functionality exposed so no new tests. (The change is basically adding
more testing.)

* ForwardingHeaders/wtf/ThreadRestrictionVerifier.h: Added.
* loader/icon/IconDatabase.cpp:
(WebCore::IconDatabase::defaultIcon): Set the mutex which does the guarding of the variable.
(WebCore::IconDatabase::getOrCreateIconRecord): Ditto.
(WebCore::IconDatabase::setIconDataForIconURL): Ditto.
(WebCore::IconDatabase::readFromDatabase): Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@85233 268f45cc-cd09-0410-ab3c-d52691b4dbfc
18 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.list.am
Source/JavaScriptCore/JavaScriptCore.gypi
Source/JavaScriptCore/JavaScriptCore.vcproj/WTF/WTF.vcproj
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/jit/ExecutableAllocator.h
Source/JavaScriptCore/parser/SourceProvider.h
Source/JavaScriptCore/runtime/RegExp.cpp
Source/JavaScriptCore/wtf/CMakeLists.txt
Source/JavaScriptCore/wtf/RefCounted.h
Source/JavaScriptCore/wtf/SizeLimits.cpp
Source/JavaScriptCore/wtf/ThreadRestrictionVerifier.h [new file with mode: 0644]
Source/JavaScriptCore/wtf/text/CString.h
Source/JavaScriptGlue/ChangeLog
Source/JavaScriptGlue/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/ForwardingHeaders/wtf/ThreadRestrictionVerifier.h [new file with mode: 0644]
Source/WebCore/loader/icon/IconDatabase.cpp