Introduce makeBlockPtr for lambdas
authoraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2018 19:21:38 +0000 (19:21 +0000)
committeraestes@apple.com <aestes@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 11 Dec 2018 19:21:38 +0000 (19:21 +0000)
commit495fb1444297f2a4988632ba703ec54b40231cc0
tree817c87615f38b15c1454f26903610050fef8984a
parent55da284a380da491048d22e92696923dc472cfe5
Introduce makeBlockPtr for lambdas
https://bugs.webkit.org/show_bug.cgi?id=192594

Reviewed by Alex Christensen.

Source/WebCore:

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

Source/WebCore/PAL:

Adopted makeBlockPtr.

* pal/Logging.cpp:
(PAL::registerNotifyCallback):

Source/WebKit:

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

Source/WTF:

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

Tools:

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@239078 268f45cc-cd09-0410-ab3c-d52691b4dbfc
38 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/BlockPtr.h
Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp
Source/WebCore/ChangeLog
Source/WebCore/PAL/ChangeLog
Source/WebCore/PAL/pal/Logging.cpp
Source/WebCore/platform/cocoa/FileMonitorCocoa.mm
Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm
Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm
Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm
Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm
Source/WebKit/ChangeLog
Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm
Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm
Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm
Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/API/mac/WKView.mm
Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm
Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm
Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm
Source/WebKit/UIProcess/Cocoa/DownloadClient.mm
Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm
Source/WebKit/UIProcess/Cocoa/NavigationState.mm
Source/WebKit/UIProcess/Cocoa/UIDelegate.mm
Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm
Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm
Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp
Source/WebKit/UIProcess/ios/PageClientImplIOS.mm
Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm
Source/WebKit/UIProcess/mac/ServicesController.mm
Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm
Tools/ChangeLog
Tools/DumpRenderTree/TestRunner.cpp
Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm
Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm