Get rid of the Windows specific BinarySemaphore implementation
authorandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jun 2015 22:07:20 +0000 (22:07 +0000)
committerandersca@apple.com <andersca@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jun 2015 22:07:20 +0000 (22:07 +0000)
https://bugs.webkit.org/show_bug.cgi?id=146216

Reviewed by Andreas Kling.

The fact that the Windows implementation uses a HEVENT internally was only useful
to the Windows port of WebKit2; we can get rid of it now.

* WTF.vcxproj/WTF.vcxproj:
* WTF.vcxproj/WTF.vcxproj.filters:
* wtf/threads/BinarySemaphore.h:
(WTF::BinarySemaphore::event): Deleted.
* wtf/threads/win/BinarySemaphoreWin.cpp: Removed.
(WTF::BinarySemaphore::BinarySemaphore): Deleted.
(WTF::BinarySemaphore::~BinarySemaphore): Deleted.
(WTF::BinarySemaphore::signal): Deleted.
(WTF::BinarySemaphore::wait): Deleted.

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

Source/WTF/ChangeLog
Source/WTF/WTF.vcxproj/WTF.vcxproj
Source/WTF/WTF.vcxproj/WTF.vcxproj.filters
Source/WTF/wtf/threads/BinarySemaphore.h
Source/WTF/wtf/threads/win/BinarySemaphoreWin.cpp [deleted file]

index a1e85eb..9a965c6 100644 (file)
@@ -1,3 +1,23 @@
+2015-06-22  Anders Carlsson  <andersca@apple.com>
+
+        Get rid of the Windows specific BinarySemaphore implementation
+        https://bugs.webkit.org/show_bug.cgi?id=146216
+
+        Reviewed by Andreas Kling.
+
+        The fact that the Windows implementation uses a HEVENT internally was only useful
+        to the Windows port of WebKit2; we can get rid of it now.
+
+        * WTF.vcxproj/WTF.vcxproj:
+        * WTF.vcxproj/WTF.vcxproj.filters:
+        * wtf/threads/BinarySemaphore.h:
+        (WTF::BinarySemaphore::event): Deleted.
+        * wtf/threads/win/BinarySemaphoreWin.cpp: Removed.
+        (WTF::BinarySemaphore::BinarySemaphore): Deleted.
+        (WTF::BinarySemaphore::~BinarySemaphore): Deleted.
+        (WTF::BinarySemaphore::signal): Deleted.
+        (WTF::BinarySemaphore::wait): Deleted.
+
 2015-06-21  Gavin Barraclough  <barraclough@apple.com>
 
         Page load performance regression due to bugs.webkit.org/show_bug.cgi?id=145542
index 1f6f90e..5a2d253 100644 (file)
     <ClCompile Include="..\wtf\ThreadingWin.cpp" />
     <ClCompile Include="..\wtf\threadspecificWin.cpp" />
     <ClCompile Include="..\wtf\threads\BinarySemaphore.cpp" />
-    <ClCompile Include="..\wtf\threads\win\BinarySemaphoreWin.cpp" />
     <ClCompile Include="..\wtf\unicode\icu\CollatorICU.cpp" />
     <ClCompile Include="..\wtf\unicode\UTF8.cpp" />
     <ClCompile Include="..\wtf\win\MainThreadWin.cpp" />
index c21b0cc..fb7e7c4 100644 (file)
     <ClCompile Include="..\wtf\win\MainThreadWin.cpp">
       <Filter>wtf\win</Filter>
     </ClCompile>
-    <ClCompile Include="..\wtf\threads\win\BinarySemaphoreWin.cpp">
-      <Filter>threads\win</Filter>
-    </ClCompile>
     <ClCompile Include="..\wtf\threads\BinarySemaphore.cpp">
       <Filter>threads</Filter>
     </ClCompile>
index cae1023..b5db5d7 100644 (file)
@@ -41,19 +41,11 @@ public:
     WTF_EXPORT_PRIVATE void signal();
     WTF_EXPORT_PRIVATE bool wait(double absoluteTime);
 
-#if PLATFORM(WIN)
-    HANDLE event() const { return m_event; }
-#endif
-
 private:
-#if PLATFORM(WIN)
-    HANDLE m_event;
-#else
     bool m_isSet;
 
     Mutex m_mutex;
     ThreadCondition m_condition;
-#endif
 };
 
 } // namespace WTF
diff --git a/Source/WTF/wtf/threads/win/BinarySemaphoreWin.cpp b/Source/WTF/wtf/threads/win/BinarySemaphoreWin.cpp
deleted file mode 100644 (file)
index 0dad1ac..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "BinarySemaphore.h"
-
-namespace WTF {
-
-BinarySemaphore::BinarySemaphore()
-    : m_event(::CreateEventW(0, FALSE, FALSE, 0))
-{
-}
-
-BinarySemaphore::~BinarySemaphore()
-{
-    ::CloseHandle(m_event);
-}
-
-void BinarySemaphore::signal()
-{
-    ::SetEvent(m_event);
-}
-
-bool BinarySemaphore::wait(double absoluteTime)
-{
-    DWORD interval = absoluteTimeToWaitTimeoutInterval(absoluteTime);
-    if (!interval) {
-        // Consider the wait to have timed out, even if the event has already been signaled, to
-        // match the WTF::ThreadCondition implementation.
-        return false;
-    }
-
-    DWORD result = ::WaitForSingleObject(m_event, interval);
-    switch (result) {
-    case WAIT_OBJECT_0:
-        // The event was signaled.
-        return true;
-
-    case WAIT_TIMEOUT:
-        // The wait timed out.
-        return false;
-
-    case WAIT_FAILED:
-        ASSERT_WITH_MESSAGE(false, "::WaitForSingleObject failed with error %lu", ::GetLastError());
-        return false;
-
-    default:
-        ASSERT_WITH_MESSAGE(false, "::WaitForSingleObject returned unexpected result %lu", result);
-        return false;
-    }
-}
-
-} // namespace WTF