Diff
Modified: trunk/Source/WebCore/ChangeLog (218614 => 218615)
--- trunk/Source/WebCore/ChangeLog 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/ChangeLog 2017-06-20 23:42:18 UTC (rev 218615)
@@ -1,3 +1,130 @@
+2017-06-20 Chris Dumez <cdu...@apple.com>
+
+ Use WTF::Function instead of std::function in more places in WebCore/
+ https://bugs.webkit.org/show_bug.cgi?id=173583
+
+ Reviewed by Darin Adler.
+
+ Use WTF::Function instead of std::function in more places in WebCore/ to
+ reduce copying.
+
+ * page/Page.cpp:
+ * platform/HysteresisActivity.h:
+ (WebCore::HysteresisActivity::HysteresisActivity):
+ * platform/Logging.cpp:
+ (WebCore::registerNotifyCallback):
+ * platform/Logging.h:
+ * platform/MainThreadSharedTimer.cpp:
+ (WebCore::MainThreadSharedTimer::setFiredFunction):
+ * platform/MainThreadSharedTimer.h:
+ * platform/PlatformPasteboard.h:
+ * platform/ScopeGuard.h:
+ (WebCore::ScopeGuard::ScopeGuard):
+ (WebCore::ScopeGuard::enable):
+ * platform/ScrollAnimationSmooth.cpp:
+ (WebCore::ScrollAnimationSmooth::ScrollAnimationSmooth):
+ * platform/ScrollAnimationSmooth.h:
+ * platform/SharedTimer.h:
+ * platform/audio/PlatformMediaSessionManager.cpp:
+ (WebCore::PlatformMediaSessionManager::currentSessionsMatching):
+ * platform/audio/PlatformMediaSessionManager.h:
+ * platform/cf/MainThreadSharedTimerCF.cpp:
+ (WebCore::setupPowerObserver):
+ * platform/cf/RunLoopObserver.h:
+ (WebCore::RunLoopObserver::RunLoopObserver):
+ * platform/graphics/GraphicsContext.h:
+ * platform/graphics/GraphicsLayer.cpp:
+ (WebCore::GraphicsLayer::traverse):
+ * platform/graphics/GraphicsLayer.h:
+ * platform/graphics/MediaPlayer.cpp:
+ (WebCore::addMediaEngine):
+ * platform/graphics/MediaPlayer.h:
+ * platform/graphics/Path.h:
+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp:
+ (WebCore::MediaPlayerPrivateAVFoundation::seekCompleted):
+ (WebCore::MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification):
+ (WebCore::MediaPlayerPrivateAVFoundation::dispatchNotification):
+ * platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h:
+ (WebCore::MediaPlayerPrivateAVFoundation::Notification::Notification):
+ (WebCore::MediaPlayerPrivateAVFoundation::Notification::function):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm:
+ (-[WebCoreAVFMovieObserver observeValueForKeyPath:ofObject:change:context:]):
+ * platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
+ (WebCore::runWithoutAnimations):
+ * platform/graphics/cocoa/IOSurface.h:
+ * platform/graphics/cocoa/IOSurface.mm:
+ (WebCore::IOSurface::convertToFormat):
+ * platform/graphics/gstreamer/MainThreadNotifier.h:
+ * platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h:
+ (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::create):
+ (WebCore::MediaPlayerRequestInstallMissingPluginsCallback::MediaPlayerRequestInstallMissingPluginsCallback):
+ * platform/graphics/win/GraphicsContextDirect2D.cpp:
+ (WebCore::GraphicsContext::drawWithoutShadow):
+ (WebCore::GraphicsContext::drawWithShadow):
+ * platform/gtk/PasteboardHelper.cpp:
+ (WebCore::ClipboardSetData::ClipboardSetData):
+ (WebCore::PasteboardHelper::writeClipboardContents):
+ * platform/gtk/PasteboardHelper.h:
+ * platform/gtk/PlatformPasteboardGtk.cpp:
+ (WebCore::PlatformPasteboard::writeToClipboard):
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.h:
+ * platform/ios/WebVideoFullscreenInterfaceAVKit.mm:
+ (WebVideoFullscreenInterfaceAVKit::preparedToReturnToInline):
+ (WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline):
+ * platform/mac/PowerObserverMac.cpp:
+ (WebCore::PowerObserver::PowerObserver):
+ * platform/mac/PowerObserverMac.h:
+ * platform/mac/WebCoreNSURLExtras.mm:
+ (WebCore::isSecondLevelDomainNameAllowedByTLDRules):
+ * platform/mediastream/CaptureDeviceManager.cpp:
+ (CaptureDeviceManager::addCaptureDeviceChangedObserver):
+ * platform/mediastream/CaptureDeviceManager.h:
+ * platform/mediastream/RealtimeMediaSource.cpp:
+ (WebCore::RealtimeMediaSource::scheduleDeferredTask):
+ * platform/mediastream/RealtimeMediaSource.h:
+ * platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm:
+ (-[WebAVAudioSessionAvailableInputsListener initWithCallback:]):
+ * platform/mediastream/mac/CoreAudioCaptureSource.h:
+ * platform/mock/ScrollAnimatorMock.cpp:
+ (WebCore::ScrollAnimatorMock::ScrollAnimatorMock):
+ * platform/mock/ScrollAnimatorMock.h:
+ * platform/network/CookieStorage.h:
+ * platform/network/NetworkStateNotifier.cpp:
+ (WebCore::NetworkStateNotifier::addNetworkStateChangeListener):
+ * platform/network/NetworkStateNotifier.h:
+ * platform/network/NetworkStorageSession.cpp:
+ (WebCore::NetworkStorageSession::forEach):
+ * platform/network/NetworkStorageSession.h:
+ * platform/network/cf/CookieStorageCFNet.cpp:
+ (WebCore::cookieChangeCallbackMap):
+ (WebCore::startObservingCookieChanges):
+ * platform/network/cf/SocketStreamHandleImplCFNet.cpp:
+ (WebCore::callOnMainThreadAndWait):
+ * platform/network/mac/CookieStorageMac.mm:
+ (-[WebCookieStorageObjCAdapter startListeningForCookieChangeNotificationsWithCallback:]):
+ (WebCore::startObservingCookieChanges):
+ * platform/network/soup/CookieStorageSoup.cpp:
+ (WebCore::startObservingCookieChanges):
+ * platform/network/soup/SoupNetworkSession.cpp:
+ (WebCore::SoupNetworkSession::checkTLSErrors):
+ * platform/network/soup/SoupNetworkSession.h:
+ * platform/sql/SQLiteDatabase.cpp:
+ (WebCore::destroyCollationFunction):
+ (WebCore::callCollationFunction):
+ (WebCore::SQLiteDatabase::setCollationFunction):
+ * platform/sql/SQLiteDatabase.h:
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::traverseVisibleNonCompositedDescendantLayers):
+ * rendering/RenderListBox.cpp:
+ (WebCore::RenderListBox::paintItem):
+ * rendering/RenderListBox.h:
+ * rendering/line/BreakingContext.h:
+ (WebCore::BreakingContext::InlineIteratorHistory::push):
+ (WebCore::BreakingContext::InlineIteratorHistory::update):
+ * workers/Worker.cpp:
+ (WebCore::Worker::Worker):
+ * workers/WorkerRunLoop.cpp:
+
2017-06-20 Ryan Haddad <ryanhad...@apple.com>
Unreviewed, rolling out r218524.
Modified: trunk/Source/WebCore/page/Page.cpp (218614 => 218615)
--- trunk/Source/WebCore/page/Page.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/page/Page.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -281,7 +281,7 @@
if (!allPages) {
allPages = new HashSet<Page*>;
- networkStateNotifier().addNetworkStateChangeListener(networkStateChanged);
+ networkStateNotifier().addNetworkStateChangeListener([] (bool isOnLine) { networkStateChanged(isOnLine); });
}
ASSERT(!allPages->contains(this));
Modified: trunk/Source/WebCore/page/mac/PageMac.mm (218614 => 218615)
--- trunk/Source/WebCore/page/mac/PageMac.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/page/mac/PageMac.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -61,8 +61,8 @@
#if ENABLE(TREE_DEBUGGING)
static std::once_flag onceFlag;
std::call_once(onceFlag, [] {
- registerNotifyCallback("com.apple.WebKit.showRenderTree", printRenderTreeForLiveDocuments);
- registerNotifyCallback("com.apple.WebKit.showLayerTree", printLayerTreeForLiveDocuments);
+ registerNotifyCallback("com.apple.WebKit.showRenderTree", [] { printRenderTreeForLiveDocuments(); });
+ registerNotifyCallback("com.apple.WebKit.showLayerTree", [] { printLayerTreeForLiveDocuments(); });
});
#endif
}
Modified: trunk/Source/WebCore/platform/HysteresisActivity.h (218614 => 218615)
--- trunk/Source/WebCore/platform/HysteresisActivity.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/HysteresisActivity.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -39,8 +39,8 @@
class HysteresisActivity {
public:
- explicit HysteresisActivity(std::function<void(HysteresisState)> callback = [](HysteresisState) { }, double hysteresisSeconds = DefaultHysteresisSeconds)
- : m_callback(callback)
+ explicit HysteresisActivity(WTF::Function<void(HysteresisState)>&& callback = [](HysteresisState) { }, double hysteresisSeconds = DefaultHysteresisSeconds)
+ : m_callback(WTFMove(callback))
, m_hysteresisSeconds(hysteresisSeconds)
, m_active(false)
, m_timer(*this, &HysteresisActivity::hysteresisTimerFired)
@@ -88,7 +88,7 @@
m_callback(HysteresisState::Stopped);
}
- std::function<void(HysteresisState)> m_callback;
+ WTF::Function<void(HysteresisState)> m_callback;
double m_hysteresisSeconds; // FIXME: Should use Seconds.
bool m_active;
Timer m_timer;
Modified: trunk/Source/WebCore/platform/Logging.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/Logging.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/Logging.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -33,6 +33,7 @@
#if PLATFORM(COCOA)
#include <notify.h>
+#include <wtf/BlockPtr.h>
#endif
namespace WebCore {
@@ -79,13 +80,13 @@
}
#ifndef NDEBUG
-void registerNotifyCallback(const String& notifyID, std::function<void()> callback)
+void registerNotifyCallback(const String& notifyID, WTF::Function<void()>&& callback)
{
#if PLATFORM(COCOA)
int token;
- notify_register_dispatch(notifyID.utf8().data(), &token, dispatch_get_main_queue(), ^(int) {
+ notify_register_dispatch(notifyID.utf8().data(), &token, dispatch_get_main_queue(), BlockPtr<void (int)>::fromCallable([callback = WTFMove(callback)] (int) {
callback();
- });
+ }).get());
#else
UNUSED_PARAM(notifyID);
UNUSED_PARAM(callback);
Modified: trunk/Source/WebCore/platform/Logging.h (218614 => 218615)
--- trunk/Source/WebCore/platform/Logging.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/Logging.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -103,7 +103,7 @@
bool isLogChannelEnabled(const String& name);
WEBCORE_EXPORT void setLogChannelToAccumulate(const String& name);
#ifndef NDEBUG
-void registerNotifyCallback(const String& notifyID, std::function<void()> callback);
+void registerNotifyCallback(const String& notifyID, WTF::Function<void()>&& callback);
#endif
#endif // !LOG_DISABLED || !RELEASE_LOG_DISABLED
Modified: trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/MainThreadSharedTimer.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -40,7 +40,7 @@
}
#endif
-void MainThreadSharedTimer::setFiredFunction(std::function<void()>&& firedFunction)
+void MainThreadSharedTimer::setFiredFunction(WTF::Function<void()>&& firedFunction)
{
RELEASE_ASSERT(!m_firedFunction || !firedFunction);
m_firedFunction = WTFMove(firedFunction);
Modified: trunk/Source/WebCore/platform/MainThreadSharedTimer.h (218614 => 218615)
--- trunk/Source/WebCore/platform/MainThreadSharedTimer.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/MainThreadSharedTimer.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -41,7 +41,7 @@
public:
static MainThreadSharedTimer& singleton();
- void setFiredFunction(std::function<void()>&&) override;
+ void setFiredFunction(WTF::Function<void()>&&) override;
void setFireInterval(Seconds) override;
void stop() override;
void invalidate() override;
@@ -53,7 +53,7 @@
private:
MainThreadSharedTimer();
- std::function<void()> m_firedFunction;
+ WTF::Function<void()> m_firedFunction;
#if PLATFORM(GTK) || PLATFORM(WPE)
RunLoop::Timer<MainThreadSharedTimer> m_timer;
#endif
Modified: trunk/Source/WebCore/platform/PlatformPasteboard.h (218614 => 218615)
--- trunk/Source/WebCore/platform/PlatformPasteboard.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/PlatformPasteboard.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -26,8 +26,8 @@
#ifndef PlatformPasteboard_h
#define PlatformPasteboard_h
-#include <functional>
#include <wtf/Forward.h>
+#include <wtf/Function.h>
#include <wtf/RefCounted.h>
#include <wtf/RetainPtr.h>
#include <wtf/Vector.h>
@@ -93,7 +93,7 @@
WEBCORE_EXPORT int numberOfFiles();
#if PLATFORM(GTK)
- WEBCORE_EXPORT void writeToClipboard(const SelectionData&, std::function<void()>&& primarySelectionCleared);
+ WEBCORE_EXPORT void writeToClipboard(const SelectionData&, WTF::Function<void()>&& primarySelectionCleared);
WEBCORE_EXPORT Ref<SelectionData> readFromClipboard();
#endif
Modified: trunk/Source/WebCore/platform/ScopeGuard.h (218614 => 218615)
--- trunk/Source/WebCore/platform/ScopeGuard.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/ScopeGuard.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -25,7 +25,7 @@
#ifndef ScopeGuard_h
#define ScopeGuard_h
-#include <functional>
+#include <wtf/Function.h>
namespace WebCore {
@@ -35,7 +35,7 @@
{
}
- ScopeGuard(std::function<void()> function)
+ ScopeGuard(WTF::Function<void()>&& function)
: m_function(WTFMove(function))
{
}
@@ -46,7 +46,7 @@
m_function();
}
- void enable(std::function<void()> function)
+ void enable(WTF::Function<void()>&& function)
{
m_function = WTFMove(function);
}
@@ -57,7 +57,7 @@
}
private:
- std::function<void()> m_function { nullptr };
+ WTF::Function<void()> m_function;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -40,7 +40,7 @@
static const Seconds tickTime = 1_s / frameRate;
static const Seconds minimumTimerInterval { 1_ms };
-ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollableArea& scrollableArea, const FloatPoint& position, std::function<void (FloatPoint&&)>&& notifyPositionChangedFunction)
+ScrollAnimationSmooth::ScrollAnimationSmooth(ScrollableArea& scrollableArea, const FloatPoint& position, WTF::Function<void (FloatPoint&&)>&& notifyPositionChangedFunction)
: ScrollAnimation(scrollableArea)
, m_notifyPositionChangedFunction(WTFMove(notifyPositionChangedFunction))
, m_horizontalData(position.x(), scrollableArea.visibleWidth())
Modified: trunk/Source/WebCore/platform/ScrollAnimationSmooth.h (218614 => 218615)
--- trunk/Source/WebCore/platform/ScrollAnimationSmooth.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/ScrollAnimationSmooth.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -38,7 +38,7 @@
class ScrollAnimationSmooth final: public ScrollAnimation {
public:
- ScrollAnimationSmooth(ScrollableArea&, const FloatPoint&, std::function<void (FloatPoint&&)>&& notifyPositionChangedFunction);
+ ScrollAnimationSmooth(ScrollableArea&, const FloatPoint&, WTF::Function<void (FloatPoint&&)>&& notifyPositionChangedFunction);
virtual ~ScrollAnimationSmooth();
enum class Curve {
@@ -97,7 +97,7 @@
void animationTimerFired();
bool animationTimerActive() const;
- std::function<void (FloatPoint&&)> m_notifyPositionChangedFunction;
+ WTF::Function<void (FloatPoint&&)> m_notifyPositionChangedFunction;
PerAxisData m_horizontalData;
PerAxisData m_verticalData;
Modified: trunk/Source/WebCore/platform/SharedTimer.h (218614 => 218615)
--- trunk/Source/WebCore/platform/SharedTimer.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/SharedTimer.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -26,8 +26,8 @@
#ifndef SharedTimer_h
#define SharedTimer_h
-#include <functional>
#include <wtf/FastMalloc.h>
+#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
#include <wtf/Seconds.h>
@@ -41,7 +41,7 @@
public:
SharedTimer() = default;
virtual ~SharedTimer() { }
- virtual void setFiredFunction(std::function<void()>&&) = 0;
+ virtual void setFiredFunction(WTF::Function<void()>&&) = 0;
// The fire interval is in seconds relative to the current monotonic clock time.
virtual void setFireInterval(Seconds) = 0;
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -277,7 +277,7 @@
return m_sessions[0];
}
-Vector<PlatformMediaSession*> PlatformMediaSessionManager::currentSessionsMatching(std::function<bool(const PlatformMediaSession &)> filter)
+Vector<PlatformMediaSession*> PlatformMediaSessionManager::currentSessionsMatching(const WTF::Function<bool(const PlatformMediaSession&)>& filter)
{
Vector<PlatformMediaSession*> matchingSessions;
forEachSession([&] (PlatformMediaSession& session, size_t) {
Modified: trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h (218614 => 218615)
--- trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/audio/PlatformMediaSessionManager.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -105,7 +105,7 @@
void setCurrentSession(PlatformMediaSession&);
PlatformMediaSession* currentSession() const;
- Vector<PlatformMediaSession*> currentSessionsMatching(std::function<bool(const PlatformMediaSession&)>);
+ Vector<PlatformMediaSession*> currentSessionsMatching(const WTF::Function<bool(const PlatformMediaSession&)>&);
void sessionIsPlayingToWirelessPlaybackTargetChanged(PlatformMediaSession&);
void sessionCanProduceAudioChanged(PlatformMediaSession&);
Modified: trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/cf/MainThreadSharedTimerCF.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -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) {
Modified: trunk/Source/WebCore/platform/cf/RunLoopObserver.h (218614 => 218615)
--- trunk/Source/WebCore/platform/cf/RunLoopObserver.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/cf/RunLoopObserver.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -27,7 +27,7 @@
#define RunLoopObserver_h
#include <CoreFoundation/CoreFoundation.h>
-#include <functional>
+#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
#include <wtf/RetainPtr.h>
@@ -36,11 +36,11 @@
class RunLoopObserver {
WTF_MAKE_NONCOPYABLE(RunLoopObserver); WTF_MAKE_FAST_ALLOCATED;
public:
- typedef std::function<void ()> RunLoopObserverCallback;
+ typedef WTF::Function<void ()> RunLoopObserverCallback;
- RunLoopObserver(CFIndex order, RunLoopObserverCallback callback)
+ RunLoopObserver(CFIndex order, RunLoopObserverCallback&& callback)
: m_order(order)
- , m_callback(callback)
+ , m_callback(WTFMove(callback))
{ }
WEBCORE_EXPORT ~RunLoopObserver();
Modified: trunk/Source/WebCore/platform/graphics/GraphicsContext.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/GraphicsContext.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -34,6 +34,7 @@
#include "Image.h"
#include "ImageOrientation.h"
#include "Pattern.h"
+#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
#if USE(CG)
@@ -599,8 +600,8 @@
#if USE(DIRECT2D)
void platformInit(HDC, ID2D1RenderTarget**, RECT, bool hasAlpha = false);
- void drawWithoutShadow(const FloatRect& boundingRect, const std::function<void(ID2D1RenderTarget*)>&);
- void drawWithShadow(const FloatRect& boundingRect, const std::function<void(ID2D1RenderTarget*)>&);
+ void drawWithoutShadow(const FloatRect& boundingRect, const WTF::Function<void(ID2D1RenderTarget*)>&);
+ void drawWithShadow(const FloatRect& boundingRect, const WTF::Function<void(ID2D1RenderTarget*)>&);
#endif
void savePlatformState();
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -672,7 +672,7 @@
}
}
-void GraphicsLayer::traverse(GraphicsLayer& layer, std::function<void (GraphicsLayer&)> traversalFunc)
+void GraphicsLayer::traverse(GraphicsLayer& layer, const WTF::Function<void (GraphicsLayer&)>& traversalFunc)
{
traversalFunc(layer);
Modified: trunk/Source/WebCore/platform/graphics/GraphicsLayer.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/GraphicsLayer.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -37,6 +37,7 @@
#include "PlatformLayer.h"
#include "TransformOperations.h"
#include "WindRule.h"
+#include <wtf/Function.h>
#include <wtf/TypeCasts.h>
#if ENABLE(CSS_COMPOSITING)
@@ -570,7 +571,7 @@
virtual bool isGraphicsLayerTextureMapper() const { return false; }
virtual bool isCoordinatedGraphicsLayer() const { return false; }
- static void traverse(GraphicsLayer&, std::function<void (GraphicsLayer&)>);
+ static void traverse(GraphicsLayer&, const WTF::Function<void (GraphicsLayer&)>&);
protected:
WEBCORE_EXPORT explicit GraphicsLayer(Type, GraphicsLayerClient&);
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -188,7 +188,7 @@
MediaEngineSupportsKeySystem supportsKeySystem;
};
-static void addMediaEngine(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineOriginsInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForOrigins, MediaEngineSupportsKeySystem);
+static void addMediaEngine(CreateMediaEnginePlayer&&, MediaEngineSupportedTypes, MediaEngineSupportsType, MediaEngineOriginsInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForOrigins, MediaEngineSupportsKeySystem);
static Lock& mediaEngineVectorLock()
{
@@ -269,7 +269,7 @@
return mutableInstalledMediaEnginesVector();
}
-static void addMediaEngine(CreateMediaEnginePlayer constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsType,
+static void addMediaEngine(CreateMediaEnginePlayer&& constructor, MediaEngineSupportedTypes getSupportedTypes, MediaEngineSupportsType supportsType,
MediaEngineOriginsInMediaCache originsInMediaCache, MediaEngineClearMediaCache clearMediaCache, MediaEngineClearMediaCacheForOrigins clearMediaCacheForOrigins, MediaEngineSupportsKeySystem supportsKeySystem)
{
ASSERT(constructor);
@@ -276,7 +276,7 @@
ASSERT(getSupportedTypes);
ASSERT(supportsType);
- mutableInstalledMediaEnginesVector().append(MediaPlayerFactory { constructor, getSupportedTypes, supportsType, originsInMediaCache, clearMediaCache, clearMediaCacheForOrigins, supportsKeySystem });
+ mutableInstalledMediaEnginesVector().append(MediaPlayerFactory { WTFMove(constructor), getSupportedTypes, supportsType, originsInMediaCache, clearMediaCache, clearMediaCacheForOrigins, supportsKeySystem });
}
static const AtomicString& applicationOctetStream()
Modified: trunk/Source/WebCore/platform/graphics/MediaPlayer.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/MediaPlayer.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -628,7 +628,7 @@
#endif
};
-typedef std::function<std::unique_ptr<MediaPlayerPrivateInterface> (MediaPlayer*)> CreateMediaEnginePlayer;
+using CreateMediaEnginePlayer = WTF::Function<std::unique_ptr<MediaPlayerPrivateInterface> (MediaPlayer*)>;
typedef void (*MediaEngineSupportedTypes)(HashSet<String, ASCIICaseInsensitiveHash>& types);
typedef MediaPlayer::SupportsType (*MediaEngineSupportsType)(const MediaEngineSupportParameters& parameters);
typedef HashSet<RefPtr<SecurityOrigin>> (*MediaEngineOriginsInMediaCache)(const String& path);
@@ -636,7 +636,7 @@
typedef void (*MediaEngineClearMediaCacheForOrigins)(const String& path, const HashSet<RefPtr<SecurityOrigin>>&);
typedef bool (*MediaEngineSupportsKeySystem)(const String& keySystem, const String& mimeType);
-typedef void (*MediaEngineRegistrar)(CreateMediaEnginePlayer, MediaEngineSupportedTypes, MediaEngineSupportsType,
+typedef void (*MediaEngineRegistrar)(CreateMediaEnginePlayer&&, MediaEngineSupportedTypes, MediaEngineSupportsType,
MediaEngineOriginsInMediaCache, MediaEngineClearMediaCache, MediaEngineClearMediaCacheForOrigins, MediaEngineSupportsKeySystem);
typedef void (*MediaEngineRegister)(MediaEngineRegistrar);
Modified: trunk/Source/WebCore/platform/graphics/Path.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/Path.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/Path.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -30,8 +30,8 @@
#include "FloatRect.h"
#include "WindRule.h"
-#include <functional>
#include <wtf/FastMalloc.h>
+#include <wtf/Function.h>
#include <wtf/Forward.h>
#include <wtf/Vector.h>
@@ -101,7 +101,7 @@
FloatPoint* points;
};
- typedef std::function<void (const PathElement&)> PathApplierFunction;
+ using PathApplierFunction = WTF::Function<void (const PathElement&)>;
class Path {
WTF_MAKE_FAST_ALLOCATED;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -659,7 +659,7 @@
m_seeking = false;
- std::function<void()> pendingSeek;
+ WTF::Function<void()> pendingSeek;
std::swap(pendingSeek, m_pendingSeek);
if (pendingSeek) {
@@ -790,9 +790,10 @@
#endif // !LOG_DISABLED
-void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification notification)
+void MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(Notification&& notification)
{
- if (notification.type() != Notification::FunctionType)
+ auto notificationType = notification.type();
+ if (notificationType != Notification::FunctionType)
LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - notification %s", this, notificationName(notification));
m_queueMutex.lock();
@@ -799,7 +800,7 @@
// It is important to always process the properties in the order that we are notified,
// so always go through the queue because notifications happen on different threads.
- m_queuedNotifications.append(notification);
+ m_queuedNotifications.append(WTFMove(notification));
#if OS(WINDOWS)
bool delayDispatch = true;
@@ -820,7 +821,7 @@
m_queueMutex.unlock();
if (delayDispatch) {
- if (notification.type() != Notification::FunctionType)
+ if (notificationType != Notification::FunctionType)
LOG(Media, "MediaPlayerPrivateAVFoundation::scheduleMainThreadNotification(%p) - early return", this);
return;
}
@@ -832,7 +833,7 @@
{
ASSERT(isMainThread());
- Notification notification = Notification();
+ Notification notification;
{
LockHolder lock(m_queueMutex);
@@ -841,8 +842,7 @@
if (!m_delayCallbacks) {
// Only dispatch one notification callback per invocation because they can cause recursion.
- notification = m_queuedNotifications.first();
- m_queuedNotifications.remove(0);
+ notification = m_queuedNotifications.takeFirst();
}
if (!m_queuedNotifications.isEmpty() && !m_mainThreadCallPending) {
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/MediaPlayerPrivateAVFoundation.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -32,7 +32,8 @@
#include "InbandTextTrackPrivateAVF.h"
#include "MediaPlayerPrivate.h"
#include "Timer.h"
-#include <functional>
+#include <wtf/Deque.h>
+#include <wtf/Function.h>
#include <wtf/HashSet.h>
#include <wtf/Lock.h>
#include <wtf/RetainPtr.h>
@@ -113,10 +114,10 @@
{
}
- Notification(std::function<void ()> function)
+ Notification(WTF::Function<void ()>&& function)
: m_type(FunctionType)
, m_finished(false)
- , m_function(function)
+ , m_function(WTFMove(function))
{
}
@@ -124,16 +125,16 @@
bool isValid() { return m_type != None; }
MediaTime time() { return m_time; }
bool finished() { return m_finished; }
- std::function<void ()>& function() { return m_function; }
+ WTF::Function<void ()>& function() { return m_function; }
private:
Type m_type;
MediaTime m_time;
bool m_finished;
- std::function<void ()> m_function;
+ WTF::Function<void ()> m_function;
};
- void scheduleMainThreadNotification(Notification);
+ void scheduleMainThreadNotification(Notification&&);
void scheduleMainThreadNotification(Notification::Type, const MediaTime& = MediaTime::zeroTime());
void scheduleMainThreadNotification(Notification::Type, bool completed);
void dispatchNotification();
@@ -317,9 +318,9 @@
WeakPtrFactory<MediaPlayerPrivateAVFoundation> m_weakPtrFactory;
- std::function<void()> m_pendingSeek;
+ WTF::Function<void()> m_pendingSeek;
- Vector<Notification> m_queuedNotifications;
+ Deque<Notification> m_queuedNotifications;
mutable Lock m_queueMutex;
mutable std::unique_ptr<PlatformTimeRanges> m_cachedLoadedTimeRanges;
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateAVFoundationObjC.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -3375,7 +3375,7 @@
}
#endif
- std::function<void ()> function;
+ WTF::Function<void ()> function;
if (context == MediaPlayerAVFoundationObservationContextAVPlayerLayer) {
if ([keyPath isEqualToString:@"readyForDisplay"])
@@ -3450,7 +3450,7 @@
return;
auto weakThis = m_callback->createWeakPtr();
- m_callback->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification([weakThis, function]{
+ m_callback->scheduleMainThreadNotification(MediaPlayerPrivateAVFoundation::Notification([weakThis, function = WTFMove(function)]{
// weakThis and function both refer to the same MediaPlayerPrivateAVFoundationObjC instance. If the WeakPtr has
// been cleared, the underlying object has been destroyed, and it is unsafe to call function().
if (!weakThis)
Modified: trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -41,6 +41,7 @@
#import <QuartzCore/CALayer.h>
#import <QuartzCore/CATransaction.h>
#import <objc_runtime.h>
+#import <wtf/Function.h>
#import <wtf/MainThread.h>
#import <wtf/NeverDestroyed.h>
@@ -325,7 +326,7 @@
return m_videoTransform;
}
-static void runWithoutAnimations(std::function<void()> function)
+static void runWithoutAnimations(const WTF::Function<void()>& function)
{
[CATransaction begin];
[CATransaction setAnimationDuration:0];
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -96,7 +96,7 @@
#if PLATFORM(IOS)
WEBCORE_EXPORT static bool allowConversionFromFormatToFormat(Format, Format);
- WEBCORE_EXPORT static void convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format, std::function<void(std::unique_ptr<WebCore::IOSurface>)>);
+ WEBCORE_EXPORT static void convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format, WTF::Function<void(std::unique_ptr<WebCore::IOSurface>)>&&);
#endif
private:
Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -380,7 +380,7 @@
return true;
}
-void WebCore::IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, std::function<void(std::unique_ptr<WebCore::IOSurface>)> callback)
+void WebCore::IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, WTF::Function<void(std::unique_ptr<WebCore::IOSurface>)>&& callback)
{
static IOSurfaceAcceleratorRef accelerator;
if (!accelerator) {
@@ -403,10 +403,10 @@
IOSurfaceRef destinationIOSurfaceRef = destinationSurface->surface();
IOSurfaceAcceleratorCompletion completion;
- completion.completionRefCon = new std::function<void(std::unique_ptr<WebCore::IOSurface>)> (WTFMove(callback));
+ completion.completionRefCon = new WTF::Function<void(std::unique_ptr<WebCore::IOSurface>)> (WTFMove(callback));
completion.completionRefCon2 = destinationSurface.release();
completion.completionCallback = [](void *completionRefCon, IOReturn, void * completionRefCon2) {
- auto* callback = static_cast<std::function<void(std::unique_ptr<WebCore::IOSurface>)>*>(completionRefCon);
+ auto* callback = static_cast<WTF::Function<void(std::unique_ptr<WebCore::IOSurface>)>*>(completionRefCon);
auto destinationSurface = std::unique_ptr<WebCore::IOSurface>(static_cast<WebCore::IOSurface*>(completionRefCon2));
(*callback)(WTFMove(destinationSurface));
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MainThreadNotifier.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -36,7 +36,7 @@
}
template<typename F>
- void notify(T notificationType, const F& callbackFunctor)
+ void notify(T notificationType, F&& callbackFunctor)
{
ASSERT(m_isValid.load());
if (isMainThread()) {
@@ -48,7 +48,7 @@
if (!addPendingNotification(notificationType))
return;
- RunLoop::main().dispatch([this, protectedThis = makeRef(*this), notificationType, callback = std::function<void()>(callbackFunctor)] {
+ RunLoop::main().dispatch([this, protectedThis = makeRef(*this), notificationType, callback = WTF::Function<void()>(WTFMove(callbackFunctor))] {
if (!m_isValid.load())
return;
if (removePendingNotification(notificationType))
Modified: trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/gstreamer/MediaPlayerRequestInstallMissingPluginsCallback.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -21,6 +21,7 @@
#define MediaPlayerRequestInstallMissingPluginsCallback_h
#if ENABLE(VIDEO) && USE(GSTREAMER)
+#include <wtf/Function.h>
#include <wtf/RefCounted.h>
namespace WebCore {
@@ -28,7 +29,7 @@
class MediaPlayerRequestInstallMissingPluginsCallback : public RefCounted<MediaPlayerRequestInstallMissingPluginsCallback> {
WTF_MAKE_FAST_ALLOCATED();
public:
- static Ref<MediaPlayerRequestInstallMissingPluginsCallback> create(std::function<void (uint32_t)>&& function)
+ static Ref<MediaPlayerRequestInstallMissingPluginsCallback> create(WTF::Function<void (uint32_t)>&& function)
{
return adoptRef(*new MediaPlayerRequestInstallMissingPluginsCallback(WTFMove(function)));
}
@@ -47,12 +48,12 @@
}
private:
- MediaPlayerRequestInstallMissingPluginsCallback(std::function<void (uint32_t)>&& function)
+ MediaPlayerRequestInstallMissingPluginsCallback(WTF::Function<void (uint32_t)>&& function)
: m_function(WTFMove(function))
{
}
- std::function<void (uint32_t)> m_function;
+ WTF::Function<void (uint32_t)> m_function;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/graphics/win/GraphicsContextDirect2D.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -935,7 +935,7 @@
flush();
}
-void GraphicsContext::drawWithoutShadow(const FloatRect& /*boundingRect*/, const std::function<void(ID2D1RenderTarget*)>& drawCommands)
+void GraphicsContext::drawWithoutShadow(const FloatRect& /*boundingRect*/, const WTF::Function<void(ID2D1RenderTarget*)>& drawCommands)
{
drawCommands(platformContext());
}
@@ -981,7 +981,7 @@
deviceContext->DrawImage(compositor.get(), D2D1_INTERPOLATION_MODE_LINEAR);
}
-void GraphicsContext::drawWithShadow(const FloatRect& boundingRect, const std::function<void(ID2D1RenderTarget*)>& drawCommands)
+void GraphicsContext::drawWithShadow(const FloatRect& boundingRect, const WTF::Function<void(ID2D1RenderTarget*)>& drawCommands)
{
auto context = platformContext();
Modified: trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/gtk/PasteboardHelper.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -265,7 +265,7 @@
static SelectionData* settingClipboardSelection;
struct ClipboardSetData {
- ClipboardSetData(SelectionData& selection, std::function<void()>&& selectionClearedCallback)
+ ClipboardSetData(SelectionData& selection, WTF::Function<void()>&& selectionClearedCallback)
: selectionData(selection)
, selectionClearedCallback(WTFMove(selectionClearedCallback))
{
@@ -276,7 +276,7 @@
}
Ref<SelectionData> selectionData;
- std::function<void()> selectionClearedCallback;
+ WTF::Function<void()> selectionClearedCallback;
};
static void getClipboardContentsCallback(GtkClipboard*, GtkSelectionData *selectionData, guint info, gpointer userData)
@@ -292,7 +292,7 @@
data->selectionClearedCallback();
}
-void PasteboardHelper::writeClipboardContents(GtkClipboard* clipboard, const SelectionData& selection, std::function<void()>&& primarySelectionCleared)
+void PasteboardHelper::writeClipboardContents(GtkClipboard* clipboard, const SelectionData& selection, WTF::Function<void()>&& primarySelectionCleared)
{
GRefPtr<GtkTargetList> list = targetListForSelectionData(selection);
Modified: trunk/Source/WebCore/platform/gtk/PasteboardHelper.h (218614 => 218615)
--- trunk/Source/WebCore/platform/gtk/PasteboardHelper.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/gtk/PasteboardHelper.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -26,7 +26,7 @@
#define PasteboardHelper_h
#include "GRefPtrGtk.h"
-#include <functional>
+#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
#include <wtf/glib/GRefPtr.h>
@@ -47,7 +47,7 @@
void fillSelectionData(const SelectionData&, unsigned, GtkSelectionData*);
void fillSelectionData(GtkSelectionData*, unsigned, SelectionData&);
Vector<GdkAtom> dropAtomsForContext(GtkWidget*, GdkDragContext*);
- void writeClipboardContents(GtkClipboard*, const SelectionData&, std::function<void()>&& primarySelectionCleared = nullptr);
+ void writeClipboardContents(GtkClipboard*, const SelectionData&, WTF::Function<void()>&& primarySelectionCleared = nullptr);
void getClipboardContents(GtkClipboard*, SelectionData&);
enum PasteboardTargetType { TargetTypeMarkup, TargetTypeText, TargetTypeImage, TargetTypeURIList, TargetTypeNetscapeURL, TargetTypeSmartPaste, TargetTypeUnknown };
Modified: trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/gtk/PlatformPasteboardGtk.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -34,7 +34,7 @@
ASSERT(m_clipboard);
}
-void PlatformPasteboard::writeToClipboard(const SelectionData& selection, std::function<void()>&& primarySelectionCleared)
+void PlatformPasteboard::writeToClipboard(const SelectionData& selection, WTF::Function<void()>&& primarySelectionCleared)
{
PasteboardHelper::singleton().writeClipboardContents(m_clipboard, selection, gtk_clipboard_get(GDK_SELECTION_PRIMARY) == m_clipboard ? WTFMove(primarySelectionCleared) : nullptr);
}
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h (218614 => 218615)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -34,8 +34,8 @@
#include "PlatformLayer.h"
#include "WebPlaybackSessionInterfaceAVKit.h"
#include "WebVideoFullscreenModel.h"
-#include <functional>
#include <objc/objc.h>
+#include <wtf/Function.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/RetainPtr.h>
@@ -101,7 +101,7 @@
HTMLMediaElementEnums::VideoFullscreenMode mode() const { return m_mode; }
bool allowsPictureInPicturePlayback() const { return m_allowsPictureInPicturePlayback; }
WEBCORE_EXPORT bool mayAutomaticallyShowVideoPictureInPicture() const;
- void fullscreenMayReturnToInline(std::function<void(bool)> callback);
+ void fullscreenMayReturnToInline(WTF::Function<void(bool)>&& callback);
bool wirelessVideoPlaybackDisabled() const;
void applicationDidBecomeActive();
@@ -138,7 +138,7 @@
RetainPtr<UIWindow> m_parentWindow;
RetainPtr<WebAVPlayerLayerView> m_playerLayerView;
HTMLMediaElementEnums::VideoFullscreenMode m_mode { HTMLMediaElementEnums::VideoFullscreenModeNone };
- std::function<void(bool)> m_prepareToInlineCallback;
+ WTF::Function<void(bool)> m_prepareToInlineCallback;
RunLoop::Timer<WebVideoFullscreenInterfaceAVKit> m_watchdogTimer;
bool m_allowsPictureInPicturePlayback { false };
bool m_exitRequested { false };
Modified: trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/ios/WebVideoFullscreenInterfaceAVKit.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -844,7 +844,7 @@
[m_playerViewController view].frame = [m_parentView convertRect:inlineRect toView:[m_playerViewController view].superview];
- std::function<void(bool)> callback = WTFMove(m_prepareToInlineCallback);
+ WTF::Function<void(bool)> callback = WTFMove(m_prepareToInlineCallback);
callback(visible);
}
}
@@ -854,9 +854,9 @@
return [playerController() isPlaying] && m_mode == HTMLMediaElementEnums::VideoFullscreenModeStandard && supportsPictureInPicture();
}
-void WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline(std::function<void(bool)> callback)
+void WebVideoFullscreenInterfaceAVKit::fullscreenMayReturnToInline(WTF::Function<void(bool)>&& callback)
{
- m_prepareToInlineCallback = callback;
+ m_prepareToInlineCallback = WTFMove(callback);
if (m_fullscreenChangeObserver)
m_fullscreenChangeObserver->fullscreenMayReturnToInline();
}
Modified: trunk/Source/WebCore/platform/mac/PowerObserverMac.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/mac/PowerObserverMac.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -30,8 +30,8 @@
namespace WebCore {
-PowerObserver::PowerObserver(const std::function<void()>& powerOnHander)
- : m_powerOnHander(powerOnHander)
+PowerObserver::PowerObserver(WTF::Function<void()>&& powerOnHander)
+ : m_powerOnHander(WTFMove(powerOnHander))
, m_powerConnection(0)
, m_notificationPort(nullptr)
, m_notifierReference(0)
Modified: trunk/Source/WebCore/platform/mac/PowerObserverMac.h (218614 => 218615)
--- trunk/Source/WebCore/platform/mac/PowerObserverMac.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mac/PowerObserverMac.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -28,7 +28,7 @@
#import <IOKit/IOMessage.h>
#import <IOKit/pwr_mgt/IOPMLib.h>
-#import <functional>
+#import <wtf/Function.h>
#import <wtf/Noncopyable.h>
namespace WebCore {
@@ -37,13 +37,13 @@
WTF_MAKE_NONCOPYABLE(PowerObserver); WTF_MAKE_FAST_ALLOCATED;
public:
- PowerObserver(const std::function<void()>& powerOnHander);
+ PowerObserver(WTF::Function<void()>&& powerOnHander);
~PowerObserver();
private:
void didReceiveSystemPowerNotification(io_service_t, uint32_t messageType, void* messageArgument);
- std::function<void()> m_powerOnHander;
+ WTF::Function<void()> m_powerOnHander;
io_connect_t m_powerConnection;
IONotificationPortRef m_notificationPort;
io_object_t m_notifierReference;
Modified: trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mac/WebCoreNSURLExtras.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -32,7 +32,7 @@
#import "WebCoreNSStringExtras.h"
#import "WebCoreNSURLExtras.h"
#import "WebCoreSystemInterface.h"
-#import <functional>
+#import <wtf/Function.h>
#import <wtf/HexNumber.h>
#import <wtf/ObjcRuntimeExtras.h>
#import <wtf/RetainPtr.h>
@@ -271,7 +271,7 @@
return YES;
}
-static bool isSecondLevelDomainNameAllowedByTLDRules(const UChar* buffer, int32_t length, const std::function<bool(UChar)>& characterIsAllowed)
+static bool isSecondLevelDomainNameAllowedByTLDRules(const UChar* buffer, int32_t length, const WTF::Function<bool(UChar)>& characterIsAllowed)
{
ASSERT(length > 0);
@@ -294,7 +294,7 @@
{ \
static const int32_t suffixLength = sizeof(suffix) / sizeof(suffix[0]); \
if (length > suffixLength && 0 == memcmp(buffer + length - suffixLength, suffix, sizeof(suffix))) \
- return isSecondLevelDomainNameAllowedByTLDRules(buffer, length - suffixLength, function); \
+ return isSecondLevelDomainNameAllowedByTLDRules(buffer, length - suffixLength, [](UChar c) { return function(c); }); \
}
static bool isRussianDomainNameCharacter(UChar ch)
Modified: trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -113,7 +113,7 @@
return ++nextToken;
}
-CaptureDeviceManager::ObserverToken CaptureDeviceManager::addCaptureDeviceChangedObserver(CaptureDeviceChangedCallback observer)
+CaptureDeviceManager::ObserverToken CaptureDeviceManager::addCaptureDeviceChangedObserver(CaptureDeviceChangedCallback&& observer)
{
auto token = nextObserverToken();
m_observers.set(token, WTFMove(observer));
Modified: trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h (218614 => 218615)
--- trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mediastream/CaptureDeviceManager.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -34,9 +34,9 @@
class CaptureDeviceManager {
public:
- using CaptureDeviceChangedCallback = std::function<void()>;
+ using CaptureDeviceChangedCallback = WTF::Function<void()>;
using ObserverToken = uint32_t;
- virtual ObserverToken addCaptureDeviceChangedObserver(CaptureDeviceChangedCallback);
+ virtual ObserverToken addCaptureDeviceChangedObserver(CaptureDeviceChangedCallback&&);
virtual void removeCaptureDeviceChangedObserver(ObserverToken);
virtual Vector<CaptureDevice>& captureDevices() = 0;
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -882,7 +882,7 @@
settingsDidChange();
}
-void RealtimeMediaSource::scheduleDeferredTask(std::function<void()>&& function)
+void RealtimeMediaSource::scheduleDeferredTask(WTF::Function<void()>&& function)
{
ASSERT(function);
callOnMainThread([weakThis = createWeakPtr(), function = WTFMove(function)] {
Modified: trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h (218614 => 218615)
--- trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mediastream/RealtimeMediaSource.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -190,8 +190,8 @@
virtual const RealtimeMediaSourceCapabilities& capabilities() const = 0;
virtual const RealtimeMediaSourceSettings& settings() const = 0;
- using SuccessHandler = std::function<void()>;
- using FailureHandler = std::function<void(const String& badConstraint, const String& errorString)>;
+ using SuccessHandler = WTF::Function<void()>;
+ using FailureHandler = WTF::Function<void(const String& badConstraint, const String& errorString)>;
virtual void applyConstraints(const MediaConstraints&, SuccessHandler&&, FailureHandler&&);
std::optional<std::pair<String, String>> applyConstraints(const MediaConstraints&);
@@ -212,7 +212,7 @@
protected:
RealtimeMediaSource(const String& id, Type, const String& name);
- void scheduleDeferredTask(std::function<void()>&&);
+ void scheduleDeferredTask(WTF::Function<void()>&&);
virtual void beginConfiguration() { }
virtual void commitConfiguration() { }
Modified: trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mediastream/ios/AVAudioSessionCaptureDeviceManager.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -40,18 +40,18 @@
void* AvailableInputsContext = &AvailableInputsContext;
@interface WebAVAudioSessionAvailableInputsListener : NSObject {
- std::function<void()> _callback;
+ WTF::Function<void()> _callback;
}
@end
@implementation WebAVAudioSessionAvailableInputsListener
-- (id)initWithCallback:(std::function<void()>)callback
+- (id)initWithCallback:(WTF::Function<void()>&&)callback
{
self = [super init];
if (!self)
return nil;
- _callback = callback;
+ _callback = WTFMove(callback);
return self;
}
Modified: trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h (218614 => 218615)
--- trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mediastream/mac/CoreAudioCaptureSource.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -61,7 +61,7 @@
void addEchoCancellationSource(AudioSampleDataSource&);
void removeEchoCancellationSource(AudioSampleDataSource&);
- using MicrophoneDataCallback = std::function<void(const MediaTime& sampleTime, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t sampleCount)>;
+ using MicrophoneDataCallback = WTF::Function<void(const MediaTime& sampleTime, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t sampleCount)>;
uint64_t addMicrophoneDataConsumer(MicrophoneDataCallback&&);
void removeMicrophoneDataConsumer(uint64_t);
Modified: trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -36,7 +36,7 @@
namespace WebCore {
-ScrollAnimatorMock::ScrollAnimatorMock(ScrollableArea& scrollableArea, std::function<void(const String&)>&& logger)
+ScrollAnimatorMock::ScrollAnimatorMock(ScrollableArea& scrollableArea, WTF::Function<void(const String&)>&& logger)
: ScrollAnimator(scrollableArea)
, m_logger(WTFMove(logger))
{
Modified: trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.h (218614 => 218615)
--- trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/mock/ScrollAnimatorMock.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -40,7 +40,7 @@
// the internal setting enableMockScrollAnimator.
class ScrollAnimatorMock final : public ScrollAnimator {
public:
- ScrollAnimatorMock(ScrollableArea&, std::function<void(const String&)>&&);
+ ScrollAnimatorMock(ScrollableArea&, WTF::Function<void(const String&)>&&);
virtual ~ScrollAnimatorMock();
#if ENABLE(RUBBER_BANDING)
@@ -68,7 +68,7 @@
void mouseExitedScrollbar(Scrollbar*) const override;
void mouseIsDownInScrollbar(Scrollbar*, bool) const override;
- std::function<void(const String&)> m_logger;
+ WTF::Function<void(const String&)> m_logger;
Scrollbar* m_verticalScrollbar { nullptr };
Scrollbar* m_horizontalScrollbar { nullptr };
};
Modified: trunk/Source/WebCore/platform/network/CookieStorage.h (218614 => 218615)
--- trunk/Source/WebCore/platform/network/CookieStorage.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/CookieStorage.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -25,13 +25,13 @@
#pragma once
-#include <functional>
+#include <wtf/Function.h>
namespace WebCore {
class NetworkStorageSession;
-WEBCORE_EXPORT void startObservingCookieChanges(const NetworkStorageSession&, std::function<void ()>&&);
+WEBCORE_EXPORT void startObservingCookieChanges(const NetworkStorageSession&, WTF::Function<void ()>&&);
WEBCORE_EXPORT void stopObservingCookieChanges(const NetworkStorageSession&);
}
Modified: trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/NetworkStateNotifier.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -48,7 +48,7 @@
return networkStateNotifier;
}
-void NetworkStateNotifier::addNetworkStateChangeListener(std::function<void (bool)> listener)
+void NetworkStateNotifier::addNetworkStateChangeListener(WTF::Function<void (bool)>&& listener)
{
ASSERT(listener);
#if PLATFORM(IOS)
Modified: trunk/Source/WebCore/platform/network/NetworkStateNotifier.h (218614 => 218615)
--- trunk/Source/WebCore/platform/network/NetworkStateNotifier.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/NetworkStateNotifier.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -26,8 +26,8 @@
#ifndef NetworkStateNotifier_h
#define NetworkStateNotifier_h
-#include <functional>
#include <wtf/FastMalloc.h>
+#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
@@ -59,7 +59,7 @@
#if PLATFORM(IOS)
~NetworkStateNotifier();
#endif
- void addNetworkStateChangeListener(std::function<void (bool isOnLine)>);
+ void addNetworkStateChangeListener(WTF::Function<void (bool isOnLine)>&&);
bool onLine() const;
@@ -67,7 +67,7 @@
#if !PLATFORM(IOS)
bool m_isOnLine;
#endif
- Vector<std::function<void (bool)>> m_listeners;
+ Vector<WTF::Function<void (bool)>> m_listeners;
void notifyNetworkStateChange() const;
void updateState();
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -50,7 +50,7 @@
globalSessionMap().remove(sessionID);
}
-void NetworkStorageSession::forEach(std::function<void(const WebCore::NetworkStorageSession&)> functor)
+void NetworkStorageSession::forEach(const WTF::Function<void(const WebCore::NetworkStorageSession&)>& functor)
{
functor(defaultStorageSession());
for (auto& storageSession : globalSessionMap().values())
Modified: trunk/Source/WebCore/platform/network/NetworkStorageSession.h (218614 => 218615)
--- trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/NetworkStorageSession.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -27,7 +27,7 @@
#include "CredentialStorage.h"
#include "SessionID.h"
-#include <functional>
+#include <wtf/Function.h>
#include <wtf/HashSet.h>
#include <wtf/text/WTFString.h>
@@ -62,7 +62,7 @@
WEBCORE_EXPORT static void ensurePrivateBrowsingSession(SessionID, const String& identifierBase = String());
WEBCORE_EXPORT static void ensureSession(SessionID, const String& identifierBase = String());
WEBCORE_EXPORT static void destroySession(SessionID);
- WEBCORE_EXPORT static void forEach(std::function<void(const WebCore::NetworkStorageSession&)>);
+ WEBCORE_EXPORT static void forEach(const WTF::Function<void(const WebCore::NetworkStorageSession&)>&);
WEBCORE_EXPORT static void switchToNewTestingSession();
Modified: trunk/Source/WebCore/platform/network/cf/CookieStorageCFNet.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/network/cf/CookieStorageCFNet.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/cf/CookieStorageCFNet.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -27,6 +27,7 @@
#include "CookieStorage.h"
#include "NetworkStorageSession.h"
+#include <wtf/Function.h>
#include <wtf/HashMap.h>
#include <wtf/MainThread.h>
#include <wtf/NeverDestroyed.h>
@@ -43,9 +44,9 @@
#if PLATFORM(WIN)
-static HashMap<CFHTTPCookieStorageRef, std::function<void ()>>& cookieChangeCallbackMap()
+static HashMap<CFHTTPCookieStorageRef, WTF::Function<void ()>>& cookieChangeCallbackMap()
{
- static NeverDestroyed<HashMap<CFHTTPCookieStorageRef, std::function<void ()>>> map;
+ static NeverDestroyed<HashMap<CFHTTPCookieStorageRef, WTF::Function<void ()>>> map;
return map;
}
@@ -52,8 +53,9 @@
static void notifyCookiesChanged(CFHTTPCookieStorageRef cookieStorage, void *)
{
callOnMainThread([cookieStorage] {
- if (auto callback = cookieChangeCallbackMap().get(cookieStorage))
- callback();
+ auto it = cookieChangeCallbackMap().find(cookieStorage);
+ if (it != cookieChangeCallbackMap().end())
+ it->value();
});
}
@@ -68,7 +70,7 @@
return loaderRunLoop();
}
-void startObservingCookieChanges(const NetworkStorageSession& storageSession, std::function<void ()>&& callback)
+void startObservingCookieChanges(const NetworkStorageSession& storageSession, WTF::Function<void ()>&& callback)
{
ASSERT(isMainThread());
Modified: trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/cf/SocketStreamHandleImplCFNet.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -144,7 +144,7 @@
return CFSTR("WebSocket proxy PAC file execution");
}
-static void callOnMainThreadAndWait(std::function<void()> function)
+static void callOnMainThreadAndWait(WTF::Function<void()>&& function)
{
if (isMainThread()) {
function();
@@ -156,7 +156,7 @@
bool isFinished = false;
- callOnMainThread([&] {
+ callOnMainThread([&, function = WTFMove(function)] {
function();
std::lock_guard<Lock> lock(mutex);
Modified: trunk/Source/WebCore/platform/network/mac/CookieStorageMac.mm (218614 => 218615)
--- trunk/Source/WebCore/platform/network/mac/CookieStorageMac.mm 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/mac/CookieStorageMac.mm 2017-06-20 23:42:18 UTC (rev 218615)
@@ -23,19 +23,20 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "config.h"
-#include "CookieStorage.h"
+#import "config.h"
+#import "CookieStorage.h"
#import "WebCoreSystemInterface.h"
+#import <wtf/Function.h>
using namespace WebCore;
@interface WebCookieStorageObjCAdapter : NSObject {
- std::function<void ()> m_cookieChangeCallback;
+ WTF::Function<void ()> m_cookieChangeCallback;
}
-(void)notifyCookiesChangedOnMainThread;
-(void)cookiesChangedNotificationHandler:(NSNotification *)notification;
--(void)startListeningForCookieChangeNotificationsWithCallback:(std::function<void ()>&&)callback;
+-(void)startListeningForCookieChangeNotificationsWithCallback:(WTF::Function<void ()>&&)callback;
-(void)stopListeningForCookieChangeNotifications;
@end
@@ -53,7 +54,7 @@
[self performSelectorOnMainThread:@selector(notifyCookiesChangedOnMainThread) withObject:nil waitUntilDone:FALSE];
}
--(void)startListeningForCookieChangeNotificationsWithCallback:(std::function<void ()>&&)callback
+-(void)startListeningForCookieChangeNotificationsWithCallback:(WTF::Function<void ()>&&)callback
{
ASSERT(!m_cookieChangeCallback);
m_cookieChangeCallback = WTFMove(callback);
@@ -72,7 +73,7 @@
static WebCookieStorageObjCAdapter *cookieStorageAdapter;
-void startObservingCookieChanges(const NetworkStorageSession&, std::function<void ()>&& callback)
+void startObservingCookieChanges(const NetworkStorageSession&, WTF::Function<void ()>&& callback)
{
if (!cookieStorageAdapter)
cookieStorageAdapter = [[WebCookieStorageObjCAdapter alloc] init];
Modified: trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/soup/CookieStorageSoup.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -23,7 +23,7 @@
namespace WebCore {
-void startObservingCookieChanges(const NetworkStorageSession&, std::function<void ()>&&)
+void startObservingCookieChanges(const NetworkStorageSession&, WTF::Function<void ()>&&)
{
ASSERT_NOT_REACHED();
}
Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -293,7 +293,7 @@
gIgnoreTLSErrors = ignoreTLSErrors;
}
-void SoupNetworkSession::checkTLSErrors(SoupRequest* soupRequest, SoupMessage* message, std::function<void (const ResourceError&)>&& completionHandler)
+void SoupNetworkSession::checkTLSErrors(SoupRequest* soupRequest, SoupMessage* message, WTF::Function<void (const ResourceError&)>&& completionHandler)
{
if (gIgnoreTLSErrors) {
completionHandler({ });
Modified: trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h (218614 => 218615)
--- trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/network/soup/SoupNetworkSession.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -26,8 +26,8 @@
#ifndef SoupNetworkSession_h
#define SoupNetworkSession_h
-#include <functional>
#include <glib-object.h>
+#include <wtf/Function.h>
#include <wtf/Noncopyable.h>
#include <wtf/Vector.h>
#include <wtf/glib/GRefPtr.h>
@@ -65,7 +65,7 @@
void setAcceptLanguages(const CString&);
static void setShouldIgnoreTLSErrors(bool);
- static void checkTLSErrors(SoupRequest*, SoupMessage*, std::function<void (const ResourceError&)>&&);
+ static void checkTLSErrors(SoupRequest*, SoupMessage*, WTF::Function<void (const ResourceError&)>&&);
static void allowSpecificHTTPSCertificateForHost(const CertificateInfo&, const String& host);
static void setCustomProtocolRequestType(GType);
Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp (218614 => 218615)
--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -515,19 +515,19 @@
static void destroyCollationFunction(void* arg)
{
- auto f = static_cast<std::function<int(int, const void*, int, const void*)>*>(arg);
+ auto f = static_cast<WTF::Function<int(int, const void*, int, const void*)>*>(arg);
delete f;
}
static int callCollationFunction(void* arg, int aLength, const void* a, int bLength, const void* b)
{
- auto f = static_cast<std::function<int(int, const void*, int, const void*)>*>(arg);
+ auto f = static_cast<WTF::Function<int(int, const void*, int, const void*)>*>(arg);
return (*f)(aLength, a, bLength, b);
}
-void SQLiteDatabase::setCollationFunction(const String& collationName, std::function<int(int, const void*, int, const void*)> collationFunction)
+void SQLiteDatabase::setCollationFunction(const String& collationName, WTF::Function<int(int, const void*, int, const void*)>&& collationFunction)
{
- auto functionObject = new std::function<int(int, const void*, int, const void*)>(collationFunction);
+ auto functionObject = new WTF::Function<int(int, const void*, int, const void*)>(WTFMove(collationFunction));
sqlite3_create_collation_v2(m_db, collationName.utf8().data(), SQLITE_UTF8, functionObject, callCollationFunction, destroyCollationFunction);
}
Modified: trunk/Source/WebCore/platform/sql/SQLiteDatabase.h (218614 => 218615)
--- trunk/Source/WebCore/platform/sql/SQLiteDatabase.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/platform/sql/SQLiteDatabase.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -125,7 +125,7 @@
enum AutoVacuumPragma { AutoVacuumNone = 0, AutoVacuumFull = 1, AutoVacuumIncremental = 2 };
bool turnOnIncrementalAutoVacuum();
- WEBCORE_EXPORT void setCollationFunction(const String& collationName, std::function<int(int, const void*, int, const void*)>);
+ WEBCORE_EXPORT void setCollationFunction(const String& collationName, WTF::Function<int(int, const void*, int, const void*)>&&);
void removeCollationFunction(const String& collationName);
// Set this flag to allow access from multiple threads. Not all multi-threaded accesses are safe!
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (218614 => 218615)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -2089,7 +2089,7 @@
// Returning true stops the traversal.
enum class LayerTraversal { Continue, Stop };
-static LayerTraversal traverseVisibleNonCompositedDescendantLayers(RenderLayer& parent, std::function<LayerTraversal (const RenderLayer&)> layerFunc)
+static LayerTraversal traverseVisibleNonCompositedDescendantLayers(RenderLayer& parent, const WTF::Function<LayerTraversal (const RenderLayer&)>& layerFunc)
{
// FIXME: We shouldn't be called with a stale z-order lists. See bug 85512.
parent.updateLayerListsIfNeeded();
Modified: trunk/Source/WebCore/rendering/RenderListBox.cpp (218614 => 218615)
--- trunk/Source/WebCore/rendering/RenderListBox.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/rendering/RenderListBox.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -286,7 +286,7 @@
return LayoutRect(x, y, contentWidth(), itemHeight());
}
-void RenderListBox::paintItem(PaintInfo& paintInfo, const LayoutPoint& paintOffset, PaintFunction paintFunction)
+void RenderListBox::paintItem(PaintInfo& paintInfo, const LayoutPoint& paintOffset, const PaintFunction& paintFunction)
{
int listItemsSize = numItems();
int firstVisibleItem = m_indexOfFirstVisibleItemInsidePaddingTopArea.value_or(m_indexOffset);
Modified: trunk/Source/WebCore/rendering/RenderListBox.h (218614 => 218615)
--- trunk/Source/WebCore/rendering/RenderListBox.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/rendering/RenderListBox.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -143,8 +143,8 @@
// NOTE: This should only be called by the overriden setScrollOffset from ScrollableArea.
void scrollTo(int newOffset);
- using PaintFunction = std::function<void(PaintInfo&, const LayoutPoint&, int listItemIndex)>;
- void paintItem(PaintInfo&, const LayoutPoint&, PaintFunction);
+ using PaintFunction = WTF::Function<void(PaintInfo&, const LayoutPoint&, int listItemIndex)>;
+ void paintItem(PaintInfo&, const LayoutPoint&, const PaintFunction&);
void setHasVerticalScrollbar(bool hasScrollbar);
Ref<Scrollbar> createScrollbar();
Modified: trunk/Source/WebCore/rendering/SimpleLineLayout.cpp (218614 => 218615)
--- trunk/Source/WebCore/rendering/SimpleLineLayout.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/rendering/SimpleLineLayout.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -254,9 +254,9 @@
#ifndef NDEBUG
static std::once_flag onceFlag;
std::call_once(onceFlag, [] {
- registerNotifyCallback("com.apple.WebKit.showSimpleLineLayoutCoverage", printSimpleLineLayoutCoverage);
- registerNotifyCallback("com.apple.WebKit.showSimpleLineLayoutReasons", printSimpleLineLayoutBlockList);
- registerNotifyCallback("com.apple.WebKit.toggleSimpleLineLayout", toggleSimpleLineLayout);
+ registerNotifyCallback("com.apple.WebKit.showSimpleLineLayoutCoverage", [] { printSimpleLineLayoutCoverage(); });
+ registerNotifyCallback("com.apple.WebKit.showSimpleLineLayoutReasons", [] { printSimpleLineLayoutBlockList(); });
+ registerNotifyCallback("com.apple.WebKit.toggleSimpleLineLayout", [] { toggleSimpleLineLayout(); });
});
#endif
AvoidanceReasonFlags reasons = { };
Modified: trunk/Source/WebCore/rendering/line/BreakingContext.h (218614 => 218615)
--- trunk/Source/WebCore/rendering/line/BreakingContext.h 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/rendering/line/BreakingContext.h 2017-06-20 23:42:18 UTC (rev 218615)
@@ -38,6 +38,7 @@
#include "RenderRubyRun.h"
#include "RenderSVGInlineText.h"
#include "TrailingObjects.h"
+#include <wtf/Function.h>
#include <wtf/Optional.h>
#include <wtf/text/StringView.h>
#include <wtf/unicode/CharacterNames.h>
@@ -191,7 +192,7 @@
this->append(initial);
}
- void push(std::function<void(InlineIterator& modifyMe)> updater)
+ void push(const WTF::Function<void(InlineIterator& modifyMe)>& updater)
{
ASSERT(!this->isEmpty());
if (m_capacity != 1)
@@ -201,7 +202,7 @@
this->resize(m_capacity);
}
- void update(std::function<void(InlineIterator& modifyMe)> updater)
+ void update(const WTF::Function<void(InlineIterator& modifyMe)>& updater)
{
ASSERT(!this->isEmpty());
updater(this->at(0));
Modified: trunk/Source/WebCore/workers/Worker.cpp (218614 => 218615)
--- trunk/Source/WebCore/workers/Worker.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/workers/Worker.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -59,7 +59,7 @@
{
if (!allWorkers) {
allWorkers = new HashSet<Worker*>;
- networkStateNotifier().addNetworkStateChangeListener(networkStateChanged);
+ networkStateNotifier().addNetworkStateChangeListener([] (bool isOnLine) { networkStateChanged(isOnLine); });
}
auto addResult = allWorkers->add(this);
Modified: trunk/Source/WebCore/workers/WorkerRunLoop.cpp (218614 => 218615)
--- trunk/Source/WebCore/workers/WorkerRunLoop.cpp 2017-06-20 23:22:16 UTC (rev 218614)
+++ trunk/Source/WebCore/workers/WorkerRunLoop.cpp 2017-06-20 23:42:18 UTC (rev 218615)
@@ -50,7 +50,7 @@
class WorkerSharedTimer final : public SharedTimer {
public:
// SharedTimer interface.
- void setFiredFunction(std::function<void()>&& function) override { m_sharedTimerFunction = WTFMove(function); }
+ void setFiredFunction(WTF::Function<void()>&& function) override { m_sharedTimerFunction = WTFMove(function); }
void setFireInterval(Seconds interval) override { m_nextFireTime = interval + WallTime::now(); }
void stop() override { m_nextFireTime = WallTime(); }
@@ -59,7 +59,7 @@
void fire() { m_sharedTimerFunction(); }
private:
- std::function<void()> m_sharedTimerFunction;
+ WTF::Function<void()> m_sharedTimerFunction;
WallTime m_nextFireTime;
};