Changeset 92523 in webkit
- Timestamp:
- Aug 5, 2011 3:36:51 PM (13 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r92498 r92523 1 2011-08-05 Mark Rowe <mrowe@apple.com> 2 3 <http://webkit.org/b/65785> ThreadRestrictionVerifier needs a mode where an object 4 is tied to a particular dispatch queue 5 6 A RefCounted object can be opted in to this mode by calling setDispatchQueueForVerifier 7 with the dispatch queue it will be tied to. This will cause ThreadRestrictionVerifier 8 to ensure that all operations are performed on the given dispatch queue. 9 10 Reviewed by Anders Carlsson. 11 12 * wtf/RefCounted.h: 13 (WTF::RefCountedBase::setDispatchQueueForVerifier): 14 * wtf/ThreadRestrictionVerifier.h: 15 (WTF::ThreadRestrictionVerifier::ThreadRestrictionVerifier): 16 (WTF::ThreadRestrictionVerifier::~ThreadRestrictionVerifier): 17 (WTF::ThreadRestrictionVerifier::setDispatchQueueMode): 18 (WTF::ThreadRestrictionVerifier::setShared): 19 (WTF::ThreadRestrictionVerifier::isSafeToUse): 20 1 21 2011-08-05 Oliver Hunt <oliver@apple.com> 2 22 -
trunk/Source/JavaScriptCore/wtf/RefCounted.h
r92254 r92523 72 72 void setMutexForVerifier(Mutex&); 73 73 74 #if HAVE(DISPATCH_H) 75 void setDispatchQueueForVerifier(dispatch_queue_t); 76 #endif 77 74 78 // Turns off verification. Use of this method is discouraged (instead extend 75 79 // ThreadRestrictionVerifier to verify your case). … … 213 217 #endif 214 218 219 #if HAVE(DISPATCH_H) 220 #ifdef NDEBUG 221 inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t) { } 222 #else 223 inline void RefCountedBase::setDispatchQueueForVerifier(dispatch_queue_t queue) 224 { 225 m_verifier.setDispatchQueueMode(queue); 226 } 227 #endif // NDEBUG 228 #endif // HAVE(DISPATCH_H) 229 215 230 } // namespace WTF 216 231 -
trunk/Source/JavaScriptCore/wtf/ThreadRestrictionVerifier.h
r92254 r92523 36 36 #include <wtf/ThreadingPrimitives.h> 37 37 38 #if HAVE(DISPATCH_H) 39 #include <dispatch/dispatch.h> 40 #endif 41 38 42 #ifndef NDEBUG 39 43 … … 51 55 , m_owningThread(0) 52 56 , m_mutex(0) 57 #if HAVE(DISPATCH_H) 58 , m_owningQueue(0) 59 #endif 53 60 { 54 61 } 62 63 #if HAVE(DISPATCH_H) 64 ~ThreadRestrictionVerifier() 65 { 66 if (m_owningQueue) 67 dispatch_release(m_owningQueue); 68 } 69 #endif 55 70 56 71 void setMutexMode(Mutex& mutex) … … 60 75 m_mutex = &mutex; 61 76 } 77 78 #if HAVE(DISPATCH_H) 79 void setDispatchQueueMode(dispatch_queue_t queue) 80 { 81 ASSERT(m_mode == SingleThreadVerificationMode); 82 m_mode = SingleDispatchQueueVerificationMode; 83 m_owningQueue = queue; 84 dispatch_retain(m_owningQueue); 85 } 86 #endif 62 87 63 88 void turnOffVerification() … … 83 108 return; 84 109 110 #if HAVE(DISPATCH_H) 111 case SingleDispatchQueueVerificationMode: 112 #endif 85 113 case MutexVerificationMode: 86 114 case NoVerificationMode: … … 106 134 return false; 107 135 136 #if HAVE(DISPATCH_H) 137 case SingleDispatchQueueVerificationMode: 138 return m_owningQueue == dispatch_get_current_queue(); 139 #endif 140 108 141 case NoVerificationMode: 109 142 return true; … … 117 150 SingleThreadVerificationMode, 118 151 MutexVerificationMode, 119 NoVerificationMode 152 NoVerificationMode, 153 #if HAVE(DISPATCH_H) 154 SingleDispatchQueueVerificationMode, 155 #endif 120 156 }; 121 157 … … 128 164 // Used by MutexVerificationMode. 129 165 Mutex* m_mutex; 166 167 #if HAVE(DISPATCH_H) 168 // Used by SingleDispatchQueueVerificationMode. 169 dispatch_queue_t m_owningQueue; 170 #endif 130 171 }; 131 172
Note: See TracChangeset
for help on using the changeset viewer.