[EFL][WK2] Use std::function in the rest of EFL's WorkQueue implementation

https://bugs.webkit.org/show_bug.cgi?id=127397

Reviewed by Anders Carlsson.

Move to using std::function and move semantics in WorkQueue::registerSocketEventHandler
and DispatchQueue::setSocketEventHandler.

* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::open):
* Platform/WorkQueue.h:
* Platform/efl/DispatchQueueEfl.cpp:
(DispatchQueue::setSocketEventHandler):
* Platform/efl/DispatchQueueEfl.h:
* Platform/efl/WorkQueueEfl.cpp:
(WorkQueue::registerSocketEventHandler):


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@162511 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 3de29efe
2014-01-22 Jinwoo Song <jinwoo7.song@samsung.com>
[EFL][WK2] Use std::function in the rest of EFL's WorkQueue implementation
https://bugs.webkit.org/show_bug.cgi?id=127397
Reviewed by Anders Carlsson.
Move to using std::function and move semantics in WorkQueue::registerSocketEventHandler
and DispatchQueue::setSocketEventHandler.
* Platform/IPC/unix/ConnectionUnix.cpp:
(IPC::Connection::open):
* Platform/WorkQueue.h:
* Platform/efl/DispatchQueueEfl.cpp:
(DispatchQueue::setSocketEventHandler):
* Platform/efl/DispatchQueueEfl.h:
* Platform/efl/WorkQueueEfl.cpp:
(WorkQueue::registerSocketEventHandler):
2014-01-21 Tim Horton <timothy_horton@apple.com>
[wk2] De-.get()ify receivers of Objective-C messages
......
......@@ -397,7 +397,11 @@ bool Connection::open()
protector->connectionDidClose();
});
#elif PLATFORM(EFL)
m_connectionQueue->registerSocketEventHandler(m_socketDescriptor, WTF::bind(&Connection::readyReadHandler, this));
RefPtr<Connection> protector(this);
m_connectionQueue->registerSocketEventHandler(m_socketDescriptor,
[protector] {
protector->readyReadHandler();
});
#endif
// Schedule a call to readyReadHandler. Data may have arrived before installation of the signal
......
......@@ -66,7 +66,7 @@ public:
void registerSocketEventHandler(int, std::function<void ()>, std::function<void ()>);
void unregisterSocketEventHandler(int);
#elif PLATFORM(EFL)
void registerSocketEventHandler(int, const Function<void()>&);
void registerSocketEventHandler(int, std::function<void ()>);
void unregisterSocketEventHandler(int);
#endif
......
......@@ -115,12 +115,12 @@ void DispatchQueue::stopThread()
wakeUpThread();
}
void DispatchQueue::setSocketEventHandler(int fileDescriptor, const Function<void()>& function)
void DispatchQueue::setSocketEventHandler(int fileDescriptor, std::function<void ()> function)
{
ASSERT(m_socketDescriptor == invalidSocketDescriptor);
m_socketDescriptor = fileDescriptor;
m_socketEventHandler = function;
m_socketEventHandler = std::move(function);
if (fileDescriptor > m_maxFileDescriptor)
m_maxFileDescriptor = fileDescriptor;
......
......@@ -42,7 +42,7 @@ public:
void dispatch(std::unique_ptr<WorkItem>);
void dispatch(std::unique_ptr<TimerWorkItem>);
void stopThread();
void setSocketEventHandler(int, const Function<void()>&);
void setSocketEventHandler(int, std::function<void ()>);
void clearSocketEventHandler();
private:
......@@ -67,7 +67,7 @@ private:
bool m_isThreadRunning;
int m_socketDescriptor;
Function<void()> m_socketEventHandler;
std::function<void ()> m_socketEventHandler;
Vector<std::unique_ptr<WorkItem>> m_workItems;
Mutex m_workItemsLock;
......
......@@ -34,12 +34,12 @@ void WorkQueue::platformInvalidate()
dispatchQueue->stopThread();
}
void WorkQueue::registerSocketEventHandler(int fileDescriptor, const Function<void()>& function)
void WorkQueue::registerSocketEventHandler(int fileDescriptor, std::function<void ()> function)
{
if (!m_dispatchQueue)
return;
m_dispatchQueue->setSocketEventHandler(fileDescriptor, function);
m_dispatchQueue->setSocketEventHandler(fileDescriptor, std::move(function));
}
void WorkQueue::unregisterSocketEventHandler(int fileDescriptor)
......
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