Title: [217954] trunk/Source/WebCore
Revision
217954
Author
[email protected]
Date
2017-06-08 16:05:06 -0700 (Thu, 08 Jun 2017)

Log Message

Update Timer to take a WTF::Function instead of a std::function
https://bugs.webkit.org/show_bug.cgi?id=173113

Reviewed by Brady Eidson.

Update Timer to take a WTF::Function instead of a std::function as we prefer
to use WTF::Function in WebKit.

* platform/GenericTaskQueue.cpp:
(WebCore::TaskDispatcher<Timer>::sharedTimer):
* platform/Timer.h:
(WebCore::Timer::Timer):
(WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (217953 => 217954)


--- trunk/Source/WebCore/ChangeLog	2017-06-08 22:36:46 UTC (rev 217953)
+++ trunk/Source/WebCore/ChangeLog	2017-06-08 23:05:06 UTC (rev 217954)
@@ -1,3 +1,19 @@
+2017-06-08  Chris Dumez  <[email protected]>
+
+        Update Timer to take a WTF::Function instead of a std::function
+        https://bugs.webkit.org/show_bug.cgi?id=173113
+
+        Reviewed by Brady Eidson.
+
+        Update Timer to take a WTF::Function instead of a std::function as we prefer
+        to use WTF::Function in WebKit.
+
+        * platform/GenericTaskQueue.cpp:
+        (WebCore::TaskDispatcher<Timer>::sharedTimer):
+        * platform/Timer.h:
+        (WebCore::Timer::Timer):
+        (WebCore::DeferrableOneShotTimer::DeferrableOneShotTimer):
+
 2017-06-08  Carlos Alberto Lopez Perez  <[email protected]>
 
         [WebRTC] enableMockMediaEndpoint() is only used for the OpenWebRTC backend.

Modified: trunk/Source/WebCore/platform/GenericTaskQueue.cpp (217953 => 217954)


--- trunk/Source/WebCore/platform/GenericTaskQueue.cpp	2017-06-08 22:36:46 UTC (rev 217953)
+++ trunk/Source/WebCore/platform/GenericTaskQueue.cpp	2017-06-08 23:05:06 UTC (rev 217954)
@@ -47,7 +47,7 @@
 Timer& TaskDispatcher<Timer>::sharedTimer()
 {
     ASSERT(isMainThread());
-    static NeverDestroyed<Timer> timer(TaskDispatcher<Timer>::sharedTimerFired);
+    static NeverDestroyed<Timer> timer([] { TaskDispatcher<Timer>::sharedTimerFired(); });
     return timer.get();
 }
 

Modified: trunk/Source/WebCore/platform/Timer.h (217953 => 217954)


--- trunk/Source/WebCore/platform/Timer.h	2017-06-08 22:36:46 UTC (rev 217953)
+++ trunk/Source/WebCore/platform/Timer.h	2017-06-08 23:05:06 UTC (rev 217954)
@@ -25,7 +25,7 @@
 
 #pragma once
 
-#include <functional>
+#include <wtf/Function.h>
 #include <wtf/MonotonicTime.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/Optional.h>
@@ -121,7 +121,7 @@
     {
     }
 
-    Timer(std::function<void ()> function)
+    Timer(WTF::Function<void ()>&& function)
         : m_function(WTFMove(function))
     {
     }
@@ -132,7 +132,7 @@
         m_function();
     }
     
-    std::function<void ()> m_function;
+    WTF::Function<void ()> m_function;
 };
 
 inline bool TimerBase::isActive() const
@@ -154,7 +154,7 @@
     {
     }
 
-    DeferrableOneShotTimer(std::function<void ()> function, Seconds delay)
+    DeferrableOneShotTimer(WTF::Function<void ()>&& function, Seconds delay)
         : m_function(WTFMove(function))
         , m_delay(delay)
         , m_shouldRestartWhenTimerFires(false)
@@ -194,7 +194,7 @@
         m_function();
     }
 
-    std::function<void ()> m_function;
+    WTF::Function<void ()> m_function;
 
     Seconds m_delay;
     bool m_shouldRestartWhenTimerFires;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to