Changeset 161999 in webkit


Ignore:
Timestamp:
Jan 14, 2014 1:38:38 PM (10 years ago)
Author:
andersca@apple.com
Message:

Get rid of ThreadRestrictionVerifier
https://bugs.webkit.org/show_bug.cgi?id=127004

Reviewed by Sam Weinig.

Source/WebCore:

Remove now unneeded calls.

  • loader/icon/IconDatabase.cpp:

(WebCore::IconDatabase::defaultIcon):
(WebCore::IconDatabase::setIconDataForIconURL):
(WebCore::IconDatabase::getOrCreateIconRecord):
(WebCore::IconDatabase::readFromDatabase):

Source/WTF:

The ThreadRestrictionVerifier mechanism has been turned off for a while
since it doesn't really have a good solution for objects that are passed between threads.
Instead of having dead code in the tree, just get rid of it.

  • GNUmakefile.list.am:
  • WTF.vcxproj/WTF.vcxproj:
  • WTF.vcxproj/WTF.vcxproj.filters:
  • WTF.xcodeproj/project.pbxproj:
  • wtf/CMakeLists.txt:
  • wtf/RefCounted.h:

(WTF::RefCountedBase::ref):
(WTF::RefCountedBase::hasOneRef):
(WTF::RefCountedBase::refCount):
(WTF::RefCountedBase::derefBase):

  • wtf/ThreadRestrictionVerifier.h: Removed.
