Allow constructing a WTF:Function from a function pointer
https://bugs.webkit.org/show_bug.cgi?id=173660
Reviewed by Alex Christensen.
Source/WebCore:
Construct WTF:Function directly from a function pointer when possible
instead of constructing a lambda to do so.
* Modules/encryptedmedia/InitDataRegistry.cpp:
(WebCore::InitDataRegistry::InitDataRegistry):
* page/Page.cpp:
* page/mac/PageMac.mm:
(WebCore::Page::platformInitialize):
* platform/cf/MainThreadSharedTimerCF.cpp:
(WebCore::setupPowerObserver):
* platform/mac/WebCoreNSURLExtras.mm:
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::canUseForWithReason):
* workers/Worker.cpp:
(WebCore::Worker::Worker):
Source/WTF:
Allow constructing a WTF:Function from a function pointer and
assigning a function pointer to a WTF:Function.
* wtf/Function.h:
Tools:
Add API test coverage.
* TestWebKitAPI/Tests/WTF/Function.cpp:
(TestWebKitAPI::returnThree):
(TestWebKitAPI::returnFour):
(TestWebKitAPI::returnPassedValue):
(TestWebKitAPI::TEST):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@218660 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp b/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp
index f0183b1..f9e4bf8 100644
--- a/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp
+++ b/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp
@@ -57,7 +57,7 @@
#if PLATFORM(MAC)
static PowerObserver* powerObserver;
if (!powerObserver)
- powerObserver = std::make_unique<PowerObserver>([] { restartSharedTimer(); }).release();
+ powerObserver = std::make_unique<PowerObserver>(restartSharedTimer).release();
#elif PLATFORM(IOS)
static bool registeredForApplicationNotification = false;
if (!registeredForApplicationNotification) {