Title: [250765] trunk/Source/WTF
Revision
250765
Author
rn...@webkit.org
Date
2019-10-04 20:15:02 -0700 (Fri, 04 Oct 2019)

Log Message

Unreviewed, rolling out r250762.
https://bugs.webkit.org/show_bug.cgi?id=202609

Broke JSC tests by breaking refCount check in
DropAllLocks::DropAllLocks (Requested by rniwa on #webkit).

Reverted changeset:

"Make a ThreadSafeRefCounted object safe to ref & deref inside
its destructor"
https://bugs.webkit.org/show_bug.cgi?id=201576
https://trac.webkit.org/changeset/250762

Patch by Commit Queue <commit-qu...@webkit.org> on 2019-10-04

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (250764 => 250765)


--- trunk/Source/WTF/ChangeLog	2019-10-05 03:02:58 UTC (rev 250764)
+++ trunk/Source/WTF/ChangeLog	2019-10-05 03:15:02 UTC (rev 250765)
@@ -1,3 +1,18 @@
+2019-10-04  Commit Queue  <commit-qu...@webkit.org>
+
+        Unreviewed, rolling out r250762.
+        https://bugs.webkit.org/show_bug.cgi?id=202609
+
+        Broke JSC tests by breaking refCount check in
+        DropAllLocks::DropAllLocks (Requested by rniwa on #webkit).
+
+        Reverted changeset:
+
+        "Make a ThreadSafeRefCounted object safe to ref & deref inside
+        its destructor"
+        https://bugs.webkit.org/show_bug.cgi?id=201576
+        https://trac.webkit.org/changeset/250762
+
 2019-10-04  Ryosuke Niwa  <rn...@webkit.org>
 
         Build fix for macOS Catalina.

Modified: trunk/Source/WTF/wtf/ThreadSafeRefCounted.h (250764 => 250765)


--- trunk/Source/WTF/wtf/ThreadSafeRefCounted.h	2019-10-05 03:02:58 UTC (rev 250764)
+++ trunk/Source/WTF/wtf/ThreadSafeRefCounted.h	2019-10-05 03:15:02 UTC (rev 250765)
@@ -32,12 +32,6 @@
 
 namespace WTF {
 
-#if defined(NDEBUG) && !ENABLE(SECURITY_ASSERTIONS)
-#define CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE 0
-#else
-#define CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE 1
-#endif
-
 class ThreadSafeRefCountedBase {
     WTF_MAKE_NONCOPYABLE(ThreadSafeRefCountedBase);
     WTF_MAKE_FAST_ALLOCATED;
@@ -44,27 +38,13 @@
 public:
     ThreadSafeRefCountedBase() = default;
 
-#if CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE
-    ~ThreadSafeRefCountedBase()
-    {
-        // When this ThreadSafeRefCounted object is a part of another object, derefBase() is never called on this object.
-        m_deletionHasBegun = true;
-    }
-#endif
-
     void ref() const
     {
-#if CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE
-        ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
-#endif
         ++m_refCount;
     }
 
     bool hasOneRef() const
     {
-#if CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE
-        ASSERT(!m_deletionHasBegun);
-#endif
         return refCount() == 1;
     }
 
@@ -77,31 +57,11 @@
     // Returns whether the pointer should be freed or not.
     bool derefBase() const
     {
-        ASSERT(m_refCount);
-
-#if CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE
-        ASSERT_WITH_SECURITY_IMPLICATION(!m_deletionHasBegun);
-#endif
-
-        if (UNLIKELY(!--m_refCount)) {
-            // Setting m_refCount to 1 here prevents double delete within the destructor but not from another thread
-            // since such a thread could have ref'ed this object long after it had been deleted. See webkit.org/b/201576.
-            m_refCount = 1;
-#if CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE
-            m_deletionHasBegun = true;
-#endif
-            return true;
-        }
-
-        return false;
+        return !--m_refCount;
     }
 
 private:
     mutable std::atomic<unsigned> m_refCount { 1 };
-
-#if CHECK_THREAD_SAFE_REF_COUNTED_LIFECYCLE
-    mutable std::atomic<bool> m_deletionHasBegun { false };
-#endif
 };
 
 enum class DestructionThread { Any, Main, MainRunLoop };
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to