Changeset 271486 in webkit
- Timestamp:
- Jan 14, 2021, 9:17:32 AM (6 years ago)
- Location:
- trunk/Source/WebKit
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
UIProcess/Cocoa/MediaPermissionUtilities.mm (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebKit/ChangeLog
r271485 r271486 1 2021-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 1 15 2021-01-14 Sihui Liu <sihui_liu@appe.com> 2 16 -
trunk/Source/WebKit/UIProcess/Cocoa/MediaPermissionUtilities.mm
r271485 r271486 217 217 AVMediaType mediaType = type == MediaPermissionType::Audio ? AVMediaTypeAudio : AVMediaTypeVideo; 218 218 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 { 225 220 completionHandler(authorized); 226 221 }); … … 250 245 auto decisionHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler)](SFSpeechRecognizerAuthorizationStatus status) mutable { 251 246 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 }); 259 250 }); 260 251 [PAL::getSFSpeechRecognizerClass() requestAuthorization:decisionHandler.get()];
Note:
See TracChangeset
for help on using the changeset viewer.