Title: [259593] trunk
Revision
259593
Author
[email protected]
Date
2020-04-06 13:48:29 -0700 (Mon, 06 Apr 2020)

Log Message

[ Mac wk2 ] http/tests/media/track-in-band-hls-metadata.html is flaky crashing.
https://bugs.webkit.org/show_bug.cgi?id=209490
<rdar://problem/60837555>

Reviewed by Darin Adler.

Source/WebCore:

To ensure the TaskDispatcher doesn't get destroyed on a background thread at the same time it's
executing tasks on the main thread, when a GenericTaskQueue is destroyed on a background thread,
move the TaskDispatcher into a task, and use the dispatcher itself to destroy itself on the
main thread.

* platform/GenericTaskQueue.h:
(WebCore::GenericTaskQueue::GenericTaskQueue):
(WebCore::GenericTaskQueue::~GenericTaskQueue):
(WebCore::GenericTaskQueue::enqueueTask):

LayoutTests:

* platform/mac-wk2/TestExpectations:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (259592 => 259593)


--- trunk/LayoutTests/ChangeLog	2020-04-06 20:37:13 UTC (rev 259592)
+++ trunk/LayoutTests/ChangeLog	2020-04-06 20:48:29 UTC (rev 259593)
@@ -1,3 +1,13 @@
+2020-04-06  Jer Noble  <[email protected]>
+
+        [ Mac wk2 ] http/tests/media/track-in-band-hls-metadata.html is flaky crashing.
+        https://bugs.webkit.org/show_bug.cgi?id=209490
+        <rdar://problem/60837555>
+
+        Reviewed by Darin Adler.
+
+        * platform/mac-wk2/TestExpectations:
+
 2020-04-06  Manuel Rego Casasnovas  <[email protected]>
 
         [GTK][WPE] Re-enable WPT web-animations animation-types tests and updating baselines

Modified: trunk/LayoutTests/platform/mac-wk2/TestExpectations (259592 => 259593)


--- trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-04-06 20:37:13 UTC (rev 259592)
+++ trunk/LayoutTests/platform/mac-wk2/TestExpectations	2020-04-06 20:48:29 UTC (rev 259593)
@@ -1029,8 +1029,6 @@
 
 webkit.org/b/209483 imported/w3c/web-platform-tests/notifications/event-onclose.html [ Pass Failure ]
 
-webkit.org/b/209490 http/tests/media/track-in-band-hls-metadata.html [ Pass Crash Timeout ]
-
 webkit.org/b/209503 [ Debug ] http/tests/referrer-policy-anchor/origin/cross-origin-http.https.html [ Pass Crash ]
 
 webkit.org/b/209564 svg/as-image/svg-image-with-data-uri-background.html [ Pass ImageOnlyFailure ]

Modified: trunk/Source/WebCore/ChangeLog (259592 => 259593)


--- trunk/Source/WebCore/ChangeLog	2020-04-06 20:37:13 UTC (rev 259592)
+++ trunk/Source/WebCore/ChangeLog	2020-04-06 20:48:29 UTC (rev 259593)
@@ -1,3 +1,21 @@
+2020-04-06  Jer Noble  <[email protected]>
+
+        [ Mac wk2 ] http/tests/media/track-in-band-hls-metadata.html is flaky crashing.
+        https://bugs.webkit.org/show_bug.cgi?id=209490
+        <rdar://problem/60837555>
+
+        Reviewed by Darin Adler.
+
+        To ensure the TaskDispatcher doesn't get destroyed on a background thread at the same time it's
+        executing tasks on the main thread, when a GenericTaskQueue is destroyed on a background thread,
+        move the TaskDispatcher into a task, and use the dispatcher itself to destroy itself on the
+        main thread.
+
+        * platform/GenericTaskQueue.h:
+        (WebCore::GenericTaskQueue::GenericTaskQueue):
+        (WebCore::GenericTaskQueue::~GenericTaskQueue):
+        (WebCore::GenericTaskQueue::enqueueTask):
+
 2020-04-06  Antti Koivisto  <[email protected]>
 
         'currentcolor' doesn't need setHasExplicitlyInheritedProperties marking anymore

Modified: trunk/Source/WebCore/platform/GenericTaskQueue.h (259592 => 259593)


--- trunk/Source/WebCore/platform/GenericTaskQueue.h	2020-04-06 20:37:13 UTC (rev 259592)
+++ trunk/Source/WebCore/platform/GenericTaskQueue.h	2020-04-06 20:48:29 UTC (rev 259593)
@@ -28,6 +28,8 @@
 #include "Timer.h"
 #include <wtf/Deque.h>
 #include <wtf/Function.h>
+#include <wtf/MainThread.h>
+#include <wtf/UniqueRef.h>
 #include <wtf/WeakPtr.h>
 
 namespace WTF {
@@ -38,6 +40,7 @@
 
 template <typename T>
 class TaskDispatcher {
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     explicit TaskDispatcher(T* context)
         : m_context(context)
@@ -56,6 +59,7 @@
 
 template<>
 class TaskDispatcher<Timer> : public CanMakeWeakPtr<TaskDispatcher<Timer>> {
+    WTF_MAKE_FAST_ALLOCATED;
 public:
     TaskDispatcher();
     void postTask(Function<void()>&&);
@@ -76,21 +80,27 @@
     WTF_MAKE_FAST_ALLOCATED;
 public:
     GenericTaskQueue()
-        : m_dispatcher()
+        : m_dispatcher(makeUniqueRef<TaskDispatcher<T>>())
     {
     }
 
     explicit GenericTaskQueue(T& t)
-        : m_dispatcher(&t)
+        : m_dispatcher(makeUniqueRef<TaskDispatcher<T>>(&t))
     {
     }
 
     explicit GenericTaskQueue(T* t)
-        : m_dispatcher(t)
+        : m_dispatcher(makeUniqueRef<TaskDispatcher<T>>(t))
         , m_isClosed(!t)
     {
     }
 
+    ~GenericTaskQueue()
+    {
+        if (!isMainThread())
+            m_dispatcher->postTask([dispatcher = WTFMove(m_dispatcher)] { });
+    }
+
     typedef WTF::Function<void ()> TaskFunction;
 
     void enqueueTask(TaskFunction&& task)
@@ -99,7 +109,7 @@
             return;
 
         ++m_pendingTasks;
-        m_dispatcher.postTask([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
+        m_dispatcher->postTask([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
             if (!weakThis)
                 return;
             ASSERT(weakThis->m_pendingTasks);
@@ -124,7 +134,7 @@
     bool isClosed() const { return m_isClosed; }
 
 private:
-    TaskDispatcher<T> m_dispatcher;
+    UniqueRef<TaskDispatcher<T>> m_dispatcher;
     unsigned m_pendingTasks { 0 };
     bool m_isClosed { false };
 };
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to