⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 271486 in webkit


Ignore:
Timestamp:
Jan 14, 2021, 9:17:32 AM (6 years ago)
Author:
youenn@apple.com
Message:

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):

Location:
trunk/Source/WebKit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r271485 r271486  
     12021-01-14  Youenn Fablet  <youenn@apple.com>
     2
     3        Use callOnMainRunLoop in MediaPermissionUtilities
     4        https://bugs.webkit.org/show_bug.cgi?id=220616
     5        <rdar://problem/73002655>
     6
     7        Reviewed by Chris Dumez.
     8
     9        This ensures that we are in main thread and not in web thread.
     10
     11        * UIProcess/Cocoa/MediaPermissionUtilities.mm:
     12        (WebKit::requestAVCaptureAccessForType):
     13        (WebKit::requestSpeechRecognitionAccess):
     14
    1152021-01-14  Sihui Liu  <sihui_liu@appe.com>
    216
  • trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm

    r271485 r271486  
    217217    AVMediaType mediaType = type == MediaPermissionType::Audio ? AVMediaTypeAudio : AVMediaTypeVideo;
    218218    auto decisionHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL authorized) mutable {
    219         if (isMainThread()) {
    220             completionHandler(authorized);
    221             return;
    222         }
    223 
    224         callOnMainThread([completionHandler = WTFMove(completionHandler), authorized]() mutable {
     219        callOnMainRunLoop([completionHandler = WTFMove(completionHandler), authorized]() mutable {
    225220            completionHandler(authorized);
    226221        });
     
    250245    auto decisionHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler)](SFSpeechRecognizerAuthorizationStatus status) mutable {
    251246        bool authorized = status == SFSpeechRecognizerAuthorizationStatusAuthorized;
    252         if (!isMainThread()) {
    253             callOnMainThread([completionHandler = WTFMove(completionHandler), authorized]() mutable {
    254                 completionHandler(authorized);
    255             });
    256             return;
    257         }
    258         completionHandler(authorized);
     247        callOnMainRunLoop([completionHandler = WTFMove(completionHandler), authorized]() mutable {
     248            completionHandler(authorized);
     249        });
    259250    });
    260251    [PAL::getSFSpeechRecognizerClass() requestAuthorization:decisionHandler.get()];
Note: See TracChangeset for help on using the changeset viewer.