[EFL][WK2] Use std::function in the rest of EFL's WorkQueue implementation
authorjinwoo7.song@samsung.com <jinwoo7.song@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Jan 2014 09:00:33 +0000 (09:00 +0000)
committerjinwoo7.song@samsung.com <jinwoo7.song@samsung.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 22 Jan 2014 09:00:33 +0000 (09:00 +0000)
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: https://svn.webkit.org/repository/webkit/trunk@162511 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit2/ChangeLog
Source/WebKit2/Platform/IPC/unix/ConnectionUnix.cpp
Source/WebKit2/Platform/WorkQueue.h
Source/WebKit2/Platform/efl/DispatchQueueEfl.cpp
Source/WebKit2/Platform/efl/DispatchQueueEfl.h
Source/WebKit2/Platform/efl/WorkQueueEfl.cpp

index 2f7b534..fbdb18e 100644 (file)
@@ -1,3 +1,22 @@
+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
index 6ff82e6..71db744 100644 (file)
@@ -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
index 234b1fb..e322f59 100644 (file)
@@ -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
 
index c11c294..72a83d1 100644 (file)
@@ -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;
index 87a2e98..dcf8e37 100644 (file)
@@ -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;
index c9c27be..fcba63d 100644 (file)
@@ -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)