Title: [201683] trunk/Source/WTF
Revision
201683
Author
[email protected]
Date
2016-06-04 12:26:24 -0700 (Sat, 04 Jun 2016)

Log Message

Get rid of HANDLE registration code in WorkQueueWin
https://bugs.webkit.org/show_bug.cgi?id=158375

Reviewed by Darin Adler.

* wtf/WorkQueue.h:
* wtf/win/WorkItemWin.cpp:
(WTF::HandleWorkItem::HandleWorkItem): Deleted.
(WTF::HandleWorkItem::createByAdoptingHandle): Deleted.
(WTF::HandleWorkItem::~HandleWorkItem): Deleted.
* wtf/win/WorkItemWin.h:
(WTF::HandleWorkItem::setWaitHandle): Deleted.
(WTF::HandleWorkItem::waitHandle): Deleted.
* wtf/win/WorkQueueWin.cpp:
(WTF::WorkQueue::handleCallback): Deleted.
(WTF::WorkQueue::platformInvalidate): Deleted.
(WTF::WorkQueue::unregisterWaitAndDestroyItemSoon): Deleted.
(WTF::WorkQueue::unregisterWaitAndDestroyItemCallback): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (201682 => 201683)


--- trunk/Source/WTF/ChangeLog	2016-06-04 19:11:17 UTC (rev 201682)
+++ trunk/Source/WTF/ChangeLog	2016-06-04 19:26:24 UTC (rev 201683)
@@ -1,3 +1,24 @@
+2016-06-03  Anders Carlsson  <[email protected]>
+
+        Get rid of HANDLE registration code in WorkQueueWin
+        https://bugs.webkit.org/show_bug.cgi?id=158375
+
+        Reviewed by Darin Adler.
+
+        * wtf/WorkQueue.h:
+        * wtf/win/WorkItemWin.cpp:
+        (WTF::HandleWorkItem::HandleWorkItem): Deleted.
+        (WTF::HandleWorkItem::createByAdoptingHandle): Deleted.
+        (WTF::HandleWorkItem::~HandleWorkItem): Deleted.
+        * wtf/win/WorkItemWin.h:
+        (WTF::HandleWorkItem::setWaitHandle): Deleted.
+        (WTF::HandleWorkItem::waitHandle): Deleted.
+        * wtf/win/WorkQueueWin.cpp:
+        (WTF::WorkQueue::handleCallback): Deleted.
+        (WTF::WorkQueue::platformInvalidate): Deleted.
+        (WTF::WorkQueue::unregisterWaitAndDestroyItemSoon): Deleted.
+        (WTF::WorkQueue::unregisterWaitAndDestroyItemCallback): Deleted.
+
 2016-06-03  Commit Queue  <[email protected]>
 
         Unreviewed, rolling out r201663.

Modified: trunk/Source/WTF/wtf/WorkQueue.h (201682 => 201683)


--- trunk/Source/WTF/wtf/WorkQueue.h	2016-06-04 19:11:17 UTC (rev 201682)
+++ trunk/Source/WTF/wtf/WorkQueue.h	2016-06-04 19:26:24 UTC (rev 201683)
@@ -93,16 +93,12 @@
     void platformInvalidate();
 
 #if USE(WINDOWS_EVENT_LOOP)
-    static void CALLBACK handleCallback(void* context, BOOLEAN timerOrWaitFired);
     static void CALLBACK timerCallback(void* context, BOOLEAN timerOrWaitFired);
     static DWORD WINAPI workThreadCallback(void* context);
 
     bool tryRegisterAsWorkThread();
     void unregisterAsWorkThread();
     void performWorkOnRegisteredWorkThread();
-
-    static void unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem>);
-    static DWORD WINAPI unregisterWaitAndDestroyItemCallback(void* context);
 #endif
 
 #if USE(EFL_EVENT_LOOP)
@@ -116,9 +112,6 @@
     Mutex m_workItemQueueLock;
     Vector<RefPtr<WorkItemWin>> m_workItemQueue;
 
-    Mutex m_handlesLock;
-    HashMap<HANDLE, RefPtr<HandleWorkItem>> m_handles;
-
     HANDLE m_timerQueue;
 #elif USE(GLIB_EVENT_LOOP) || USE(GENERIC_EVENT_LOOP)
     ThreadIdentifier m_workQueueThread;

Modified: trunk/Source/WTF/wtf/win/WorkItemWin.cpp (201682 => 201683)


--- trunk/Source/WTF/wtf/win/WorkItemWin.cpp	2016-06-04 19:11:17 UTC (rev 201682)
+++ trunk/Source/WTF/wtf/win/WorkItemWin.cpp	2016-06-04 19:26:24 UTC (rev 201683)
@@ -47,22 +47,4 @@
 {
 }
 
