Diff
Modified: trunk/Source/WTF/ChangeLog (239077 => 239078)
--- trunk/Source/WTF/ChangeLog 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WTF/ChangeLog 2018-12-11 19:21:38 UTC (rev 239078)
@@ -1,3 +1,24 @@
+2018-12-11 Andy Estes <[email protected]>
+
+ Introduce makeBlockPtr for lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=192594
+
+ Reviewed by Alex Christensen.
+
+ 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 Don Olmstead <[email protected]>
Move ENABLE_RESOURCE_LOAD_STATISTICS to FeatureDefines.xcconfig
Modified: trunk/Source/WTF/wtf/BlockPtr.h (239077 => 239078)
--- trunk/Source/WTF/wtf/BlockPtr.h 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WTF/wtf/BlockPtr.h 2018-12-11 19:21:38 UTC (rev 239078)
@@ -191,7 +191,25 @@
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;
using WTF::makeBlockPtr;
Modified: trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp (239077 => 239078)
--- trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WTF/wtf/cocoa/WorkQueueCocoa.cpp 2018-12-11 19:21:38 UTC (rev 239078)
@@ -33,7 +33,7 @@
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());
}
@@ -40,7 +40,7 @@
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::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());
}
Modified: trunk/Source/WebCore/ChangeLog (239077 => 239078)
--- trunk/Source/WebCore/ChangeLog 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/ChangeLog 2018-12-11 19:21:38 UTC (rev 239078)
@@ -1,3 +1,24 @@
+2018-12-11 Andy Estes <[email protected]>
+
+ Introduce makeBlockPtr for lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=192594
+
+ Reviewed by Alex Christensen.
+
+ 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 Brent Fulgham <[email protected]>
SVGViewSpec objects should mark relevant SVG elements
Modified: trunk/Source/WebCore/PAL/ChangeLog (239077 => 239078)
--- trunk/Source/WebCore/PAL/ChangeLog 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/PAL/ChangeLog 2018-12-11 19:21:38 UTC (rev 239078)
@@ -1,3 +1,15 @@
+2018-12-11 Andy Estes <[email protected]>
+
+ Introduce makeBlockPtr for lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=192594
+
+ Reviewed by Alex Christensen.
+
+ Adopted makeBlockPtr.
+
+ * pal/Logging.cpp:
+ (PAL::registerNotifyCallback):
+
2018-12-10 Don Olmstead <[email protected]>
Move ENABLE_RESOURCE_LOAD_STATISTICS to FeatureDefines.xcconfig
Modified: trunk/Source/WebCore/PAL/pal/Logging.cpp (239077 => 239078)
--- trunk/Source/WebCore/PAL/pal/Logging.cpp 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/PAL/pal/Logging.cpp 2018-12-11 19:21:38 UTC (rev 239078)
@@ -39,7 +39,7 @@
{
#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
Modified: trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm (239077 => 239078)
--- trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/platform/cocoa/FileMonitorCocoa.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -54,7 +54,7 @@
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;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm (239077 => 239078)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/VideoFullscreenLayerManagerObjC.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -130,7 +130,7 @@
}
}
- [CATransaction setCompletionBlock:BlockPtr<void ()>::fromCallable([completionHandler = WTFMove(completionHandler)] {
+ [CATransaction setCompletionBlock:makeBlockPtr([completionHandler = WTFMove(completionHandler)] {
completionHandler();
}).get()];
Modified: trunk/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm (239077 => 239078)
--- trunk/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/platform/graphics/gpu/legacy/cocoa/GPULegacyCommandBufferMetal.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -43,7 +43,7 @@
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()];
}
Modified: trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm (239077 => 239078)
--- trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/platform/network/cocoa/WebCoreNSURLSession.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -132,7 +132,7 @@
- (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 @@
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));
Modified: trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm (239077 => 239078)
--- trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebCore/platform/network/mac/WebCoreResourceHandleAsOperationQueueDelegate.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -68,7 +68,7 @@
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;
Modified: trunk/Source/WebKit/ChangeLog (239077 => 239078)
--- trunk/Source/WebKit/ChangeLog 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/ChangeLog 2018-12-11 19:21:38 UTC (rev 239078)
@@ -1,3 +1,89 @@
+2018-12-11 Andy Estes <[email protected]>
+
+ Introduce makeBlockPtr for lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=192594
+
+ Reviewed by Alex Christensen.
+
+ 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-11 Alex Christensen <[email protected]>
Fix an internal build failure after r239014
Modified: trunk/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm (239077 => 239078)
--- trunk/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/NetworkProcess/Downloads/cocoa/WKDownloadProgress.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -67,7 +67,7 @@
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;
Modified: trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm (239077 => 239078)
--- trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/NetworkProcess/cache/NetworkCacheIOChannelCocoa.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -91,7 +91,7 @@
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 @@
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);
Modified: trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm (239077 => 239078)
--- trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/NetworkProcess/cocoa/NetworkProcessCocoa.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -181,7 +181,7 @@
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 @@
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();
Modified: trunk/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm (239077 => 239078)
--- trunk/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/NetworkProcess/watchos/NetworkProximityAssertion.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -184,7 +184,7 @@
// 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;
}
}
Modified: trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -5222,7 +5222,7 @@
}
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();
Modified: trunk/Source/WebKit/UIProcess/API/mac/WKView.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/API/mac/WKView.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/API/mac/WKView.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -904,7 +904,7 @@
{
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) {
Modified: trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/ApplePay/cocoa/WebPaymentCoordinatorProxyCocoa.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -264,7 +264,7 @@
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 @@
});
}).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::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);
});
Modified: trunk/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/ApplePay/mac/WebPaymentCoordinatorProxyMac.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -41,7 +41,7 @@
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;
Modified: trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/AutomationSessionClient.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -90,11 +90,11 @@
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 @@
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 @@
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 @@
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 @@
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)
Modified: trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/DownloadClient.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -123,7 +123,7 @@
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 @@
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();
Modified: trunk/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/IconLoadingDelegate.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -87,7 +87,7 @@
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) {
Modified: trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/NavigationState.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -374,7 +374,7 @@
}
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 @@
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 @@
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 @@
};
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 @@
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 @@
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 @@
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();
Modified: trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UIDelegate.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -196,7 +196,7 @@
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 @@
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 @@
}
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 @@
}
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 @@
}
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
#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 @@
#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 @@
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 @@
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 @@
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 @@
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 @@
}
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();
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WKSafeBrowsingWarning.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -464,7 +464,7 @@
[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);
Modified: trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -78,7 +78,7 @@
SSBLookupContext *context = [SSBLookupContext sharedLookupContext];
if (!context)
return listener.didReceiveSafeBrowsingResults({ });
- [context lookUpURL:url completionHandler:BlockPtr<void(SSBLookupResult *, NSError *)>::fromCallable([listener = makeRef(listener), url = "" (SSBLookupResult *result, NSError *error) mutable {
+ [context lookUpURL:url completionHandler:makeBlockPtr([listener = makeRef(listener), url = "" (SSBLookupResult *result, NSError *error) mutable {
RunLoop::main().dispatch([listener = WTFMove(listener), result = retainPtr(result), error = retainPtr(error), url = "" {
if (error) {
listener->didReceiveSafeBrowsingResults({ });
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/HidConnection.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -86,7 +86,7 @@
void HidConnection::send(Vector<uint8_t>&& data, DataSentCallback&& callback)
{
ASSERT(m_initialized);
- auto task = BlockPtr<void()>::fromCallable([device = m_device, data = "" callback = WTFMove(callback)]() mutable {
+ auto task = makeBlockPtr([device = m_device, data = "" callback = WTFMove(callback)]() mutable {
ASSERT(!RunLoop::isMain());
DataSent sent = DataSent::Yes;
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Cocoa/LocalConnection.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -42,7 +42,7 @@
// 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 @@
// 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 @@
};
// 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
}
Modified: trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/WebAuthentication/Mock/MockHidConnection.cpp 2018-12-11 19:21:38 UTC (rev 239078)
@@ -70,7 +70,7 @@
void MockHidConnection::send(Vector<uint8_t>&& data, DataSentCallback&& callback)
{
ASSERT(m_initialized);
- auto task = BlockPtr<void()>::fromCallable([weakThis = makeWeakPtr(*this), data = "" callback = WTFMove(callback)]() mutable {
+ auto task = makeBlockPtr([weakThis = makeWeakPtr(*this), data = "" callback = WTFMove(callback)]() mutable {
ASSERT(!RunLoop::isMain());
RunLoop::main().dispatch([weakThis, data = "" callback = WTFMove(callback)]() mutable {
if (!weakThis) {
Modified: trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/ios/PageClientImplIOS.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -843,7 +843,7 @@
#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);
});
Modified: trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/ios/WKGeolocationProviderIOS.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -188,7 +188,7 @@
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();
Modified: trunk/Source/WebKit/UIProcess/mac/ServicesController.mm (239077 => 239078)
--- trunk/Source/WebKit/UIProcess/mac/ServicesController.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/UIProcess/mac/ServicesController.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -73,7 +73,7 @@
#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 @@
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;
Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm (239077 => 239078)
--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/mac/WKWebProcessPlugInBrowserContextController.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -145,7 +145,7 @@
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();
Modified: trunk/Tools/ChangeLog (239077 => 239078)
--- trunk/Tools/ChangeLog 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Tools/ChangeLog 2018-12-11 19:21:38 UTC (rev 239078)
@@ -1,3 +1,20 @@
+2018-12-11 Andy Estes <[email protected]>
+
+ Introduce makeBlockPtr for lambdas
+ https://bugs.webkit.org/show_bug.cgi?id=192594
+
+ Reviewed by Alex Christensen.
+
+ 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-11 Chris Dumez <[email protected]>
REGRESSION (r238764-238783): TestWTF.WTF.StringOperators is failing
Modified: trunk/Tools/DumpRenderTree/TestRunner.cpp (239077 => 239078)
--- trunk/Tools/DumpRenderTree/TestRunner.cpp 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Tools/DumpRenderTree/TestRunner.cpp 2018-12-11 19:21:38 UTC (rev 239078)
@@ -2467,7 +2467,7 @@
});
#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);
Modified: trunk/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm (239077 => 239078)
--- trunk/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Tools/TestWebKitAPI/Tests/WTF/BlockPtr.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -47,6 +47,20 @@
});
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());
}
}
Modified: trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm (239077 => 239078)
--- trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm 2018-12-11 19:10:48 UTC (rev 239077)
+++ trunk/Tools/TestWebKitAPI/Tests/WebKitCocoa/DownloadProgress.mm 2018-12-11 19:21:38 UTC (rev 239078)
@@ -141,7 +141,7 @@
currentTestRunner = self;
- m_unpublishingBlock = BlockPtr<void(void)>::fromCallable([self] {
+ m_unpublishingBlock = makeBlockPtr([self] {
[self _didLoseProgress];
}).get();
@@ -210,7 +210,7 @@
- (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();