Commit ed30497c authored by zandobersek@gmail.com's avatar zandobersek@gmail.com
Browse files

Unreviewed GTK build fix after r162276.

Updating the WorkQueue implementation to use std::function and std::chrono.

* Platform/WorkQueue.h:
* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::dispatchOnSource):
(WorkQueue::dispatch):
(WorkQueue::dispatchAfter):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162304 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent bd915d30
2014-01-19 Zan Dobersek <zdobersek@igalia.com>
Unreviewed GTK build fix after r162276.
Updating the WorkQueue implementation to use std::function and std::chrono.
* Platform/WorkQueue.h:
* Platform/gtk/WorkQueueGtk.cpp:
(WorkQueue::dispatchOnSource):
(WorkQueue::dispatch):
(WorkQueue::dispatchAfter):
2014-01-19 Jinwoo Song <jinwoo7.song@samsung.com>
 
Unreviewed debug build fix on EFL port after r162300.
......
......@@ -85,7 +85,7 @@ private:
static void startWorkQueueThread(WorkQueue*);
void workQueueThreadBody();
void dispatchOnSource(GSource*, const Function<void()>&, GSourceFunc);
void dispatchOnSource(GSource*, const std::function<void ()>&, GSourceFunc);
ThreadIdentifier m_workQueueThread;
GRefPtr<GMainContext> m_eventContext;
......
......@@ -63,7 +63,7 @@ public:
}
private:
Function<void()> m_function;
std::function<void ()> m_function;
RefPtr<WorkQueue> m_workQueue;
};
......@@ -204,7 +204,7 @@ void WorkQueue::unregisterSocketEventHandler(int fileDescriptor)
}
}
void WorkQueue::dispatchOnSource(GSource* dispatchSource, const Function<void()>& function, GSourceFunc sourceCallback)
void WorkQueue::dispatchOnSource(GSource* dispatchSource, const std::function<void ()>& function, GSourceFunc sourceCallback)
{
g_source_set_callback(dispatchSource, sourceCallback, new EventSource(function, this),
reinterpret_cast<GDestroyNotify>(&WorkQueue::EventSource::deleteEventSource));
......@@ -212,15 +212,15 @@ void WorkQueue::dispatchOnSource(GSource* dispatchSource, const Function<void()>
g_source_attach(dispatchSource, m_eventContext.get());
}
void WorkQueue::dispatch(const Function<void()>& function)
void WorkQueue::dispatch(const 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));
}
void WorkQueue::dispatchAfterDelay(const Function<void()>& function, double delay)
void WorkQueue::dispatchAfter(std::chrono::nanoseconds duration, const std::function<void ()>& function)
{
GRefPtr<GSource> dispatchSource = adoptGRef(g_timeout_source_new(static_cast<guint>(delay * 1000)));
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));
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment