Changeset 161999 in webkit
- Timestamp:
- Jan 14, 2014 1:38:38 PM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 1 deleted
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r161993 r161999 1 2014-01-14 Anders Carlsson <andersca@apple.com> 2 3 Get rid of ThreadRestrictionVerifier 4 https://bugs.webkit.org/show_bug.cgi?id=127004 5 6 Reviewed by Sam Weinig. 7 8 The ThreadRestrictionVerifier mechanism has been turned off for a while 9 since it doesn't really have a good solution for objects that are passed between threads. 10 Instead of having dead code in the tree, just get rid of it. 11 12 * GNUmakefile.list.am: 13 * WTF.vcxproj/WTF.vcxproj: 14 * WTF.vcxproj/WTF.vcxproj.filters: 15 * WTF.xcodeproj/project.pbxproj: 16 * wtf/CMakeLists.txt: 17 * wtf/RefCounted.h: 18 (WTF::RefCountedBase::ref): 19 (WTF::RefCountedBase::hasOneRef): 20 (WTF::RefCountedBase::refCount): 21 (WTF::RefCountedBase::derefBase): 22 * wtf/ThreadRestrictionVerifier.h: Removed. 23 1 24 2014-01-14 Benjamin Poulain <benjamin@webkit.org> 2 25 -
trunk/Source/WTF/GNUmakefile.list.am
r161770 r161999 170 170 Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp \ 171 171 Source/WTF/wtf/ThreadIdentifierDataPthreads.h \ 172 Source/WTF/wtf/ThreadRestrictionVerifier.h \173 172 Source/WTF/wtf/ThreadSafeRefCounted.h \ 174 173 Source/WTF/wtf/ThreadSpecific.h \ -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj
r161770 r161999 296 296 <ClInclude Include="..\wtf\Threading.h" /> 297 297 <ClInclude Include="..\wtf\ThreadingPrimitives.h" /> 298 <ClInclude Include="..\wtf\ThreadRestrictionVerifier.h" />299 298 <ClInclude Include="..\wtf\threadsafeRefCounted.h" /> 300 299 <ClInclude Include="..\wtf\threadspecific.h" /> -
trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
r161770 r161999 650 650 </ClInclude> 651 651 <ClInclude Include="..\wtf\ThreadingPrimitives.h"> 652 <Filter>wtf</Filter>653 </ClInclude>654 <ClInclude Include="..\wtf\ThreadRestrictionVerifier.h">655 652 <Filter>wtf</Filter> 656 653 </ClInclude> -
trunk/Source/WTF/WTF.xcodeproj/project.pbxproj
r161879 r161999 247 247 A8A4744D151A825B004123FF /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47335151A825B004123FF /* ThreadingPrimitives.h */; }; 248 248 A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47336151A825B004123FF /* ThreadingPthreads.cpp */; }; 249 A8A47450151A825B004123FF /* ThreadRestrictionVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */; };250 249 A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4733A151A825B004123FF /* BinarySemaphore.cpp */; }; 251 250 A8A47452151A825B004123FF /* BinarySemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4733B151A825B004123FF /* BinarySemaphore.h */; }; … … 525 524 A8A47335151A825B004123FF /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; }; 526 525 A8A47336151A825B004123FF /* ThreadingPthreads.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ThreadingPthreads.cpp; sourceTree = "<group>"; }; 527 A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadRestrictionVerifier.h; sourceTree = "<group>"; };528 526 A8A4733A151A825B004123FF /* BinarySemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinarySemaphore.cpp; sourceTree = "<group>"; }; 529 527 A8A4733B151A825B004123FF /* BinarySemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinarySemaphore.h; sourceTree = "<group>"; }; … … 828 826 A8A47335151A825B004123FF /* ThreadingPrimitives.h */, 829 827 A8A47336151A825B004123FF /* ThreadingPthreads.cpp */, 830 A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */,831 828 A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */, 832 829 A8A4733F151A825B004123FF /* ThreadSpecific.h */, … … 1118 1115 A8A4744B151A825B004123FF /* Threading.h in Headers */, 1119 1116 A8A4744D151A825B004123FF /* ThreadingPrimitives.h in Headers */, 1120 A8A47450151A825B004123FF /* ThreadRestrictionVerifier.h in Headers */,1121 1117 A8A47454151A825B004123FF /* ThreadSafeRefCounted.h in Headers */, 1122 1118 A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */, -
trunk/Source/WTF/wtf/CMakeLists.txt
r161770 r161999 102 102 TCSystemAlloc.h 103 103 ThreadIdentifierDataPthreads.h 104 ThreadRestrictionVerifier.h105 104 ThreadSafeRefCounted.h 106 105 ThreadSpecific.h -
trunk/Source/WTF/wtf/RefCounted.h
r155251 r161999 26 26 #include <wtf/Noncopyable.h> 27 27 #include <wtf/OwnPtr.h> 28 #include <wtf/ThreadRestrictionVerifier.h>29 28 30 29 namespace WTF { … … 44 43 { 45 44 #if CHECK_REF_COUNTED_LIFECYCLE 46 // Start thread verification as soon as the ref count gets to 2. This47 // heuristic reflects the fact that items are often created on one thread48 // and then given to another thread to be used.49 // FIXME: Make this restriction tigher. Especially as we move to more50 // common methods for sharing items across threads like CrossThreadCopier.h51 // We should be able to add a "detachFromThread" method to make this explicit.52 if (m_refCount == 1)53 m_verifier.setShared(true);54 // If this assert fires, it either indicates a thread safety issue or55 // that the verification needs to change. See ThreadRestrictionVerifier for56 // the different modes.57 ASSERT(m_verifier.isSafeToUse());58 45 ASSERT(!m_deletionHasBegun); 59 46 ASSERT(!m_adoptionIsRequired); … … 65 52 { 66 53 #if CHECK_REF_COUNTED_LIFECYCLE 67 ASSERT(m_verifier.isSafeToUse());68 54 ASSERT(!m_deletionHasBegun); 69 55 #endif … … 73 59 unsigned refCount() const 74 60 { 75 #if CHECK_REF_COUNTED_LIFECYCLE76 ASSERT(m_verifier.isSafeToUse());77 #endif78 61 return m_refCount; 79 }80 81 void setMutexForVerifier(Mutex&);82 83 #if HAVE(DISPATCH_H)84 void setDispatchQueueForVerifier(dispatch_queue_t);85 #endif86 87 // Turns off verification. Use of this method is discouraged (instead extend88 // ThreadRestrictionVerifier to verify your case).89 // NB. It is necessary to call this in the constructor of many objects in90 // JavaScriptCore, because JavaScriptCore objects may be used from multiple91 // threads even if the reference counting is done in a racy manner. This is92 // because a JSC instance may be used from multiple threads so long as all93 // accesses into that instance are protected by a per-instance lock. It would94 // be absolutely wrong to prohibit this pattern, and it would be a disastrous95 // regression to require that the objects within that instance use a thread-96 // safe version of reference counting.97 void turnOffVerifier()98 {99 #if CHECK_REF_COUNTED_LIFECYCLE100 m_verifier.turnOffVerification();101 #endif102 62 } 103 63 … … 133 93 { 134 94 #if CHECK_REF_COUNTED_LIFECYCLE 135 ASSERT(m_verifier.isSafeToUse());136 95 ASSERT(!m_deletionHasBegun); 137 96 ASSERT(!m_adoptionIsRequired); … … 147 106 } 148 107 m_refCount = tempRefCount; 149 150 #if CHECK_REF_COUNTED_LIFECYCLE151 // Stop thread verification when the ref goes to 1 because it152 // is safe to be passed to another thread at this point.153 if (m_refCount == 1)154 m_verifier.setShared(false);155 #endif156 108 return false; 157 109 } … … 174 126 bool m_deletionHasBegun; 175 127 bool m_adoptionIsRequired; 176 ThreadRestrictionVerifier m_verifier;177 128 #endif 178 129 }; … … 220 171 }; 221 172 222 #if CHECK_REF_COUNTED_LIFECYCLE223 inline void RefCountedBase::setMutexForVerifier(Mutex& mutex)224 {225 m_verifier.setMutexMode(mutex);226 }227 #else228 inline void RefCountedBase::setMutexForVerifier(Mutex&) { }229 #endif230 231 #if HAVE(DISPATCH_H)232 #if CHECK_REF_COUNTED_LIFECYCLE233 inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t queue)234 {235 m_verifier.setDispatchQueueMode(queue);236 }237 #else238 inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t) { }239 #endif240 #endif // HAVE(DISPATCH_H)241 242 173 } // namespace WTF 243 174 -
trunk/Source/WebCore/ChangeLog
r161997 r161999 1 2014-01-14 Anders Carlsson <andersca@apple.com> 2 3 Get rid of ThreadRestrictionVerifier 4 https://bugs.webkit.org/show_bug.cgi?id=127004 5 6 Reviewed by Sam Weinig. 7 8 Remove now unneeded calls. 9 10 * loader/icon/IconDatabase.cpp: 11 (WebCore::IconDatabase::defaultIcon): 12 (WebCore::IconDatabase::setIconDataForIconURL): 13 (WebCore::IconDatabase::getOrCreateIconRecord): 14 (WebCore::IconDatabase::readFromDatabase): 15 1 16 2014-01-14 Daniel Bates <dabates@apple.com> 2 17 -
trunk/Source/WebCore/loader/icon/IconDatabase.cpp
r161995 r161999 403 403 if (!m_defaultIconRecord) { 404 404 m_defaultIconRecord = IconRecord::create("urlIcon"); 405 m_defaultIconRecord->setMutexForVerifier(m_urlAndIconLock);406 405 loadDefaultIconRecord(m_defaultIconRecord.get()); 407 406 } … … 545 544 546 545 RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0); 547 if (data)548 data->setMutexForVerifier(m_urlAndIconLock);549 546 String iconURL = iconURLOriginal.isolatedCopy(); 550 547 … … 910 907 911 908 RefPtr<IconRecord> newIcon = IconRecord::create(iconURL); 912 newIcon->setMutexForVerifier(m_urlAndIconLock);913 909 m_iconURLToRecordMap.set(iconURL, newIcon.get()); 914 910 … … 1507 1503 didAnyWork = true; 1508 1504 RefPtr<SharedBuffer> imageData = getImageDataForIconURLFromSQLDatabase(icons[i]->iconURL()); 1509 imageData->setMutexForVerifier(m_urlAndIconLock);1510 1505 1511 1506 // Verify this icon still wants to be read from disk
Note: See TracChangeset
for help on using the changeset viewer.