Title: [271844] branches/safari-611-branch/Source/WebKit
Revision
271844
Author
[email protected]
Date
2021-01-25 14:12:40 -0800 (Mon, 25 Jan 2021)

Log Message

Cherry-pick r271486. rdar://problem/73478688

    Use callOnMainRunLoop in MediaPermissionUtilities
    https://bugs.webkit.org/show_bug.cgi?id=220616
    <rdar://problem/73002655>

    Reviewed by Chris Dumez.

    This ensures that we are in main thread and not in web thread.

    * UIProcess/Cocoa/MediaPermissionUtilities.mm:
    (WebKit::requestAVCaptureAccessForType):
    (WebKit::requestSpeechRecognitionAccess):

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

Modified Paths

Diff

Modified: branches/safari-611-branch/Source/WebKit/ChangeLog (271843 => 271844)


--- branches/safari-611-branch/Source/WebKit/ChangeLog	2021-01-25 22:12:37 UTC (rev 271843)
+++ branches/safari-611-branch/Source/WebKit/ChangeLog	2021-01-25 22:12:40 UTC (rev 271844)
@@ -1,5 +1,38 @@
 2021-01-25  Alan Coon  <[email protected]>
 
+        Cherry-pick r271486. rdar://problem/73478688
+
+    Use callOnMainRunLoop in MediaPermissionUtilities
+    https://bugs.webkit.org/show_bug.cgi?id=220616
+    <rdar://problem/73002655>
+    
+    Reviewed by Chris Dumez.
+    
+    This ensures that we are in main thread and not in web thread.
+    
+    * UIProcess/Cocoa/MediaPermissionUtilities.mm:
+    (WebKit::requestAVCaptureAccessForType):
+    (WebKit::requestSpeechRecognitionAccess):
+    
+    
+    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@271486 268f45cc-cd09-0410-ab3c-d52691b4dbfc
+
+    2021-01-14  Youenn Fablet  <[email protected]>
+
+            Use callOnMainRunLoop in MediaPermissionUtilities
+            https://bugs.webkit.org/show_bug.cgi?id=220616
+            <rdar://problem/73002655>
+
+            Reviewed by Chris Dumez.
+
+            This ensures that we are in main thread and not in web thread.
+
+            * UIProcess/Cocoa/MediaPermissionUtilities.mm:
+            (WebKit::requestAVCaptureAccessForType):
+            (WebKit::requestSpeechRecognitionAccess):
+
+2021-01-25  Alan Coon  <[email protected]>
+
         Cherry-pick r271473. rdar://problem/73478401
 
     PCM: Output logs by default, including to Web Inspector

Modified: branches/safari-611-branch/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm (271843 => 271844)


--- branches/safari-611-branch/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm	2021-01-25 22:12:37 UTC (rev 271843)
+++ branches/safari-611-branch/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm	2021-01-25 22:12:40 UTC (rev 271844)
@@ -214,13 +214,8 @@
 
     AVMediaType mediaType = type == MediaPermissionType::Audio ? AVMediaTypeAudio : AVMediaTypeVideo;
     auto decisionHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL authorized) mutable {
-        if (isMainThread()) {
+        callOnMainRunLoop([completionHandler = WTFMove(completionHandler), authorized]() mutable {
             completionHandler(authorized);
-            return;
-        }
-
-        callOnMainThread([completionHandler = WTFMove(completionHandler), authorized]() mutable {
-            completionHandler(authorized);
         });
     });
     [PAL::getAVCaptureDeviceClass() requestAccessForMediaType:mediaType completionHandler:decisionHandler.get()];
@@ -247,13 +242,9 @@
 
     auto decisionHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler)](SFSpeechRecognizerAuthorizationStatus status) mutable {
         bool authorized = status == SFSpeechRecognizerAuthorizationStatusAuthorized;
-        if (!isMainThread()) {
-            callOnMainThread([completionHandler = WTFMove(completionHandler), authorized]() mutable {
-                completionHandler(authorized);
-            });
-            return;
-        }
-        completionHandler(authorized);
+        callOnMainRunLoop([completionHandler = WTFMove(completionHandler), authorized]() mutable {
+            completionHandler(authorized);
+        });
     });
     [PAL::getSFSpeechRecognizerClass() requestAuthorization:decisionHandler.get()];
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to