WebKit Bugzilla
Attachment 357061 Details for
Bug 192594
: Introduce makeBlockPtr for lambdas
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-192594-20181211095517.patch (text/plain), 81.86 KB, created by
Andy Estes
on 2018-12-11 09:55:18 PST
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Andy Estes
Created:
2018-12-11 09:55:18 PST
Size:
81.86 KB
patch
obsolete
>Subversion Revision: 239063 >diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog >index 4bea040931b7f1cc44ee8cbeb41c2a4119d3285f..cff4bbc8aaaffa5e59f14a76e8f3617e71dca440 100644 >--- a/Source/WTF/ChangeLog >+++ b/Source/WTF/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-11 Andy Estes <aestes@apple.com> >+ >+ Introduce makeBlockPtr for lambdas >+ https://bugs.webkit.org/show_bug.cgi?id=192594 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ BlockPtr<...>::fromCallable is cumbersome because it requires repeating the callable's >+ signature as a class template argument. This patch introduces an overload of makeBlockPtr >+ that deduces the correct BlockPtr instantiation from a lambda's operator() signature. >+ >+ * wtf/BlockPtr.h: >+ (WTF::makeBlockPtr): >+ >+ Adopted makeBlockPtr. >+ >+ * wtf/cocoa/WorkQueueCocoa.cpp: >+ (WTF::WorkQueue::dispatch): >+ (WTF::WorkQueue::dispatchAfter): >+ (WTF::WorkQueue::concurrentApply): >+ > 2018-12-10 Alexey Proskuryakov <ap@apple.com> > > Move ENABLE_SEC_ITEM_SHIM out of WebKit's config.h >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index ce618336e465b4cd60aaa320be23aaf7a0c287a7..dc25a40a24aaa5e36d13d7c59297c0febad182a9 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,24 @@ >+2018-12-11 Andy Estes <aestes@apple.com> >+ >+ Introduce makeBlockPtr for lambdas >+ https://bugs.webkit.org/show_bug.cgi?id=192594 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adopted makeBlockPtr. >+ >+ * platform/cocoa/FileMonitorCocoa.mm: >+ (WebCore::FileMonitor::FileMonitor): >+ * platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm: >+ (WebCore::VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer): >+ * platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm: >+ (WebCore::GPULegacyCommandBuffer::GPULegacyCommandBuffer): >+ * platform/network/cocoa/WebCoreNSURLSession.mm: >+ (-[WebCoreNSURLSession addDelegateOperation:]): >+ (-[WebCoreNSURLSessionDataTask resource:receivedRedirect:request:completionHandler:]): >+ * platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm: >+ (-[WebCoreResourceHandleAsOperationQueueDelegate callFunctionOnMainThread:]): >+ > 2018-12-10 Ryosuke Niwa <rniwa@webkit.org> > > Use WeakPtr to refer to VTTCue in VTTCueBox >diff --git a/Source/WebCore/PAL/ChangeLog b/Source/WebCore/PAL/ChangeLog >index a88cd1aafb9534221bd31b8a8983049d93b68f29..316fc74662e95c2d90c1a62db8d403900c785bf3 100644 >--- a/Source/WebCore/PAL/ChangeLog >+++ b/Source/WebCore/PAL/ChangeLog >@@ -1,3 +1,15 @@ >+2018-12-11 Andy Estes <aestes@apple.com> >+ >+ Introduce makeBlockPtr for lambdas >+ https://bugs.webkit.org/show_bug.cgi?id=192594 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adopted makeBlockPtr. >+ >+ * pal/Logging.cpp: >+ (PAL::registerNotifyCallback): >+ > 2018-12-10 Commit Queue <commit-queue@webkit.org> > > Unreviewed, rolling out r239023. >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 0dc71457dc022e32dfe19ca268c180b8e20aafd3..c074498143755ee4f15172059bfa4514ad2cd065 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,89 @@ >+2018-12-11 Andy Estes <aestes@apple.com> >+ >+ Introduce makeBlockPtr for lambdas >+ https://bugs.webkit.org/show_bug.cgi?id=192594 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adopted makeBlockPtr. >+ >+ * NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm: >+ (-[WKDownloadProgress initWithDownloadTask:download:URL:sandboxExtension:]): >+ * NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm: >+ (WebKit::NetworkCache::IOChannel::read): >+ (WebKit::NetworkCache::IOChannel::write): >+ * NetworkProcess/cocoa/NetworkProcessCocoa.mm: >+ (WebKit::NetworkProcess::clearDiskCache): >+ (WebKit::saveCookies): >+ * NetworkProcess/watchos/NetworkProximityAssertion.mm: >+ (WebKit::BluetoothProximityAssertion::suspend): >+ * UIProcess/API/Cocoa/WKWebView.mm: >+ (-[WKWebView _setInputDelegate:]): >+ * UIProcess/API/mac/WKView.mm: >+ (-[WKView maybeInstallIconLoadingClient]): >+ * UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm: >+ (WebKit::WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard): >+ (WebKit::WebPaymentCoordinatorProxy::platformOpenPaymentSetup): >+ * UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm: >+ (WebKit::WebPaymentCoordinatorProxy::platformShowPaymentUI): >+ * UIProcess/Cocoa/AutomationSessionClient.mm: >+ (WebKit::AutomationSessionClient::requestNewPageWithOptions): >+ (WebKit::AutomationSessionClient::requestSwitchToPage): >+ (WebKit::AutomationSessionClient::requestHideWindowOfPage): >+ (WebKit::AutomationSessionClient::requestRestoreWindowOfPage): >+ (WebKit::AutomationSessionClient::requestMaximizeWindowOfPage): >+ * UIProcess/Cocoa/DownloadClient.mm: >+ (WebKit::DownloadClient::didReceiveAuthenticationChallenge): >+ (WebKit::DownloadClient::decideDestinationWithSuggestedFilename): >+ * UIProcess/Cocoa/IconLoadingDelegate.mm: >+ (WebKit::IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon): >+ * UIProcess/Cocoa/NavigationState.mm: >+ (WebKit::NavigationState::NavigationClient::decidePolicyForPluginLoad): >+ (WebKit::NavigationState::NavigationClient::webGLLoadPolicy const): >+ (WebKit::NavigationState::NavigationClient::resolveWebGLLoadPolicy const): >+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationAction): >+ (WebKit::NavigationState::NavigationClient::decidePolicyForNavigationResponse): >+ (WebKit::NavigationState::NavigationClient::didReceiveAuthenticationChallenge): >+ * UIProcess/Cocoa/UIDelegate.mm: >+ (WebKit::UIDelegate::ContextMenuClient::menuFromProposedMenu): >+ (WebKit::UIDelegate::UIClient::createNewPage): >+ (WebKit::UIDelegate::UIClient::runJavaScriptAlert): >+ (WebKit::UIDelegate::UIClient::runJavaScriptConfirm): >+ (WebKit::UIDelegate::UIClient::runJavaScriptPrompt): >+ (WebKit::UIDelegate::UIClient::requestStorageAccessConfirm): >+ (WebKit::UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest): >+ (WebKit::UIDelegate::UIClient::runBeforeUnloadConfirmPanel): >+ (WebKit::UIDelegate::UIClient::exceededDatabaseQuota): >+ (WebKit::UIDelegate::UIClient::windowFrame): >+ (WebKit::UIDelegate::UIClient::toolbarsAreVisible): >+ (WebKit::UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest): >+ (WebKit::UIDelegate::UIClient::runOpenPanel): >+ (WebKit::requestUserMediaAuthorizationForDevices): >+ (WebKit::UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest): >+ (WebKit::UIDelegate::UIClient::checkUserMediaPermissionForOrigin): >+ (WebKit::UIDelegate::UIClient::reachedApplicationCacheOriginQuota): >+ (WebKit::UIDelegate::UIClient::requestPointerLock): >+ * UIProcess/Cocoa/WKSafeBrowsingWarning.mm: >+ (-[WKSafeBrowsingWarning clickedOnLink:]): >+ * UIProcess/Cocoa/WebPageProxyCocoa.mm: >+ (WebKit::WebPageProxy::beginSafeBrowsingCheck): >+ * UIProcess/WebAuthentication/Cocoa/HidConnection.mm: >+ (WebKit::HidConnection::send): >+ * UIProcess/WebAuthentication/Cocoa/LocalConnection.mm: >+ (WebKit::LocalConnection::getUserConsent const): >+ (WebKit::LocalConnection::getAttestation const): >+ * UIProcess/WebAuthentication/Mock/MockHidConnection.cpp: >+ (WebKit::MockHidConnection::send): >+ * UIProcess/ios/PageClientImplIOS.mm: >+ (WebKit::PageClientImpl::requestPasswordForQuickLookDocument): >+ * UIProcess/ios/WKGeolocationProviderIOS.mm: >+ (-[WKGeolocationProviderIOS geolocationAuthorizationGranted]): >+ * UIProcess/mac/ServicesController.mm: >+ (WebKit::hasCompatibleServicesForItems): >+ (WebKit::ServicesController::refreshExistingServices): >+ * WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm: >+ (PageLoaderClient::didStartProvisionalLoadForFrame): >+ > 2018-12-10 Tim Horton <timothy_horton@apple.com> > > Animated scrolling on Google Maps scrolls the page in addition to moving the map >diff --git a/Source/WTF/wtf/BlockPtr.h b/Source/WTF/wtf/BlockPtr.h >index a0111958782c90b199692e8b8c40bd72d1601095..411b1c9593f1b6b545b7b9f2d26823e5ba0f4f8a 100644 >--- a/Source/WTF/wtf/BlockPtr.h >+++ b/Source/WTF/wtf/BlockPtr.h >@@ -191,6 +191,24 @@ inline BlockPtr<R (Args...)> makeBlockPtr(R (^block)(Args...)) > return BlockPtr<R (Args...)>(block); > } > >+template<typename F, typename Class, typename R, typename... Args> >+inline auto makeBlockPtr(F&& function, R (Class::*)(Args...) const) >+{ >+ return BlockPtr<R (Args...)>::fromCallable(std::forward<F>(function)); >+} >+ >+template<typename F, typename Class, typename R, typename... Args> >+inline auto makeBlockPtr(F&& function, R (Class::*)(Args...)) >+{ >+ return BlockPtr<R (Args...)>::fromCallable(std::forward<F>(function)); >+} >+ >+template<typename F> >+inline auto makeBlockPtr(F&& function) >+{ >+ return makeBlockPtr(std::forward<F>(function), &F::operator()); >+} >+ > } > > using WTF::BlockPtr; >diff --git a/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp b/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp >index d0959ec2b17d375c8ab50a9b0c420ff5dd18d87b..f6c4b8c879114fbe7cad5dce6927d482642a392e 100644 >--- a/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp >+++ b/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp >@@ -33,14 +33,14 @@ namespace WTF { > > void WorkQueue::dispatch(Function<void()>&& function) > { >- dispatch_async(m_dispatchQueue, BlockPtr<void()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] { >+ dispatch_async(m_dispatchQueue, makeBlockPtr([protectedThis = makeRef(*this), function = WTFMove(function)] { > function(); > }).get()); > } > > void WorkQueue::dispatchAfter(Seconds duration, Function<void()>&& function) > { >- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration.nanosecondsAs<int64_t>()), m_dispatchQueue, BlockPtr<void()>::fromCallable([protectedThis = makeRef(*this), function = WTFMove(function)] { >+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, duration.nanosecondsAs<int64_t>()), m_dispatchQueue, makeBlockPtr([protectedThis = makeRef(*this), function = WTFMove(function)] { > function(); > }).get()); > } >@@ -95,7 +95,7 @@ void WorkQueue::platformInvalidate() > > void WorkQueue::concurrentApply(size_t iterations, WTF::Function<void(size_t index)>&& function) > { >- dispatch_apply(iterations, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), BlockPtr<void(size_t index)>::fromCallable([function = WTFMove(function)](size_t index) { >+ dispatch_apply(iterations, dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), makeBlockPtr([function = WTFMove(function)](size_t index) { > function(index); > }).get()); > } >diff --git a/Source/WebCore/PAL/pal/Logging.cpp b/Source/WebCore/PAL/pal/Logging.cpp >index e62548d46791f8fa7e11316c743d98f1988f7c2e..8e6fa230fc45e6b2f046c11dfad2714318c06560 100644 >--- a/Source/WebCore/PAL/pal/Logging.cpp >+++ b/Source/WebCore/PAL/pal/Logging.cpp >@@ -39,7 +39,7 @@ void registerNotifyCallback(const String& notifyID, WTF::Function<void()>&& call > { > #if PLATFORM(COCOA) > int token; >- notify_register_dispatch(notifyID.utf8().data(), &token, dispatch_get_main_queue(), BlockPtr<void(int)>::fromCallable([callback = WTFMove(callback)](int) { >+ notify_register_dispatch(notifyID.utf8().data(), &token, dispatch_get_main_queue(), makeBlockPtr([callback = WTFMove(callback)](int) { > callback(); > }).get()); > #else >diff --git a/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm b/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm >index d37e17f7317694d2ca50b10b2e5c0a3c70a7da2e..1ab3c334c69dffa3648ab00a4558d9f27e430600 100644 >--- a/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm >+++ b/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm >@@ -54,7 +54,7 @@ FileMonitor::FileMonitor(const String& path, Ref<WorkQueue>&& handlerQueue, WTF: > > LOG(ResourceLoadStatistics, "Creating monitor %p", m_platformMonitor.get()); > >- dispatch_source_set_event_handler(m_platformMonitor.get(), BlockPtr<void()>::fromCallable([modificationHandler = WTFMove(modificationHandler), fileMonitor = m_platformMonitor] { >+ dispatch_source_set_event_handler(m_platformMonitor.get(), makeBlockPtr([modificationHandler = WTFMove(modificationHandler), fileMonitor = m_platformMonitor] { > // If this is getting called after the monitor was cancelled, just drop the notification. > if (dispatch_source_testcancel(fileMonitor.get())) > return; >diff --git a/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm b/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm >index cc05b2a4b572ee56b92cda9e0175af1f22b4c927..83b8125b129d8b43577ed84741a77c8b7c7b4d28 100644 >--- a/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm >+++ b/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm >@@ -130,7 +130,7 @@ void VideoFullscreenLayerManagerObjC::setVideoFullscreenLayer(PlatformLayer *vid > } > } > >- [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] { >+ [CATransaction setCompletionBlock:makeBlockPtr([completionHandler = WTFMove(completionHandler)] { > completionHandler(); > }).get()]; > >diff --git a/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm b/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm >index a7380e82e3f596de63980e0dd33085151544602d..f27939e816e65fdc6f8dc93e963e99f95cfdb192 100644 >--- a/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm >+++ b/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm >@@ -43,7 +43,7 @@ GPULegacyCommandBuffer::GPULegacyCommandBuffer(const GPULegacyCommandQueue& queu > > m_metal = [queue.metal() commandBuffer]; > >- [m_metal addCompletedHandler:BlockPtr<void (id<MTLCommandBuffer>)>::fromCallable([completedCallback = WTFMove(completedCallback)] (id<MTLCommandBuffer>) mutable { >+ [m_metal addCompletedHandler:makeBlockPtr([completedCallback = WTFMove(completedCallback)] (id<MTLCommandBuffer>) mutable { > callOnMainThread(WTFMove(completedCallback)); > }).get()]; > } >diff --git a/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm b/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm >index 70eb7768e306c387dc986050139fc902daaa0574..17e6167995f671a954bf52cc0fec6e211a5034b7 100644 >--- a/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm >+++ b/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm >@@ -132,7 +132,7 @@ - (void)taskCompleted:(WebCoreNSURLSessionDataTask *)task > - (void)addDelegateOperation:(Function<void()>&&)function > { > RetainPtr<WebCoreNSURLSession> strongSelf { self }; >- RetainPtr<NSBlockOperation> operation = [NSBlockOperation blockOperationWithBlock:BlockPtr<void()>::fromCallable(WTFMove(function)).get()]; >+ RetainPtr<NSBlockOperation> operation = [NSBlockOperation blockOperationWithBlock:makeBlockPtr(WTFMove(function)).get()]; > dispatch_async(_internalQueue.get(), [strongSelf, operation] { > [strongSelf.get().delegateQueue addOperation:operation.get()]; > [operation waitUntilFinished]; >@@ -707,7 +707,7 @@ - (void)resource:(PlatformMediaResource&)resource receivedRedirect:(const Resour > > id<NSURLSessionDataDelegate> dataDelegate = (id<NSURLSessionDataDelegate>)strongSelf.get().session.delegate; > if ([dataDelegate respondsToSelector:@selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)]) { >- auto completionHandlerBlock = BlockPtr<void(NSURLRequest *)>::fromCallable([completionHandler = WTFMove(completionHandler)](NSURLRequest *newRequest) mutable { >+ auto completionHandlerBlock = makeBlockPtr([completionHandler = WTFMove(completionHandler)](NSURLRequest *newRequest) mutable { > if (!isMainThread()) { > callOnMainThread([request = ResourceRequest { newRequest }, completionHandler = WTFMove(completionHandler)] () mutable { > completionHandler(WTFMove(request)); >diff --git a/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm b/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm >index f0fdfad88cd8947d587ea116855179f420ac99d4..ec7d01babb1a78492a181346dc85ef1c4006ceb9 100644 >--- a/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm >+++ b/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm >@@ -68,7 +68,7 @@ - (void)callFunctionOnMainThread:(Function<void()>&&)function > return callOnMainThread(WTFMove(function)); > > // If we have been scheduled in a custom run loop mode, schedule a block in that mode. >- auto block = BlockPtr<void()>::fromCallable([alreadyCalled = false, function = WTFMove(function)] () mutable { >+ auto block = makeBlockPtr([alreadyCalled = false, function = WTFMove(function)] () mutable { > if (alreadyCalled) > return; > alreadyCalled = true; >diff --git a/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm b/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm >index feba0c96ba00b820b2745fa1393a264cf4edc09a..f1a7127ad5b18d3a2bed783a4f20239422025050 100644 >--- a/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm >+++ b/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm >@@ -67,7 +67,7 @@ - (instancetype)initWithDownloadTask:(NSURLSessionDownloadTask *)task download:( > m_sandboxExtension = sandboxExtension; > > self.cancellable = YES; >- self.cancellationHandler = BlockPtr<void()>::fromCallable([weakSelf = WeakObjCPtr<WKDownloadProgress> { self }] { >+ self.cancellationHandler = makeBlockPtr([weakSelf = WeakObjCPtr<WKDownloadProgress> { self }] { > auto strongSelf = weakSelf.get(); > if (!strongSelf) > return; >diff --git a/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm b/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm >index b641a0642dd24422df5a94db17a33579e4617ee8..369bcf973f2dcee0a3d4396345370b64621e9f08 100644 >--- a/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm >@@ -91,7 +91,7 @@ void IOChannel::read(size_t offset, size_t size, WorkQueue* queue, Function<void > RefPtr<IOChannel> channel(this); > bool didCallCompletionHandler = false; > auto dispatchQueue = queue ? queue->dispatchQueue() : dispatch_get_main_queue(); >- dispatch_io_read(m_dispatchIO.get(), offset, size, dispatchQueue, BlockPtr<void(bool, dispatch_data_t, int)>::fromCallable([channel, completionHandler = WTFMove(completionHandler), didCallCompletionHandler](bool done, dispatch_data_t fileData, int error) mutable { >+ dispatch_io_read(m_dispatchIO.get(), offset, size, dispatchQueue, makeBlockPtr([channel, completionHandler = WTFMove(completionHandler), didCallCompletionHandler](bool done, dispatch_data_t fileData, int error) mutable { > ASSERT_UNUSED(done, done || !didCallCompletionHandler); > if (didCallCompletionHandler) > return; >@@ -107,7 +107,7 @@ void IOChannel::write(size_t offset, const Data& data, WorkQueue* queue, Functio > RefPtr<IOChannel> channel(this); > auto dispatchData = data.dispatchData(); > auto dispatchQueue = queue ? queue->dispatchQueue() : dispatch_get_main_queue(); >- dispatch_io_write(m_dispatchIO.get(), offset, dispatchData, dispatchQueue, BlockPtr<void(bool, dispatch_data_t, int)>::fromCallable([channel, completionHandler = WTFMove(completionHandler)](bool done, dispatch_data_t fileData, int error) mutable { >+ dispatch_io_write(m_dispatchIO.get(), offset, dispatchData, dispatchQueue, makeBlockPtr([channel, completionHandler = WTFMove(completionHandler)](bool done, dispatch_data_t fileData, int error) mutable { > ASSERT_UNUSED(done, done); > auto callback = WTFMove(completionHandler); > callback(error); >diff --git a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >index 3e68b282956726b1d79d6516b27382de0f4de11a..1c55779d9d1794447de63b8b5468ef4fdd0cbae9 100644 >--- a/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >+++ b/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm >@@ -181,7 +181,7 @@ void NetworkProcess::clearDiskCache(WallTime modifiedSince, Function<void ()>&& > > if (auto* cache = NetworkProcess::singleton().cache()) { > auto group = m_clearCacheDispatchGroup; >- dispatch_group_async(group, dispatch_get_main_queue(), BlockPtr<void()>::fromCallable([cache, modifiedSince, completionHandler = WTFMove(completionHandler)] () mutable { >+ dispatch_group_async(group, dispatch_get_main_queue(), makeBlockPtr([cache, modifiedSince, completionHandler = WTFMove(completionHandler)] () mutable { > cache->clear(modifiedSince, [completionHandler = WTFMove(completionHandler)] () mutable { > }); > }).get()); >@@ -212,7 +212,7 @@ void NetworkProcess::syncAllCookies() > static void saveCookies(NSHTTPCookieStorage *cookieStorage, CompletionHandler<void()>&& completionHandler) > { > ASSERT(RunLoop::isMain()); >- [cookieStorage _saveCookies:BlockPtr<void()>::fromCallable([completionHandler = WTFMove(completionHandler)]() mutable { >+ [cookieStorage _saveCookies:makeBlockPtr([completionHandler = WTFMove(completionHandler)]() mutable { > // CFNetwork may call the completion block on a background queue, so we need to redispatch to the main thread. > RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler)]() mutable { > completionHandler(); >diff --git a/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm b/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm >index 178f3b437ed1c18e76c8a85f588977359fc7ea41..7223a53b9393c81dba52535417dac8b29fb4d03c 100644 >--- a/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm >+++ b/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm >@@ -184,7 +184,7 @@ void BluetoothProximityAssertion::suspend(SuspensionReason reason, CompletionHan > // completion handler. If we suspend before IDS finishes setting link preferences, the > // Bluetooth radio might stay in a high power mode, harming battery life. Delay suspension > // by 30 seconds to ensure -setLinkPreferences: always finishes its work. >- dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 30 * NSEC_PER_SEC), dispatch_get_main_queue(), BlockPtr<void()>::fromCallable(WTFMove(completionHandler)).get()); >+ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 30 * NSEC_PER_SEC), dispatch_get_main_queue(), makeBlockPtr(WTFMove(completionHandler)).get()); > break; > } > } >diff --git a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >index 7405871f1446ec24e8fc3497058d88f99e84e22f..ba2048eabaab68cd733825c64f8b920fab96441e 100644 >--- a/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >+++ b/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm >@@ -5222,7 +5222,7 @@ - (void)_setInputDelegate:(id <_WKInputDelegate>)inputDelegate > } > > auto checker = WebKit::CompletionHandlerCallChecker::create(inputDelegate.get(), @selector(_webView:willSubmitFormValues:userObject:submissionHandler:)); >- [inputDelegate _webView:m_webView willSubmitFormValues:valueMap.get() userObject:userObject submissionHandler:BlockPtr<void(void)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] { >+ [inputDelegate _webView:m_webView willSubmitFormValues:valueMap.get() userObject:userObject submissionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >diff --git a/Source/WebKit/UIProcess/API/mac/WKView.mm b/Source/WebKit/UIProcess/API/mac/WKView.mm >index 081c4c6b3a0e4ad9d3c4c5f5988739b41115191d..13967212e3e53510d4b1c70f00cb29d8b149c193 100644 >--- a/Source/WebKit/UIProcess/API/mac/WKView.mm >+++ b/Source/WebKit/UIProcess/API/mac/WKView.mm >@@ -904,7 +904,7 @@ - (void)maybeInstallIconLoadingClient > { > RetainPtr<_WKLinkIconParameters> parameters = adoptNS([[_WKLinkIconParameters alloc] _initWithLinkIcon:linkIcon]); > >- [m_wkView _shouldLoadIconWithParameters:parameters.get() completionHandler:BlockPtr<void(IconLoadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)](IconLoadCompletionHandler loadCompletionHandler) mutable { >+ [m_wkView _shouldLoadIconWithParameters:parameters.get() completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)](IconLoadCompletionHandler loadCompletionHandler) mutable { > ASSERT(RunLoop::isMain()); > if (loadCompletionHandler) { > completionHandler([loadCompletionHandler = BlockPtr<void (NSData *)>(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) { >diff --git a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >index d8e7ae482388a62c148ab238be97267f9c87086f..440c10e800781703acc36383218965fa13ba0ab7 100644 >--- a/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm >@@ -264,7 +264,7 @@ bool WebPaymentCoordinatorProxy::platformCanMakePayments() > void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) > { > #if (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300) || (PLATFORM(IOS_FAMILY) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 110000) >- PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_webPageProxy.websiteDataStore().configuration().sourceApplicationSecondaryIdentifier(), BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable { >+ PKCanMakePaymentsWithMerchantIdentifierDomainAndSourceApplication(merchantIdentifier, domainName, m_webPageProxy.websiteDataStore().configuration().sourceApplicationSecondaryIdentifier(), makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable { > if (error) > LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error); > >@@ -273,7 +273,7 @@ void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const Str > }); > }).get()); > #else >- PKCanMakePaymentsWithMerchantIdentifierAndDomain(merchantIdentifier, domainName, BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable { >+ PKCanMakePaymentsWithMerchantIdentifierAndDomain(merchantIdentifier, domainName, makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL canMakePayments, NSError *error) mutable { > if (error) > LOG_ERROR("PKCanMakePaymentsWithMerchantIdentifierAndDomain error %@", error); > >@@ -287,7 +287,7 @@ void WebPaymentCoordinatorProxy::platformCanMakePaymentsWithActiveCard(const Str > void WebPaymentCoordinatorProxy::platformOpenPaymentSetup(const String& merchantIdentifier, const String& domainName, WTF::Function<void (bool)>&& completionHandler) > { > auto passLibrary = adoptNS([PAL::allocPKPassLibraryInstance() init]); >- [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:BlockPtr<void (BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler)](BOOL result) mutable { >+ [passLibrary openPaymentSetupForMerchantIdentifier:merchantIdentifier domain:domainName completion:makeBlockPtr([completionHandler = WTFMove(completionHandler)](BOOL result) mutable { > RunLoop::main().dispatch([completionHandler = WTFMove(completionHandler), result] { > completionHandler(result); > }); >diff --git a/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm b/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm >index 374efb53ff48dd8cbe4e86d3aa64233b06c0d01e..37897f246131a0393159593f818416454f06645b 100644 >--- a/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm >+++ b/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm >@@ -41,7 +41,7 @@ void WebPaymentCoordinatorProxy::platformShowPaymentUI(const URL& originatingURL > > auto showPaymentUIRequestSeed = m_showPaymentUIRequestSeed; > auto weakThis = makeWeakPtr(*this); >- [PAL::getPKPaymentAuthorizationViewControllerClass() requestViewControllerWithPaymentRequest:paymentRequest.get() completion:BlockPtr<void(PKPaymentAuthorizationViewController *, NSError *)>::fromCallable([paymentRequest, showPaymentUIRequestSeed, weakThis, completionHandler = WTFMove(completionHandler)](PKPaymentAuthorizationViewController *viewController, NSError *error) { >+ [PAL::getPKPaymentAuthorizationViewControllerClass() requestViewControllerWithPaymentRequest:paymentRequest.get() completion:makeBlockPtr([paymentRequest, showPaymentUIRequestSeed, weakThis, completionHandler = WTFMove(completionHandler)](PKPaymentAuthorizationViewController *viewController, NSError *error) { > auto paymentCoordinatorProxy = weakThis.get(); > if (!paymentCoordinatorProxy) > return; >diff --git a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >index 19aba12d486cad0b0e8c1961d88473df5fe09ff6..efb1e6be0296e0343e84c215ea0a0527626fb08a 100644 >--- a/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm >@@ -90,11 +90,11 @@ static inline _WKAutomationSessionBrowsingContextOptions toAPI(API::AutomationSe > void AutomationSessionClient::requestNewPageWithOptions(WebAutomationSession& session, API::AutomationSessionBrowsingContextOptions options, CompletionHandler<void(WebKit::WebPageProxy*)>&& completionHandler) > { > if (m_delegateMethods.requestNewWebViewWithOptions) { >- [m_delegate.get() _automationSession:wrapper(session) requestNewWebViewWithOptions:toAPI(options) completionHandler:BlockPtr<void(WKWebView *)>::fromCallable([completionHandler = WTFMove(completionHandler)](WKWebView *webView) mutable { >+ [m_delegate.get() _automationSession:wrapper(session) requestNewWebViewWithOptions:toAPI(options) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)](WKWebView *webView) mutable { > completionHandler(webView->_page.get()); > }).get()]; > } else if (m_delegateMethods.requestNewPageWithOptions) { >- [m_delegate.get() _automationSession:wrapper(session) requestNewPageWithOptions:toAPI(options) completionHandler:BlockPtr<void(WKPageRef)>::fromCallable([completionHandler = WTFMove(completionHandler)](WKPageRef page) mutable { >+ [m_delegate.get() _automationSession:wrapper(session) requestNewPageWithOptions:toAPI(options) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)](WKPageRef page) mutable { > completionHandler(toImpl(page)); > }).get()]; > } >@@ -107,7 +107,7 @@ void AutomationSessionClient::requestSwitchToPage(WebAutomationSession& session, > return; > } > >- auto completionBlock = BlockPtr<void()>::fromCallable(WTFMove(completionHandler)); >+ auto completionBlock = makeBlockPtr(WTFMove(completionHandler)); > if (m_delegateMethods.requestSwitchToWebView) > [m_delegate.get() _automationSession:wrapper(session) requestSwitchToWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()]; > else if (m_delegateMethods.requestSwitchToPage) >@@ -121,7 +121,7 @@ void AutomationSessionClient::requestHideWindowOfPage(WebAutomationSession& sess > return; > } > >- auto completionBlock = BlockPtr<void()>::fromCallable(WTFMove(completionHandler)); >+ auto completionBlock = makeBlockPtr(WTFMove(completionHandler)); > if (m_delegateMethods.requestHideWindowOfWebView) > [m_delegate.get() _automationSession:wrapper(session) requestHideWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()]; > else if (m_delegateMethods.requestHideWindowOfPage) >@@ -135,7 +135,7 @@ void AutomationSessionClient::requestRestoreWindowOfPage(WebAutomationSession& s > return; > } > >- auto completionBlock = BlockPtr<void()>::fromCallable(WTFMove(completionHandler)); >+ auto completionBlock = makeBlockPtr(WTFMove(completionHandler)); > if (m_delegateMethods.requestRestoreWindowOfWebView) > [m_delegate.get() _automationSession:wrapper(session) requestRestoreWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()]; > else if (m_delegateMethods.requestRestoreWindowOfPage) >@@ -149,7 +149,7 @@ void AutomationSessionClient::requestMaximizeWindowOfPage(WebAutomationSession& > return; > } > >- auto completionBlock = BlockPtr<void()>::fromCallable(WTFMove(completionHandler)); >+ auto completionBlock = makeBlockPtr(WTFMove(completionHandler)); > if (m_delegateMethods.requestMaximizeWindowOfWebView) > [m_delegate.get() _automationSession:wrapper(session) requestMaximizeWindowOfWebView:fromWebPageProxy(page) completionHandler:completionBlock.get()]; > else if (m_delegateMethods.requestMaximizeWindowOfPage) >diff --git a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >index e9d72384e491e96721c6506ddca3b34cc03240bd..3b49628fdf6dfc5aadd029d5a2cbcb6bfb78cfc1 100644 >--- a/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >+++ b/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm >@@ -123,7 +123,7 @@ void DownloadClient::didReceiveAuthenticationChallenge(WebProcessPool&, Download > return; > } > >- [m_delegate _download:wrapper(downloadProxy) didReceiveAuthenticationChallenge:wrapper(authenticationChallenge) completionHandler:BlockPtr<void(NSURLSessionAuthChallengeDisposition, NSURLCredential *)>::fromCallable([authenticationChallenge = makeRef(authenticationChallenge), checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:didReceiveAuthenticationChallenge:completionHandler:))] (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) { >+ [m_delegate _download:wrapper(downloadProxy) didReceiveAuthenticationChallenge:wrapper(authenticationChallenge) completionHandler:makeBlockPtr([authenticationChallenge = makeRef(authenticationChallenge), checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:didReceiveAuthenticationChallenge:completionHandler:))] (NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -198,7 +198,7 @@ void DownloadClient::decideDestinationWithSuggestedFilename(WebProcessPool&, Dow > ALLOW_DEPRECATED_DECLARATIONS_END > completionHandler(allowOverwrite ? AllowOverwrite::Yes : AllowOverwrite::No, destination); > } else { >- [m_delegate _download:wrapper(downloadProxy) decideDestinationWithSuggestedFilename:filename completionHandler:BlockPtr<void(BOOL, NSString *)>::fromCallable([checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:decideDestinationWithSuggestedFilename:completionHandler:)), completionHandler = WTFMove(completionHandler)] (BOOL allowOverwrite, NSString *destination) { >+ [m_delegate _download:wrapper(downloadProxy) decideDestinationWithSuggestedFilename:filename completionHandler:makeBlockPtr([checker = CompletionHandlerCallChecker::create(m_delegate.get().get(), @selector(_download:decideDestinationWithSuggestedFilename:completionHandler:)), completionHandler = WTFMove(completionHandler)] (BOOL allowOverwrite, NSString *destination) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >diff --git a/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm b/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm >index 8faa92aece77e19e596bed3bbae5e8d575466d93..b7d2421961f0b35091cd5b47474c0500e09b8f6b 100644 >--- a/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm >+++ b/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm >@@ -87,7 +87,7 @@ void IconLoadingDelegate::IconLoadingClient::getLoadDecisionForIcon(const WebCor > > RetainPtr<_WKLinkIconParameters> parameters = adoptNS([[_WKLinkIconParameters alloc] _initWithLinkIcon:linkIcon]); > >- [delegate webView:m_iconLoadingDelegate.m_webView shouldLoadIconWithParameters:parameters.get() completionHandler:BlockPtr<void (IconLoadCompletionHandler loadCompletionHandler)>::fromCallable([completionHandler = WTFMove(completionHandler)] (IconLoadCompletionHandler loadCompletionHandler) mutable { >+ [delegate webView:m_iconLoadingDelegate.m_webView shouldLoadIconWithParameters:parameters.get() completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler)] (IconLoadCompletionHandler loadCompletionHandler) mutable { > ASSERT(RunLoop::isMain()); > if (loadCompletionHandler) { > completionHandler([loadCompletionHandler = Block_copy(loadCompletionHandler)](API::Data* data, WebKit::CallbackBase::Error error) { >diff --git a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >index eab71add75713ea97964d365afc2d6f9aec9ddf4..f5ee4df18043d3b5a64b10d4c2e63740d9939772 100644 >--- a/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >+++ b/Source/WebKit/UIProcess/Cocoa/NavigationState.mm >@@ -374,7 +374,7 @@ void NavigationState::NavigationClient::decidePolicyForPluginLoad(WebKit::WebPag > } > > auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(_webView:decidePolicyForPluginLoadWithCurrentPolicy:pluginInfo:completionHandler:)); >- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView decidePolicyForPluginLoadWithCurrentPolicy:wkPluginModuleLoadPolicy(currentPluginLoadPolicy) pluginInfo:wrapper(pluginInformation) completionHandler:BlockPtr<void(_WKPluginModuleLoadPolicy, NSString *)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKPluginModuleLoadPolicy policy, NSString *unavailabilityDescription) mutable { >+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView decidePolicyForPluginLoadWithCurrentPolicy:wkPluginModuleLoadPolicy(currentPluginLoadPolicy) pluginInfo:wrapper(pluginInformation) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKPluginModuleLoadPolicy policy, NSString *unavailabilityDescription) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -406,7 +406,7 @@ void NavigationState::NavigationClient::webGLLoadPolicy(WebPageProxy&, const URL > > auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); > auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(_webView:webGLLoadPolicyForURL:decisionHandler:)); >- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView webGLLoadPolicyForURL:(NSURL *)url decisionHandler:BlockPtr<void(_WKWebGLLoadPolicy)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKWebGLLoadPolicy policy) mutable { >+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView webGLLoadPolicyForURL:(NSURL *)url decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKWebGLLoadPolicy policy) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -423,7 +423,7 @@ void NavigationState::NavigationClient::resolveWebGLLoadPolicy(WebPageProxy&, co > > auto navigationDelegate = m_navigationState.m_navigationDelegate.get(); > auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(_webView:resolveWebGLLoadPolicyForURL:decisionHandler:)); >- [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView resolveWebGLLoadPolicyForURL:(NSURL *)url decisionHandler:BlockPtr<void(_WKWebGLLoadPolicy)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKWebGLLoadPolicy policy) mutable { >+ [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView resolveWebGLLoadPolicyForURL:(NSURL *)url decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](_WKWebGLLoadPolicy policy) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -579,7 +579,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP > }; > > if (delegateHasWebsitePolicies) { >- auto decisionHandler = BlockPtr<void(WKNavigationActionPolicy, _WKWebsitePolicies *)>::fromCallable(WTFMove(decisionHandlerWithPolicies)); >+ auto decisionHandler = makeBlockPtr(WTFMove(decisionHandlerWithPolicies)); > if (m_navigationState.m_navigationDelegateMethods.webViewDecidePolicyForNavigationActionUserInfoDecisionHandlerWebsitePolicies) > [(id <WKNavigationDelegatePrivate>)navigationDelegate _webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil decisionHandler:decisionHandler.get()]; > else { >@@ -591,7 +591,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationAction(WebPageP > auto decisionHandlerWithoutPolicies = [decisionHandlerWithPolicies = WTFMove(decisionHandlerWithPolicies)] (WKNavigationActionPolicy actionPolicy) mutable { > decisionHandlerWithPolicies(actionPolicy, nil); > }; >- [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) decisionHandler:BlockPtr<void(WKNavigationActionPolicy)>::fromCallable(WTFMove(decisionHandlerWithoutPolicies)).get()]; >+ [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationAction:wrapper(navigationAction) decisionHandler:makeBlockPtr(WTFMove(decisionHandlerWithoutPolicies)).get()]; > } > } > >@@ -644,7 +644,7 @@ void NavigationState::NavigationClient::decidePolicyForNavigationResponse(WebPag > return; > > auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:decidePolicyForNavigationResponse:decisionHandler:)); >- [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationResponse:wrapper(navigationResponse) decisionHandler:BlockPtr<void(WKNavigationResponsePolicy)>::fromCallable([localListener = WTFMove(listener), checker = WTFMove(checker)](WKNavigationResponsePolicy responsePolicy) { >+ [navigationDelegate webView:m_navigationState.m_webView decidePolicyForNavigationResponse:wrapper(navigationResponse) decisionHandler:makeBlockPtr([localListener = WTFMove(listener), checker = WTFMove(checker)](WKNavigationResponsePolicy responsePolicy) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -897,7 +897,7 @@ void NavigationState::NavigationClient::didReceiveAuthenticationChallenge(WebPag > return authenticationChallenge.listener().completeChallenge(WebKit::AuthenticationChallengeDisposition::PerformDefaultHandling); > > auto checker = CompletionHandlerCallChecker::create(navigationDelegate.get(), @selector(webView:didReceiveAuthenticationChallenge:completionHandler:)); >- [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) webView:m_navigationState.m_webView didReceiveAuthenticationChallenge:wrapper(authenticationChallenge) completionHandler:BlockPtr<void(NSURLSessionAuthChallengeDisposition, NSURLCredential *)>::fromCallable([challenge = makeRef(authenticationChallenge), checker = WTFMove(checker)](NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) { >+ [static_cast<id <WKNavigationDelegatePrivate>>(navigationDelegate.get()) webView:m_navigationState.m_webView didReceiveAuthenticationChallenge:wrapper(authenticationChallenge) completionHandler:makeBlockPtr([challenge = makeRef(authenticationChallenge), checker = WTFMove(checker)](NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >diff --git a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >index a559a9c58fffc885095bc78cd68820e47ae2818b..a7a83b4ebafe01d614ff36fe4f0bea88e1856738 100644 >--- a/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >+++ b/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm >@@ -196,7 +196,7 @@ void UIDelegate::ContextMenuClient::menuFromProposedMenu(WebPageProxy&, NSMenu * > > if (m_uiDelegate.m_delegateMethods.webViewGetContextMenuFromProposedMenuForElementUserInfoCompletionHandler) { > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:getContextMenuFromProposedMenu:forElement:userInfo:completionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView getContextMenuFromProposedMenu:menu forElement:contextMenuElementInfo.get() userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil completionHandler:BlockPtr<void(NSMenu *)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (NSMenu *menu) mutable { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView getContextMenuFromProposedMenu:menu forElement:contextMenuElementInfo.get() userInfo:userInfo ? static_cast<id <NSSecureCoding>>(userInfo->wrapper()) : nil completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (NSMenu *menu) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -240,7 +240,7 @@ void UIDelegate::UIClient::createNewPage(WebPageProxy& page, Ref<API::FrameInfo> > if (m_uiDelegate.m_delegateMethods.webViewCreateWebViewWithConfigurationForNavigationActionWindowFeaturesAsync) { > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:createWebViewWithConfiguration:forNavigationAction:windowFeatures:completionHandler:)); > >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(apiNavigationAction) windowFeatures:wrapper(apiWindowFeatures) completionHandler:BlockPtr<void(WKWebView *)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker), relatedWebView = RetainPtr<WKWebView>(m_uiDelegate.m_webView)] (WKWebView *webView) mutable { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView createWebViewWithConfiguration:configuration.get() forNavigationAction:wrapper(apiNavigationAction) windowFeatures:wrapper(apiWindowFeatures) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker), relatedWebView = RetainPtr<WKWebView>(m_uiDelegate.m_webView)] (WKWebView *webView) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -283,7 +283,7 @@ void UIDelegate::UIClient::runJavaScriptAlert(WebPageProxy*, const WTF::String& > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:)); >- [delegate webView:m_uiDelegate.m_webView runJavaScriptAlertPanelWithMessage:message initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] { >+ [delegate webView:m_uiDelegate.m_webView runJavaScriptAlertPanelWithMessage:message initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] { > if (checker->completionHandlerHasBeenCalled()) > return; > completionHandler(); >@@ -305,7 +305,7 @@ void UIDelegate::UIClient::runJavaScriptConfirm(WebPageProxy*, const WTF::String > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(webView:runJavaScriptConfirmPanelWithMessage:initiatedByFrame:completionHandler:)); >- [delegate webView:m_uiDelegate.m_webView runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:BlockPtr<void (BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { >+ [delegate webView:m_uiDelegate.m_webView runJavaScriptConfirmPanelWithMessage:message initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > completionHandler(result); >@@ -327,7 +327,7 @@ void UIDelegate::UIClient::runJavaScriptPrompt(WebPageProxy*, const WTF::String& > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(webView:runJavaScriptTextInputPanelWithPrompt:defaultText:initiatedByFrame:completionHandler:)); >- [delegate webView:m_uiDelegate.m_webView runJavaScriptTextInputPanelWithPrompt:message defaultText:defaultValue initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:BlockPtr<void (NSString *)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (NSString *result) mutable { >+ [delegate webView:m_uiDelegate.m_webView runJavaScriptTextInputPanelWithPrompt:message defaultText:defaultValue initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (NSString *result) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > completionHandler(result); >@@ -349,7 +349,7 @@ void UIDelegate::UIClient::requestStorageAccessConfirm(WebPageProxy&, WebFramePr > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestStorageAccessPanelForDomain:underCurrentDomain:completionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingDomain underCurrentDomain:currentDomain completionHandler:BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestStorageAccessPanelForDomain:requestingDomain underCurrentDomain:currentDomain completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > completionHandler(result); >@@ -367,7 +367,7 @@ void UIDelegate::UIClient::decidePolicyForGeolocationPermissionRequest(WebKit::W > return; > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestGeolocationPermissionForFrame:decisionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestGeolocationPermissionForFrame:wrapper(API::FrameInfo::create(frame, securityOrigin.securityOrigin())) decisionHandler:BlockPtr<void(BOOL)>::fromCallable([completionHandler = std::exchange(completionHandler, nullptr), checker = WTFMove(checker)] (BOOL result) mutable { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestGeolocationPermissionForFrame:wrapper(API::FrameInfo::create(frame, securityOrigin.securityOrigin())) decisionHandler:makeBlockPtr([completionHandler = std::exchange(completionHandler, nullptr), checker = WTFMove(checker)] (BOOL result) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -406,7 +406,7 @@ void UIDelegate::UIClient::runBeforeUnloadConfirmPanel(WebPageProxy*, const WTF: > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:runBeforeUnloadConfirmPanelWithMessage:initiatedByFrame:completionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView runBeforeUnloadConfirmPanelWithMessage:message initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:BlockPtr<void (BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView runBeforeUnloadConfirmPanelWithMessage:message initiatedByFrame:wrapper(API::FrameInfo::create(*webFrameProxy, securityOriginData.securityOrigin())) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > completionHandler(result); >@@ -435,7 +435,7 @@ void UIDelegate::UIClient::exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, > > if (m_uiDelegate.m_delegateMethods.webViewDecideDatabaseQuotaForSecurityOriginDatabaseNameDisplayNameCurrentQuotaCurrentOriginUsageCurrentDatabaseUsageExpectedUsageDecisionHandler) { > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideDatabaseQuotaForSecurityOrigin:databaseName:displayName:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:wrapper(*securityOrigin) databaseName:databaseName displayName:displayName currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:BlockPtr<void(unsigned long long newQuota)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long newQuota) { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:wrapper(*securityOrigin) databaseName:databaseName displayName:displayName currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long newQuota) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -445,7 +445,7 @@ void UIDelegate::UIClient::exceededDatabaseQuota(WebPageProxy*, WebFrameProxy*, > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideDatabaseQuotaForSecurityOrigin:currentQuota:currentOriginUsage:currentDatabaseUsage:expectedUsage:decisionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:wrapper(*securityOrigin) currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:BlockPtr<void(unsigned long long newQuota)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long newQuota) { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideDatabaseQuotaForSecurityOrigin:wrapper(*securityOrigin) currentQuota:currentQuota currentOriginUsage:currentOriginUsage currentDatabaseUsage:currentUsage expectedUsage:expectedUsage decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long newQuota) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -674,7 +674,7 @@ void UIDelegate::UIClient::windowFrame(WebKit::WebPageProxy&, Function<void(WebC > if (!delegate) > return completionHandler({ }); > >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView getWindowFrameWithCompletionHandler:BlockPtr<void(CGRect)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:getWindowFrameWithCompletionHandler:))](CGRect frame) { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView getWindowFrameWithCompletionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:getWindowFrameWithCompletionHandler:))](CGRect frame) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -745,7 +745,7 @@ void UIDelegate::UIClient::toolbarsAreVisible(WebPageProxy&, Function<void(bool) > if (!delegate) > return completionHandler(true); > >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView getToolbarsAreVisibleWithCompletionHandler:BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:getToolbarsAreVisibleWithCompletionHandler:))](BOOL visible) { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView getToolbarsAreVisibleWithCompletionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:getToolbarsAreVisibleWithCompletionHandler:))](BOOL visible) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -811,7 +811,7 @@ void UIDelegate::UIClient::decidePolicyForNotificationPermissionRequest(WebKit:: > return completionHandler(false); > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:requestNotificationPermissionForSecurityOrigin:decisionHandler:)); >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestNotificationPermissionForSecurityOrigin:wrapper(securityOrigin) decisionHandler:BlockPtr<void(BOOL)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView requestNotificationPermissionForSecurityOrigin:wrapper(securityOrigin) decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] (BOOL result) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -832,7 +832,7 @@ bool UIDelegate::UIClient::runOpenPanel(WebPageProxy*, WebFrameProxy* webFramePr > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(webView:runOpenPanelWithParameters:initiatedByFrame:completionHandler:)); > >- [delegate webView:m_uiDelegate.m_webView runOpenPanelWithParameters:wrapper(*openPanelParameters) initiatedByFrame:wrapper(frame) completionHandler:BlockPtr<void(NSArray *)>::fromCallable([checker = WTFMove(checker), listener = WTFMove(listener)] (NSArray *URLs) mutable { >+ [delegate webView:m_uiDelegate.m_webView runOpenPanelWithParameters:wrapper(*openPanelParameters) initiatedByFrame:wrapper(frame) completionHandler:makeBlockPtr([checker = WTFMove(checker), listener = WTFMove(listener)] (NSArray *URLs) mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -856,7 +856,7 @@ bool UIDelegate::UIClient::runOpenPanel(WebPageProxy*, WebFrameProxy* webFramePr > #if ENABLE(MEDIA_STREAM) > static void requestUserMediaAuthorizationForDevices(const WebFrameProxy& frame, UserMediaPermissionRequestProxy& request, id <WKUIDelegatePrivate> delegate, WKWebView& webView) > { >- auto decisionHandler = BlockPtr<void(BOOL)>::fromCallable([protectedRequest = makeRef(request)](BOOL authorized) { >+ auto decisionHandler = makeBlockPtr([protectedRequest = makeRef(request)](BOOL authorized) { > if (!authorized) { > protectedRequest->deny(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied); > return; >@@ -913,7 +913,7 @@ bool UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest(WebPageProx > > #if PLATFORM(IOS_FAMILY) > bool usingMockCaptureDevices = page.preferences().mockCaptureDevicesEnabled(); >- auto requestCameraAuthorization = BlockPtr<void()>::fromCallable([this, &frame, protectedRequest = makeRef(request), webView = RetainPtr<WKWebView>(m_uiDelegate.m_webView), usingMockCaptureDevices]() { >+ auto requestCameraAuthorization = makeBlockPtr([this, &frame, protectedRequest = makeRef(request), webView = RetainPtr<WKWebView>(m_uiDelegate.m_webView), usingMockCaptureDevices]() { > > if (!protectedRequest->requiresVideoCapture()) { > requestUserMediaAuthorizationForDevices(frame, protectedRequest, (id <WKUIDelegatePrivate>)m_uiDelegate.m_delegate.get(), *webView.get()); >@@ -929,7 +929,7 @@ bool UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest(WebPageProx > protectedRequest->deny(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied); > return; > case AVAuthorizationStatusNotDetermined: >- auto decisionHandler = BlockPtr<void(BOOL)>::fromCallable([this, &frame, protectedRequest = makeRef(protectedRequest.get()), webView = RetainPtr<WKWebView>(m_uiDelegate.m_webView)](BOOL authorized) { >+ auto decisionHandler = makeBlockPtr([this, &frame, protectedRequest = makeRef(protectedRequest.get()), webView = RetainPtr<WKWebView>(m_uiDelegate.m_webView)](BOOL authorized) { > if (!authorized) { > protectedRequest->deny(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied); > return; >@@ -953,7 +953,7 @@ bool UIDelegate::UIClient::decidePolicyForUserMediaPermissionRequest(WebPageProx > request.deny(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied); > return true; > case AVAuthorizationStatusNotDetermined: >- auto decisionHandler = BlockPtr<void(BOOL)>::fromCallable([protectedRequest = makeRef(request), requestCameraAuthorization](BOOL authorized) { >+ auto decisionHandler = makeBlockPtr([protectedRequest = makeRef(request), requestCameraAuthorization](BOOL authorized) { > if (!authorized) { > protectedRequest->deny(UserMediaPermissionRequestProxy::UserMediaAccessDenialReason::PermissionDenied); > return; >@@ -987,7 +987,7 @@ bool UIDelegate::UIClient::checkUserMediaPermissionForOrigin(WebPageProxy& page, > URL requestFrameURL(URL(), frame.url()); > URL mainFrameURL(URL(), mainFrame->url()); > >- auto decisionHandler = BlockPtr<void(NSString*, BOOL)>::fromCallable([protectedRequest = makeRef(request)](NSString*, BOOL authorized) { >+ auto decisionHandler = makeBlockPtr([protectedRequest = makeRef(request)](NSString*, BOOL authorized) { > protectedRequest->setUserMediaAccessInfo(authorized); > }); > >@@ -1032,7 +1032,7 @@ void UIDelegate::UIClient::reachedApplicationCacheOriginQuota(WebPageProxy*, con > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webView:decideWebApplicationCacheQuotaForSecurityOrigin:currentQuota:totalBytesNeeded:decisionHandler:)); > auto apiOrigin = API::SecurityOrigin::create(securityOrigin); > >- [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideWebApplicationCacheQuotaForSecurityOrigin:wrapper(apiOrigin.get()) currentQuota:currentQuota totalBytesNeeded:totalBytesNeeded decisionHandler:BlockPtr<void(unsigned long long)>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long newQuota) { >+ [(id <WKUIDelegatePrivate>)delegate _webView:m_uiDelegate.m_webView decideWebApplicationCacheQuotaForSecurityOrigin:wrapper(apiOrigin.get()) currentQuota:currentQuota totalBytesNeeded:totalBytesNeeded decisionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)](unsigned long long newQuota) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >@@ -1191,7 +1191,7 @@ void UIDelegate::UIClient::requestPointerLock(WebPageProxy* page) > } > > auto checker = CompletionHandlerCallChecker::create(delegate.get(), @selector(_webViewDidRequestPointerLock:completionHandler:)); >- [static_cast<id <WKUIDelegatePrivate>>(delegate) _webViewDidRequestPointerLock:m_uiDelegate.m_webView completionHandler:BlockPtr<void(BOOL)>::fromCallable([checker = WTFMove(checker), page = makeRefPtr(page)] (BOOL allow) { >+ [static_cast<id <WKUIDelegatePrivate>>(delegate) _webViewDidRequestPointerLock:m_uiDelegate.m_webView completionHandler:makeBlockPtr([checker = WTFMove(checker), page = makeRefPtr(page)] (BOOL allow) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >diff --git a/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm b/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm >index d16db8f6833c8bc190ee5a60a08c85c42f8e1ad7..544251c79cedbfb5e35a01bfeff8d04a22b94270 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm >@@ -462,7 +462,7 @@ - (void)clickedOnLink:(NSURL *)link > [alert setInformativeText:WEB_UI_NSSTRING(@"Merely visiting a site is sufficient for malware to install itself and harm your computer.", "Malware confirmation dialog")]; > [alert addButtonWithTitle:WEB_UI_NSSTRING(@"Cancel", "Cancel")]; > [alert addButtonWithTitle:WEB_UI_NSSTRING(@"Continue", "Continue")]; >- [alert beginSheetModalForWindow:self.window completionHandler:BlockPtr<void(NSModalResponse)>::fromCallable([weakSelf = WeakObjCPtr<WKSafeBrowsingWarning>(self), alert](NSModalResponse returnCode) { >+ [alert beginSheetModalForWindow:self.window completionHandler:makeBlockPtr([weakSelf = WeakObjCPtr<WKSafeBrowsingWarning>(self), alert](NSModalResponse returnCode) { > if (auto strongSelf = weakSelf.get()) { > if (returnCode == NSAlertSecondButtonReturn && strongSelf->_completionHandler) > strongSelf->_completionHandler(WebKit::ContinueUnsafeLoad::Yes); >diff --git a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >index 65aecd92192fe6661f1baa42d340786ce4d1d532..308d00934a183f3a4d1e3e184d2ba6a14fb81349 100644 >--- a/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >+++ b/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm >@@ -78,7 +78,7 @@ void WebPageProxy::beginSafeBrowsingCheck(const URL& url, WebFramePolicyListener > SSBLookupContext *context = [SSBLookupContext sharedLookupContext]; > if (!context) > return listener.didReceiveSafeBrowsingResults({ }); >- [context lookUpURL:url completionHandler:BlockPtr<void(SSBLookupResult *, NSError *)>::fromCallable([listener = makeRef(listener), url = url] (SSBLookupResult *result, NSError *error) mutable { >+ [context lookUpURL:url completionHandler:makeBlockPtr([listener = makeRef(listener), url = url] (SSBLookupResult *result, NSError *error) mutable { > RunLoop::main().dispatch([listener = WTFMove(listener), result = retainPtr(result), error = retainPtr(error), url = WTFMove(url)] { > if (error) { > listener->didReceiveSafeBrowsingResults({ }); >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm >index b3c164049ca39670702a342e0acd0e773e1ddd77..389b639d2e9e7890e2dceef7174df9aa833746f2 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm >+++ b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm >@@ -86,7 +86,7 @@ void HidConnection::terminate() > void HidConnection::send(Vector<uint8_t>&& data, DataSentCallback&& callback) > { > ASSERT(m_initialized); >- auto task = BlockPtr<void()>::fromCallable([device = m_device, data = WTFMove(data), callback = WTFMove(callback)]() mutable { >+ auto task = makeBlockPtr([device = m_device, data = WTFMove(data), callback = WTFMove(callback)]() mutable { > ASSERT(!RunLoop::isMain()); > > DataSent sent = DataSent::Yes; >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm >index 0e345df3e5120a31d4a8e3274b65c152728eb165..944705c269cb1356958bf7465dbfc90d30012565 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm >+++ b/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm >@@ -42,7 +42,7 @@ void LocalConnection::getUserConsent(const String& reason, UserConsentCallback&& > // FIXME(182772) > #if PLATFORM(IOS_FAMILY) > auto context = adoptNS([allocLAContextInstance() init]); >- auto reply = BlockPtr<void(BOOL, NSError *)>::fromCallable([completionHandler = WTFMove(completionHandler)] (BOOL success, NSError *error) mutable { >+ auto reply = makeBlockPtr([completionHandler = WTFMove(completionHandler)] (BOOL success, NSError *error) mutable { > ASSERT(!RunLoop::isMain()); > > UserConsent consent = UserConsent::Yes; >@@ -63,7 +63,7 @@ void LocalConnection::getUserConsent(const String& reason, SecAccessControlRef a > // FIXME(182772) > #if PLATFORM(IOS_FAMILY) > auto context = adoptNS([allocLAContextInstance() init]); >- auto reply = BlockPtr<void(BOOL, NSError *)>::fromCallable([context, completionHandler = WTFMove(completionHandler)] (BOOL success, NSError *error) mutable { >+ auto reply = makeBlockPtr([context, completionHandler = WTFMove(completionHandler)] (BOOL success, NSError *error) mutable { > ASSERT(!RunLoop::isMain()); > > UserConsent consent = UserConsent::Yes; >@@ -113,7 +113,7 @@ void LocalConnection::getAttestation(const String& rpId, const String& username, > }; > > // FIXME(183652): Reduce prompt for biometrics >- DeviceIdentityIssueClientCertificateWithCompletion(dispatch_get_main_queue(), options, BlockPtr<void(SecKeyRef, NSArray *, NSError *)>::fromCallable(WTFMove(completionHandler)).get()); >+ DeviceIdentityIssueClientCertificateWithCompletion(dispatch_get_main_queue(), options, makeBlockPtr(WTFMove(completionHandler)).get()); > #endif > } > >diff --git a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp >index 26c996601cf499a87bb0c761a12daa4c3a392f55..4ef22e701c83424c0b739462f1b101dab3c6f12f 100644 >--- a/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp >+++ b/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp >@@ -70,7 +70,7 @@ void MockHidConnection::terminate() > void MockHidConnection::send(Vector<uint8_t>&& data, DataSentCallback&& callback) > { > ASSERT(m_initialized); >- auto task = BlockPtr<void()>::fromCallable([weakThis = makeWeakPtr(*this), data = WTFMove(data), callback = WTFMove(callback)]() mutable { >+ auto task = makeBlockPtr([weakThis = makeWeakPtr(*this), data = WTFMove(data), callback = WTFMove(callback)]() mutable { > ASSERT(!RunLoop::isMain()); > RunLoop::main().dispatch([weakThis, data = WTFMove(data), callback = WTFMove(callback)]() mutable { > if (!weakThis) { >diff --git a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >index e9b1f1c219caf10af780fc494e7db52ecb7b27d7..dc0cd36c00629dd51421d98596ab32da55b3f6dc 100644 >--- a/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >+++ b/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm >@@ -843,7 +843,7 @@ void PageClientImpl::didChangeDataInteractionCaretRect(const IntRect& previousCa > #if USE(QUICK_LOOK) > void PageClientImpl::requestPasswordForQuickLookDocument(const String& fileName, WTF::Function<void(const String&)>&& completionHandler) > { >- auto passwordHandler = BlockPtr<void (NSString *)>::fromCallable([completionHandler = WTFMove(completionHandler)](NSString *password) { >+ auto passwordHandler = makeBlockPtr([completionHandler = WTFMove(completionHandler)](NSString *password) { > completionHandler(password); > }); > >diff --git a/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm b/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm >index f6336fc9ec7fedf39ffff44e7fc862acaba5b9bc..c1cf58758ecba9857a0a61ad48d6bfa3e1c0d7f3 100644 >--- a/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm >+++ b/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm >@@ -188,7 +188,7 @@ - (void)geolocationAuthorizationGranted > RetainPtr<WKFrameInfo> frameInfo = wrapper(API::FrameInfo::create(*request.frame.get(), *request.origin.get())); > RefPtr<WebKit::CompletionHandlerCallChecker> checker = WebKit::CompletionHandlerCallChecker::create(uiDelegate, @selector(_webView:requestGeolocationAuthorizationForURL:frame:decisionHandler:)); > WKWebView *viewFromRequest = request.view.get(); >- [uiDelegate _webView:viewFromRequest requestGeolocationAuthorizationForURL:requestFrameURL frame:frameInfo.get() decisionHandler:BlockPtr<void(BOOL)>::fromCallable([request = WTFMove(request), checker = WTFMove(checker)](BOOL authorized) { >+ [uiDelegate _webView:viewFromRequest requestGeolocationAuthorizationForURL:requestFrameURL frame:frameInfo.get() decisionHandler:makeBlockPtr([request = WTFMove(request), checker = WTFMove(checker)](BOOL authorized) { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >diff --git a/Source/WebKit/UIProcess/mac/ServicesController.mm b/Source/WebKit/UIProcess/mac/ServicesController.mm >index 3c8bc642af81ceca42b170546a53f8c563a09150..cd30b172c1e55bdf99c0e4e7711e305dfdd1eee7 100644 >--- a/Source/WebKit/UIProcess/mac/ServicesController.mm >+++ b/Source/WebKit/UIProcess/mac/ServicesController.mm >@@ -73,7 +73,7 @@ static void hasCompatibleServicesForItems(dispatch_group_t group, NSArray *items > #if __MAC_OS_X_VERSION_MIN_REQUIRED >= 101400 > if ([NSSharingService respondsToSelector:@selector(getSharingServicesForItems:mask:completion:)]) { > dispatch_group_enter(group); >- [NSSharingService getSharingServicesForItems:items mask:servicesMask completion:BlockPtr<void(NSArray *)>::fromCallable([completionHandler = WTFMove(completionHandler), group](NSArray *services) { >+ [NSSharingService getSharingServicesForItems:items mask:servicesMask completion:makeBlockPtr([completionHandler = WTFMove(completionHandler), group](NSArray *services) { > completionHandler(services.count); > dispatch_group_leave(group); > }).get()]; >@@ -123,7 +123,7 @@ void ServicesController::refreshExistingServices(bool refreshImmediately) > m_hasRichContentServices = hasServices; > }); > >- dispatch_group_notify(serviceLookupGroup.get(), dispatch_get_main_queue(), BlockPtr<void(void)>::fromCallable([this] { >+ dispatch_group_notify(serviceLookupGroup.get(), dispatch_get_main_queue(), makeBlockPtr([this] { > bool availableServicesChanged = (m_lastSentHasImageServices != m_hasImageServices) || (m_lastSentHasSelectionServices != m_hasSelectionServices) || (m_lastSentHasRichContentServices != m_hasRichContentServices); > > m_lastSentHasSelectionServices = m_hasSelectionServices; >diff --git a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >index 1d4cc31d59ab8c80ccefa28a2051c6b53d73f1ee..4ae20f4bcaa90daec22018d633ef4c90b38f8c80 100644 >--- a/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >+++ b/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm >@@ -145,7 +145,7 @@ void PageLoaderClient::didStartProvisionalLoadForFrame(WebKit::WebPage&, WebKit: > SEL selector = @selector(webProcessPlugInBrowserContextController:willStartProvisionalLoadForFrame:completionHandler:); > if ([loadDelegate() respondsToSelector:selector]) { > auto checker = WebKit::CompletionHandlerCallChecker::create(loadDelegate(), selector); >- [loadDelegate() webProcessPlugInBrowserContextController:pluginContextController() willStartProvisionalLoadForFrame:wrapper(frame) completionHandler:BlockPtr<void()>::fromCallable([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] () mutable { >+ [loadDelegate() webProcessPlugInBrowserContextController:pluginContextController() willStartProvisionalLoadForFrame:wrapper(frame) completionHandler:makeBlockPtr([completionHandler = WTFMove(completionHandler), checker = WTFMove(checker)] () mutable { > if (checker->completionHandlerHasBeenCalled()) > return; > checker->didCallCompletionHandler(); >diff --git a/Tools/ChangeLog b/Tools/ChangeLog >index c3ecd73e1c8c91b60992950203416e02ff03712c..5b24f87bbcf8847d3a325bec2e9de5aa6112c979 100644 >--- a/Tools/ChangeLog >+++ b/Tools/ChangeLog >@@ -1,3 +1,20 @@ >+2018-12-11 Andy Estes <aestes@apple.com> >+ >+ Introduce makeBlockPtr for lambdas >+ https://bugs.webkit.org/show_bug.cgi?id=192594 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ Adopted makeBlockPtr and added API tests. >+ >+ * DumpRenderTree/TestRunner.cpp: >+ (TestRunner::callUIScriptCallback): >+ * TestWebKitAPI/Tests/WTF/BlockPtr.mm: >+ (TestWebKitAPI::TEST): >+ * TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm: >+ (-[DownloadProgressTestRunner init]): >+ (-[DownloadProgressTestRunner subscribeAndWaitForProgress]): >+ > 2018-12-10 Don Olmstead <don.olmstead@sony.com> > > [CMake] Add ENABLE_RESOURCE_LOAD_STATISTICS to WebKitFeatures.cmake >diff --git a/Tools/DumpRenderTree/TestRunner.cpp b/Tools/DumpRenderTree/TestRunner.cpp >index 50808bcad600cf9811e89e1a25af9c2d7ec6a318..3f4a28992b53b3f2bf4ecdf6455df70733bc7512 100644 >--- a/Tools/DumpRenderTree/TestRunner.cpp >+++ b/Tools/DumpRenderTree/TestRunner.cpp >@@ -2467,7 +2467,7 @@ void TestRunner::callUIScriptCallback(unsigned callbackID, JSStringRef result) > }); > #else > WebThreadRun( >- BlockPtr<void()>::fromCallable([protectedThis = makeRef(*this), callbackID, protectedResult] { >+ makeBlockPtr([protectedThis = makeRef(*this), callbackID, protectedResult] { > JSContextRef context = protectedThis->mainFrameJSContext(); > JSValueRef resultValue = JSValueMakeString(context, protectedResult.get()); > protectedThis->callTestRunnerCallback(callbackID, 1, &resultValue); >diff --git a/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm b/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm >index d3fa505e428fffb787f33cfdc28453ac3b8109c3..296b8f1571489057ecfa95045c7e14b73a0e71bf 100644 >--- a/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm >+++ b/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm >@@ -47,6 +47,20 @@ TEST(BlockPtr, FromLambda) > }); > > EXPECT_EQ(10u, block()); >+ >+ moveOnly = 20; >+ block = makeBlockPtr([moveOnly = WTFMove(moveOnly)] { >+ return moveOnly.value(); >+ }); >+ >+ EXPECT_EQ(20u, block()); >+ >+ moveOnly = 30; >+ block = makeBlockPtr([moveOnly = WTFMove(moveOnly)]() mutable { >+ return moveOnly.value(); >+ }); >+ >+ EXPECT_EQ(30u, block()); > } > > } >diff --git a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm >index f6232e274a863694ee37d674e1f2e8235dd8ad90..f771243383fe94c79bb4995d784ad234ff984514 100644 >--- a/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm >+++ b/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm >@@ -141,7 +141,7 @@ - (instancetype)init > > currentTestRunner = self; > >- m_unpublishingBlock = BlockPtr<void(void)>::fromCallable([self] { >+ m_unpublishingBlock = makeBlockPtr([self] { > [self _didLoseProgress]; > }).get(); > >@@ -210,7 +210,7 @@ - (void)_didLoseProgress > - (void)subscribeAndWaitForProgress > { > if (!m_progressSubscriber) { >- auto publishingHandler = BlockPtr<NSProgressUnpublishingHandler(NSProgress *)>::fromCallable([weakSelf = WeakObjCPtr<DownloadProgressTestRunner> { self }](NSProgress *progress) { >+ auto publishingHandler = makeBlockPtr([weakSelf = WeakObjCPtr<DownloadProgressTestRunner> { self }](NSProgress *progress) { > if (auto strongSelf = weakSelf.get()) { > [strongSelf.get() _didGetProgress:progress]; > return strongSelf->m_unpublishingBlock.get();
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 192594
: 357061