Location:
trunk/Source
Files:
1 deleted
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r161993 r161999  
     12014-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
    1242014-01-14  Benjamin Poulain  <benjamin@webkit.org>
    225
  • trunk/Source/WTF/GNUmakefile.list.am

    r161770 r161999  
    170170    Source/WTF/wtf/ThreadIdentifierDataPthreads.cpp \
    171171    Source/WTF/wtf/ThreadIdentifierDataPthreads.h \
    172     Source/WTF/wtf/ThreadRestrictionVerifier.h \
    173172    Source/WTF/wtf/ThreadSafeRefCounted.h \
    174173    Source/WTF/wtf/ThreadSpecific.h \
  • trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj

    r161770 r161999  
    296296    <ClInclude Include="..\wtf\Threading.h" />
    297297    <ClInclude Include="..\wtf\ThreadingPrimitives.h" />
    298     <ClInclude Include="..\wtf\ThreadRestrictionVerifier.h" />
    299298    <ClInclude Include="..\wtf\threadsafeRefCounted.h" />
    300299    <ClInclude Include="..\wtf\threadspecific.h" />
  • trunk/Source/WTF/WTF.vcxproj/WTF.vcxproj.filters

    r161770 r161999  
    650650    </ClInclude>
    651651    <ClInclude Include="..\wtf\ThreadingPrimitives.h">
    652       <Filter>wtf</Filter>
    653     </ClInclude>
    654     <ClInclude Include="..\wtf\ThreadRestrictionVerifier.h">
    655652      <Filter>wtf</Filter>
    656653    </ClInclude>
  • trunk/Source/WTF/WTF.xcodeproj/project.pbxproj

    r161879 r161999  
    247247                A8A4744D151A825B004123FF /* ThreadingPrimitives.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47335151A825B004123FF /* ThreadingPrimitives.h */; };
    248248                A8A4744E151A825B004123FF /* ThreadingPthreads.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A47336151A825B004123FF /* ThreadingPthreads.cpp */; };
    249                 A8A47450151A825B004123FF /* ThreadRestrictionVerifier.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */; };
    250249                A8A47451151A825B004123FF /* BinarySemaphore.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A8A4733A151A825B004123FF /* BinarySemaphore.cpp */; };
    251250                A8A47452151A825B004123FF /* BinarySemaphore.h in Headers */ = {isa = PBXBuildFile; fileRef = A8A4733B151A825B004123FF /* BinarySemaphore.h */; };
     
    525524                A8A47335151A825B004123FF /* ThreadingPrimitives.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ThreadingPrimitives.h; sourceTree = "<group>"; };
    526525                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>"; };
    528526                A8A4733A151A825B004123FF /* BinarySemaphore.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = BinarySemaphore.cpp; sourceTree = "<group>"; };
    529527                A8A4733B151A825B004123FF /* BinarySemaphore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = BinarySemaphore.h; sourceTree = "<group>"; };
     
    828826                                A8A47335151A825B004123FF /* ThreadingPrimitives.h */,
    829827                                A8A47336151A825B004123FF /* ThreadingPthreads.cpp */,
    830                                 A8A47338151A825B004123FF /* ThreadRestrictionVerifier.h */,
    831828                                A8A4733E151A825B004123FF /* ThreadSafeRefCounted.h */,
    832829                                A8A4733F151A825B004123FF /* ThreadSpecific.h */,
     
    11181115                                A8A4744B151A825B004123FF /* Threading.h in Headers */,
    11191116                                A8A4744D151A825B004123FF /* ThreadingPrimitives.h in Headers */,
    1120                                 A8A47450151A825B004123FF /* ThreadRestrictionVerifier.h in Headers */,
    11211117                                A8A47454151A825B004123FF /* ThreadSafeRefCounted.h in Headers */,
    11221118                                A8A47455151A825B004123FF /* ThreadSpecific.h in Headers */,
  • trunk/Source/WTF/wtf/CMakeLists.txt

    r161770 r161999  
    102102    TCSystemAlloc.h
    103103    ThreadIdentifierDataPthreads.h
    104     ThreadRestrictionVerifier.h
    105104    ThreadSafeRefCounted.h
    106105    ThreadSpecific.h
  • trunk/Source/WTF/wtf/RefCounted.h

    r155251 r161999  
    2626#include <wtf/Noncopyable.h>
    2727#include <wtf/OwnPtr.h>
    28 #include <wtf/ThreadRestrictionVerifier.h>
    2928
    3029namespace WTF {
     
    4443    {
    4544#if CHECK_REF_COUNTED_LIFECYCLE
    46         // Start thread verification as soon as the ref count gets to 2. This
    47         // heuristic reflects the fact that items are often created on one thread
    48         // and then given to another thread to be used.
    49         // FIXME: Make this restriction tigher. Especially as we move to more
    50         // common methods for sharing items across threads like CrossThreadCopier.h
    51         // 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 or
    55         // that the verification needs to change. See ThreadRestrictionVerifier for
    56         // the different modes.
    57         ASSERT(m_verifier.isSafeToUse());
    5845        ASSERT(!m_deletionHasBegun);
    5946        ASSERT(!m_adoptionIsRequired);
     
    6552    {
    6653#if CHECK_REF_COUNTED_LIFECYCLE
    67         ASSERT(m_verifier.isSafeToUse());
    6854        ASSERT(!m_deletionHasBegun);
    6955#endif
     
    7359    unsigned refCount() const
    7460    {
    75 #if CHECK_REF_COUNTED_LIFECYCLE
    76         ASSERT(m_verifier.isSafeToUse());
    77 #endif
    7861        return m_refCount;
    79     }
    80 
    81     void setMutexForVerifier(Mutex&);
    82 
    83 #if HAVE(DISPATCH_H)
    84     void setDispatchQueueForVerifier(dispatch_queue_t);
    85 #endif
    86 
    87     // Turns off verification. Use of this method is discouraged (instead extend
    88     // ThreadRestrictionVerifier to verify your case).
    89     // NB. It is necessary to call this in the constructor of many objects in
    90     // JavaScriptCore, because JavaScriptCore objects may be used from multiple
    91     // threads even if the reference counting is done in a racy manner. This is
    92     // because a JSC instance may be used from multiple threads so long as all
    93     // accesses into that instance are protected by a per-instance lock. It would
    94     // be absolutely wrong to prohibit this pattern, and it would be a disastrous
    95     // 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_LIFECYCLE
    100         m_verifier.turnOffVerification();
    101 #endif
    10262    }
    10363
     
    13393    {
    13494#if CHECK_REF_COUNTED_LIFECYCLE
    135         ASSERT(m_verifier.isSafeToUse());
    13695        ASSERT(!m_deletionHasBegun);
    13796        ASSERT(!m_adoptionIsRequired);
     
    147106        }
    148107        m_refCount = tempRefCount;
    149 
    150 #if CHECK_REF_COUNTED_LIFECYCLE
    151         // Stop thread verification when the ref goes to 1 because it
    152         // is safe to be passed to another thread at this point.
    153         if (m_refCount == 1)
    154             m_verifier.setShared(false);
    155 #endif
    156108        return false;
    157109    }
     
    174126    bool m_deletionHasBegun;
    175127    bool m_adoptionIsRequired;
    176     ThreadRestrictionVerifier m_verifier;
    177128#endif
    178129};
     
    220171};
    221172
    222 #if CHECK_REF_COUNTED_LIFECYCLE
    223 inline void RefCountedBase::setMutexForVerifier(Mutex& mutex)
    224 {
    225     m_verifier.setMutexMode(mutex);
    226 }
    227 #else
    228 inline void RefCountedBase::setMutexForVerifier(Mutex&) { }
    229 #endif
    230 
    231 #if HAVE(DISPATCH_H)
    232 #if CHECK_REF_COUNTED_LIFECYCLE
    233 inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t queue)
    234 {
    235     m_verifier.setDispatchQueueMode(queue);
    236 }
    237 #else
    238 inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t) { }
    239 #endif
    240 #endif // HAVE(DISPATCH_H)
    241 
    242173} // namespace WTF
    243174
  • trunk/Source/WebCore/ChangeLog

    r161997 r161999  
     12014-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
    1162014-01-14  Daniel Bates  <dabates@apple.com>
    217
  • trunk/Source/WebCore/loader/icon/IconDatabase.cpp

    r161995 r161999  
    403403    if (!m_defaultIconRecord) {
    404404        m_defaultIconRecord = IconRecord::create("urlIcon");
    405         m_defaultIconRecord->setMutexForVerifier(m_urlAndIconLock);
    406405        loadDefaultIconRecord(m_defaultIconRecord.get());
    407406    }
     
    545544   
    546545    RefPtr<SharedBuffer> data = dataOriginal ? dataOriginal->copy() : PassRefPtr<SharedBuffer>(0);
    547     if (data)
    548         data->setMutexForVerifier(m_urlAndIconLock);
    549546    String iconURL = iconURLOriginal.isolatedCopy();
    550547   
     
    910907
    911908    RefPtr<IconRecord> newIcon = IconRecord::create(iconURL);
    912     newIcon->setMutexForVerifier(m_urlAndIconLock);
    913909    m_iconURLToRecordMap.set(iconURL, newIcon.get());
    914910
     
    15071503        didAnyWork = true;
    15081504        RefPtr<SharedBuffer> imageData = getImageDataForIconURLFromSQLDatabase(icons[i]->iconURL());
    1509         imageData->setMutexForVerifier(m_urlAndIconLock);
    15101505
    15111506        // Verify this icon still wants to be read from disk
Note: See TracChangeset for help on using the changeset viewer.