Changeset 248544 in webkit
- Timestamp:
- Aug 12, 2019 1:15:26 PM (5 years ago)
- Location:
- trunk/Source/WTF
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r248533 r248544 1 2019-08-12 Chris Dumez <cdumez@apple.com> 2 3 Unreviewed, fix post landing review comments for r248533 from Darin. 4 5 * wtf/RefCounted.h: 6 (WTF::RefCountedBase::ref const): 7 (WTF::RefCountedBase::applyRefDerefThreadingCheck const): 8 (WTF::RefCountedBase::derefBase const): 9 (WTF::RefCountedBase::areThreadingCheckedEnabled const): Deleted. 10 1 11 2019-08-12 Chris Dumez <cdumez@apple.com> 2 12 -
trunk/Source/WTF/wtf/RefCounted.h
r248533 r248544 41 41 void ref() const 42 42 { 43 #if !ASSERT_DISABLED 44 if (m_isOwnedByMainThread != isMainThread() && hasOneRef()) 45 m_isOwnedByMainThread = isMainThread(); // Likely ownership transfer. 46 47 // If you hit this assertion, it means that the RefCounted object was ref'd or deref'd 48 // concurrent from several threads, which is not safe. You should either subclass 49 // ThreadSafeRefCounted instead, or make sure to always ref / deref from the same thread. 50 ASSERT_WITH_MESSAGE(!areThreadingCheckedEnabled() || m_isOwnedByMainThread == isMainThread(), "Should not be ref'd / deref'd concurrently from several threads"); 51 #endif 43 applyRefDerefThreadingCheck(); 52 44 53 45 #if CHECK_REF_COUNTED_LIFECYCLE … … 109 101 } 110 102 111 #if !ASSERT_DISABLED 112 bool areThreadingCheckedEnabled() const 113 { 114 return areThreadingChecksEnabledGlobally && m_areThreadingChecksEnabled; 115 } 116 #endif 103 void applyRefDerefThreadingCheck() const 104 { 105 #if !ASSERT_DISABLED 106 if (hasOneRef()) { 107 // Likely an ownership transfer across threads that may be safe. 108 m_isOwnedByMainThread = isMainThread(); 109 } else if (areThreadingChecksEnabledGlobally && m_areThreadingChecksEnabled) { 110 // If you hit this assertion, it means that the RefCounted object was ref/deref'd 111 // from both the main thread and another in a way that is likely concurrent and unsafe. 112 // Derive from ThreadSafeRefCounted and make sure the destructor is safe on threads 113 // that call deref, or ref/deref from a single thread. 114 ASSERT_WITH_MESSAGE(m_isOwnedByMainThread == isMainThread(), "Unsafe to ref/deref from different threads"); 115 } 116 #endif 117 } 117 118 118 119 ~RefCountedBase() … … 127 128 bool derefBase() const 128 129 { 129 #if !ASSERT_DISABLED 130 if (m_isOwnedByMainThread != isMainThread() && hasOneRef()) 131 m_isOwnedByMainThread = isMainThread(); // Likely ownership transfer. 132 133 // If you hit this assertion, it means that the RefCounted object was ref'd or deref'd 134 // concurrent from several threads, which is not safe. You should either subclass 135 // ThreadSafeRefCounted instead, or make sure to always ref / deref from the same thread. 136 ASSERT_WITH_MESSAGE(!areThreadingCheckedEnabled() || m_isOwnedByMainThread == isMainThread(), "Should not be ref'd / deref'd concurrently from several threads"); 137 #endif 130 applyRefDerefThreadingCheck(); 138 131 139 132 #if CHECK_REF_COUNTED_LIFECYCLE
Note: See TracChangeset
for help on using the changeset viewer.