Unreviewed, rolling out r247292.
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jul 2019 20:13:26 +0000 (20:13 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Jul 2019 20:13:26 +0000 (20:13 +0000)
Caused CloseWebViewDuringEnterFullscreen.VideoFullscreen API
test to time out on Mojave bots

Reverted changeset:

"Stop using GenericTaskQueue from multiple threads"
https://bugs.webkit.org/show_bug.cgi?id=199652
https://trac.webkit.org/changeset/247292

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@247323 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/GenericTaskQueue.h
Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm

index f0e5b96..28d07eb 100644 (file)
@@ -1,3 +1,16 @@
+2019-07-10  Chris Dumez  <cdumez@apple.com>
+
+        Unreviewed, rolling out r247292.
+
+        Caused CloseWebViewDuringEnterFullscreen.VideoFullscreen API
+        test to time out on Mojave bots
+
+        Reverted changeset:
+
+        "Stop using GenericTaskQueue from multiple threads"
+        https://bugs.webkit.org/show_bug.cgi?id=199652
+        https://trac.webkit.org/changeset/247292
+
 2019-07-10  Robin Morisset  <rmorisset@apple.com>
 
         [WHLSL] Track code locations correctly throughout the compiler to get good error messages
index 43ae593..a0ce302 100644 (file)
@@ -71,8 +71,8 @@ private:
     Deque<WTF::Function<void()>> m_pendingTasks;
 };
 
-template <typename T>
-class GenericTaskQueue : public CanMakeWeakPtr<GenericTaskQueue<T>> {
+template <typename T, typename C = unsigned>
+class GenericTaskQueue : public CanMakeWeakPtr<GenericTaskQueue<T, C>> {
 public:
     GenericTaskQueue()
         : m_dispatcher()
@@ -124,7 +124,7 @@ public:
 
 private:
     TaskDispatcher<T> m_dispatcher;
-    unsigned m_pendingTasks { 0 };
+    C m_pendingTasks { 0 };
     bool m_isClosed { false };
 };
 
index 0d44d83..4da85b2 100644 (file)
@@ -169,6 +169,7 @@ enum MediaPlayerAVFoundationObservationContext {
 @interface WebCoreAVFMovieObserver : NSObject <AVPlayerItemLegibleOutputPushDelegate>
 {
     WeakPtr<MediaPlayerPrivateAVFoundationObjC> m_player;
+    GenericTaskQueue<Timer, std::atomic<unsigned>> m_taskQueue;
     int m_delayCallbacks;
 }
 -(id)initWithPlayer:(WeakPtr<MediaPlayerPrivateAVFoundationObjC>&&)callback;
@@ -183,6 +184,7 @@ enum MediaPlayerAVFoundationObservationContext {
 #if HAVE(AVFOUNDATION_LOADER_DELEGATE)
 @interface WebCoreAVFLoaderDelegate : NSObject<AVAssetResourceLoaderDelegate> {
     WeakPtr<MediaPlayerPrivateAVFoundationObjC> m_player;
+    GenericTaskQueue<Timer, std::atomic<unsigned>> m_taskQueue;
 }
 - (id)initWithPlayer:(WeakPtr<MediaPlayerPrivateAVFoundationObjC>&&)player;
 - (BOOL)resourceLoader:(AVAssetResourceLoader *)resourceLoader shouldWaitForLoadingOfRequestedResource:(AVAssetResourceLoadingRequest *)loadingRequest;
@@ -3285,7 +3287,7 @@ NSArray* playerKVOProperties()
 
 - (void)metadataLoaded
 {
-    callOnMainThread([player = m_player] {
+    m_taskQueue.enqueueTask([player = m_player] {
         if (player)
             player->metadataLoaded();
     });
@@ -3294,7 +3296,7 @@ NSArray* playerKVOProperties()
 - (void)didEnd:(NSNotification *)unusedNotification
 {
     UNUSED_PARAM(unusedNotification);
-    callOnMainThread([player = m_player] {
+    m_taskQueue.enqueueTask([player = m_player] {
         if (player)
             player->didEnd();
     });
@@ -3302,7 +3304,7 @@ NSArray* playerKVOProperties()
 
 - (void)observeValueForKeyPath:keyPath ofObject:(id)object change:(NSDictionary *)change context:(MediaPlayerAVFoundationObservationContext)context
 {
-    callOnMainThread([player = m_player, keyPath = retainPtr(keyPath), change = retainPtr(change), object = retainPtr(object), context] {
+    m_taskQueue.enqueueTask([player = m_player, keyPath = retainPtr(keyPath), change = retainPtr(change), object = retainPtr(object), context] {
         if (!player)
             return;
         id newValue = [change valueForKey:NSKeyValueChangeNewKey];
@@ -3405,7 +3407,7 @@ NSArray* playerKVOProperties()
 {
     UNUSED_PARAM(output);
 
-    callOnMainThread([player = m_player, strings = retainPtr(strings), nativeSamples = retainPtr(nativeSamples), itemTime] {
+    m_taskQueue.enqueueTask([player = m_player, strings = retainPtr(strings), nativeSamples = retainPtr(nativeSamples), itemTime] {
         if (!player)
             return;
         MediaTime time = std::max(PAL::toMediaTime(itemTime), MediaTime::zeroTime());
@@ -3417,7 +3419,7 @@ NSArray* playerKVOProperties()
 {
     UNUSED_PARAM(output);
 
-    callOnMainThread([player = m_player] {
+    m_taskQueue.enqueueTask([player = m_player] {
         if (player)
             player->flushCues();
     });
@@ -3444,7 +3446,7 @@ NSArray* playerKVOProperties()
     if (!m_player)
         return NO;
 
-    callOnMainThread([player = m_player, loadingRequest = retainPtr(loadingRequest)] {
+    m_taskQueue.enqueueTask([player = m_player, loadingRequest = retainPtr(loadingRequest)] {
         if (!player) {
             [loadingRequest finishLoadingWithError:nil];
             return;
@@ -3468,7 +3470,7 @@ NSArray* playerKVOProperties()
 - (void)resourceLoader:(AVAssetResourceLoader *)resourceLoader didCancelLoadingRequest:(AVAssetResourceLoadingRequest *)loadingRequest
 {
     UNUSED_PARAM(resourceLoader);
-    callOnMainThread([player = m_player, loadingRequest = retainPtr(loadingRequest)] {
+    m_taskQueue.enqueueTask([player = m_player, loadingRequest = retainPtr(loadingRequest)] {
         if (player)
             player->didCancelLoadingRequest(loadingRequest.get());
     });