Changeset 259593 in webkit


Ignore:
Timestamp:
Apr 6, 2020 1:48:29 PM (4 years ago)
Author:
jer.noble@apple.com
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:
Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r259592 r259593  
     12020-04-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [ Mac wk2 ] http/tests/media/track-in-band-hls-metadata.html is flaky crashing.
     4        https://bugs.webkit.org/show_bug.cgi?id=209490
     5        <rdar://problem/60837555>
     6
     7        Reviewed by Darin Adler.
     8
     9        * platform/mac-wk2/TestExpectations:
     10
    1112020-04-06  Manuel Rego Casasnovas  <rego@igalia.com>
    212
  • trunk/LayoutTests/platform/mac-wk2/TestExpectations

    r259570 r259593  
    10301030webkit.org/b/209483 imported/w3c/web-platform-tests/notifications/event-onclose.html [ Pass Failure ]
    10311031
    1032 webkit.org/b/209490 http/tests/media/track-in-band-hls-metadata.html [ Pass Crash Timeout ]
    1033 
    10341032webkit.org/b/209503 [ Debug ] http/tests/referrer-policy-anchor/origin/cross-origin-http.https.html [ Pass Crash ]
    10351033
  • trunk/Source/WebCore/ChangeLog

    r259585 r259593  
     12020-04-06  Jer Noble  <jer.noble@apple.com>
     2
     3        [ Mac wk2 ] http/tests/media/track-in-band-hls-metadata.html is flaky crashing.
     4        https://bugs.webkit.org/show_bug.cgi?id=209490
     5        <rdar://problem/60837555>
     6
     7        Reviewed by Darin Adler.
     8
     9        To ensure the TaskDispatcher doesn't get destroyed on a background thread at the same time it's
     10        executing tasks on the main thread, when a GenericTaskQueue is destroyed on a background thread,
     11        move the TaskDispatcher into a task, and use the dispatcher itself to destroy itself on the
     12        main thread.
     13
     14        * platform/GenericTaskQueue.h:
     15        (WebCore::GenericTaskQueue::GenericTaskQueue):
     16        (WebCore::GenericTaskQueue::~GenericTaskQueue):
     17        (WebCore::GenericTaskQueue::enqueueTask):
     18
    1192020-04-06  Antti Koivisto  <antti@apple.com>
    220
  • trunk/Source/WebCore/platform/GenericTaskQueue.h

    r259054 r259593  
    2929#include <wtf/Deque.h>
    3030#include <wtf/Function.h>
     31#include <wtf/MainThread.h>
     32#include <wtf/UniqueRef.h>
    3133#include <wtf/WeakPtr.h>
    3234
     
    3941template <typename T>
    4042class TaskDispatcher {
     43    WTF_MAKE_FAST_ALLOCATED;
    4144public:
    4245    explicit TaskDispatcher(T* context)
     
    5760template<>
    5861class TaskDispatcher<Timer> : public CanMakeWeakPtr<TaskDispatcher<Timer>> {
     62    WTF_MAKE_FAST_ALLOCATED;
    5963public:
    6064    TaskDispatcher();
     
    7781public:
    7882    GenericTaskQueue()
    79         : m_dispatcher()
     83        : m_dispatcher(makeUniqueRef<TaskDispatcher<T>>())
    8084    {
    8185    }
    8286
    8387    explicit GenericTaskQueue(T& t)
    84         : m_dispatcher(&t)
     88        : m_dispatcher(makeUniqueRef<TaskDispatcher<T>>(&t))
    8589    {
    8690    }
    8791
    8892    explicit GenericTaskQueue(T* t)
    89         : m_dispatcher(t)
     93        : m_dispatcher(makeUniqueRef<TaskDispatcher<T>>(t))
    9094        , m_isClosed(!t)
    9195    {
     96    }
     97
     98    ~GenericTaskQueue()
     99    {
     100        if (!isMainThread())
     101            m_dispatcher->postTask([dispatcher = WTFMove(m_dispatcher)] { });
    92102    }
    93103
     
    100110
    101111        ++m_pendingTasks;
    102         m_dispatcher.postTask([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
     112        m_dispatcher->postTask([weakThis = makeWeakPtr(*this), task = WTFMove(task)] {
    103113            if (!weakThis)
    104114                return;
     
    125135
    126136private:
    127     TaskDispatcher<T> m_dispatcher;
     137    UniqueRef<TaskDispatcher<T>> m_dispatcher;
    128138    unsigned m_pendingTasks { 0 };
    129139    bool m_isClosed { false };
Note: See TracChangeset for help on using the changeset viewer.