-HandleWorkItem::HandleWorkItem(HANDLE handle, NoncopyableFunction<void ()>&& function, WorkQueue* queue)
-    : WorkItemWin(WTFMove(function), queue)
-    , m_handle(handle)
-    , m_waitHandle(0)
-{
-    ASSERT_ARG(handle, handle);
-}
-
-RefPtr<HandleWorkItem> HandleWorkItem::createByAdoptingHandle(HANDLE handle, NoncopyableFunction<void ()>&& function, WorkQueue* queue)
-{
-    return adoptRef(new HandleWorkItem(handle, WTFMove(function), queue));
-}
-
-HandleWorkItem::~HandleWorkItem()
-{
-    ::CloseHandle(m_handle);
-}
-
 } // namespace WTF

Modified: trunk/Source/WTF/wtf/win/WorkItemWin.h (201682 => 201683)


--- trunk/Source/WTF/wtf/win/WorkItemWin.h	2016-06-04 19:11:17 UTC (rev 201682)
+++ trunk/Source/WTF/wtf/win/WorkItemWin.h	2016-06-04 19:26:24 UTC (rev 201683)
@@ -53,21 +53,6 @@
     RefPtr<WorkQueue> m_queue;
 };
 
-class HandleWorkItem : public WorkItemWin {
-public:
-    static RefPtr<HandleWorkItem> createByAdoptingHandle(HANDLE, NoncopyableFunction<void ()>&&, WorkQueue*);
-    virtual ~HandleWorkItem();
-
-    void setWaitHandle(HANDLE waitHandle) { m_waitHandle = waitHandle; }
-    HANDLE waitHandle() const { return m_waitHandle; }
-
-private:
-    HandleWorkItem(HANDLE, NoncopyableFunction<void ()>&&, WorkQueue*);
-
-    HANDLE m_handle;
-    HANDLE m_waitHandle;
-};
-
 }
 
 #endif

Modified: trunk/Source/WTF/wtf/win/WorkQueueWin.cpp (201682 => 201683)


--- trunk/Source/WTF/wtf/win/WorkQueueWin.cpp	2016-06-04 19:11:17 UTC (rev 201682)
+++ trunk/Source/WTF/wtf/win/WorkQueueWin.cpp	2016-06-04 19:26:24 UTC (rev 201683)
@@ -32,31 +32,6 @@
 
 namespace WTF {
 
-void WorkQueue::handleCallback(void* context, BOOLEAN timerOrWaitFired)
-{
-    ASSERT_ARG(context, context);
-    ASSERT_ARG(timerOrWaitFired, !timerOrWaitFired);
-
-    WorkItemWin* item = static_cast<WorkItemWin*>(context);
-    RefPtr<WorkQueue> queue = item->queue();
-
-    {
-        MutexLocker lock(queue->m_workItemQueueLock);
-        queue->m_workItemQueue.append(item);
-
-        // If no other thread is performing work, we can do it on this thread.
-        if (!queue->tryRegisterAsWorkThread()) {
-            // Some other thread is performing work. Since we hold the queue lock, we can be sure
-            // that the work thread is not exiting due to an empty queue and will process the work
-            // item we just added to it. If we weren't holding the lock we'd have to signal
-            // m_performWorkEvent to make sure the work item got picked up.
-            return;
-        }
-    }
-
-    queue->performWorkOnRegisteredWorkThread();
-}
-
 DWORD WorkQueue::workThreadCallback(void* context)
 {
     ASSERT_ARG(context, context);
@@ -119,11 +94,6 @@
 
 void WorkQueue::platformInvalidate()
 {
-#if !ASSERT_DISABLED
-    MutexLocker lock(m_handlesLock);
-    ASSERT(m_handles.isEmpty());
-#endif
-
     // FIXME: We need to ensure that any timer-queue timers that fire after this point don't try to
     // access this WorkQueue <http://webkit.org/b/44690>.
     ::DeleteTimerQueueEx(m_timerQueue, 0);
@@ -221,29 +191,4 @@
     context.release().leakRef();
 }
 
-void WorkQueue::unregisterWaitAndDestroyItemSoon(PassRefPtr<HandleWorkItem> item)
-{
-    // We're going to make a blocking call to ::UnregisterWaitEx before closing the handle. (The
-    // blocking version of ::UnregisterWaitEx is much simpler than the non-blocking version.) If we
-    // do this on the current thread, we'll deadlock if we're currently in a callback function for
-    // the wait we're unregistering. So instead we do it asynchronously on some other worker thread.
-
-    ::QueueUserWorkItem(unregisterWaitAndDestroyItemCallback, item.leakRef(), WT_EXECUTEDEFAULT);
-}
-
-DWORD WINAPI WorkQueue::unregisterWaitAndDestroyItemCallback(void* context)
-{
-    ASSERT_ARG(context, context);
-    RefPtr<HandleWorkItem> item = adoptRef(static_cast<HandleWorkItem*>(context));
-
-    // Now that we know we're not in a callback function for the wait we're unregistering, we can
-    // make a blocking call to ::UnregisterWaitEx.
-    if (!::UnregisterWaitEx(item->waitHandle(), INVALID_HANDLE_VALUE)) {
-        DWORD error = ::GetLastError();
-        ASSERT_NOT_REACHED();
-    }
-
-    return 0;
-}
-
 } // namespace WTF
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to