Unreviewed. Additional build fixes after r162276 and r163304.
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jan 2014 08:28:33 +0000 (08:28 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Jan 2014 08:28:33 +0000 (08:28 +0000)
* Platform/WorkQueue.h:
* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::EventSource::EventSource):
(WorkQueue::dispatchOnSource):
(WorkQueue::dispatch):
(WorkQueue::dispatchAfter):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162307 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Platform/WorkQueue.h
Source/WebKit2/Platform/gtk/WorkQueueGtk.cpp

index 85f6157..a22295c 100644 (file)
@@ -1,3 +1,14 @@
+2014-01-20  Zan Dobersek  <zdobersek@igalia.com>
+
+        Unreviewed. Additional build fixes after r162276 and r163304.
+
+        * Platform/WorkQueue.h:
+        * Platform/gtk/WorkQueueGtk.cpp:
+        (WorkQueue::EventSource::EventSource):
+        (WorkQueue::dispatchOnSource):
+        (WorkQueue::dispatch):
+        (WorkQueue::dispatchAfter):
+
 2014-01-19  Zan Dobersek  <zdobersek@igalia.com>
 
         Unreviewed GTK build fix after r162276.
index 1afc905..0d68736 100644 (file)
@@ -85,7 +85,7 @@ private:
 
     static void startWorkQueueThread(WorkQueue*);
     void workQueueThreadBody();
-    void dispatchOnSource(GSource*, const std::function<void ()>&, GSourceFunc);
+    void dispatchOnSource(GSource*, std::function<void ()>, GSourceFunc);
 
     ThreadIdentifier m_workQueueThread;
     GRefPtr<GMainContext> m_eventContext;
index b6808d2..3aa5e81 100644 (file)
@@ -35,8 +35,8 @@
 // WorkQueue::EventSource
 class WorkQueue::EventSource {
 public:
-    EventSource(const Function<void()>& function, WorkQueue* workQueue)
-        : m_function(function)
+    EventSource(std::function<void()> function, WorkQueue* workQueue)
+        : m_function(std::move(function))
         , m_workQueue(workQueue)
     {
         ASSERT(workQueue);
@@ -204,23 +204,26 @@ void WorkQueue::unregisterSocketEventHandler(int fileDescriptor)
     }
 }
 
-void WorkQueue::dispatchOnSource(GSource* dispatchSource, const std::function<void ()>& function, GSourceFunc sourceCallback)
+void WorkQueue::dispatchOnSource(GSource* dispatchSource, std::function<void ()> function, GSourceFunc sourceCallback)
 {
-    g_source_set_callback(dispatchSource, sourceCallback, new EventSource(function, this),
+    g_source_set_callback(dispatchSource, sourceCallback, new EventSource(std::forward<std::function<void ()>>(function), this),
         reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource));
 
     g_source_attach(dispatchSource, m_eventContext.get());
 }
 
-void WorkQueue::dispatch(const std::function<void ()>& function)
+void WorkQueue::dispatch(std::function<void ()> function)
 {
     GRefPtr<GSource> dispatchSource = adoptGRef(g_idle_source_new());
     g_source_set_priority(dispatchSource.get(), G_PRIORITY_DEFAULT);
-    dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce));
+    dispatchOnSource(dispatchSource.get(), std::forward<std::function<void ()>>(function),
+        reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce));
 }
 
-void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, const std::function<void ()>& function)
+void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, std::function<void ()> function)
 {
-    GRefPtr<GSource> dispatchSource = adoptGRef(g_timeout_source_new(static_cast<guint>(std::chrono::milliseconds(duration).count())));
-    dispatchOnSource(dispatchSource.get(), function, reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce));
+    GRefPtr<GSource> dispatchSource = adoptGRef(g_timeout_source_new(
+        static_cast<guint>(std::chrono::duration_cast<std::chrono::milliseconds>(duration).count())));
+    dispatchOnSource(dispatchSource.get(), std::forward<std::function<void ()>>(function),
+        reinterpret_cast<GSourceFunc>(&WorkQueue::EventSource::performWorkOnce));
 }