Make generic MainThreadSharedTimer implementation
authordon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2018 18:49:12 +0000 (18:49 +0000)
committerdon.olmstead@sony.com <don.olmstead@sony.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 7 Nov 2018 18:49:12 +0000 (18:49 +0000)
https://bugs.webkit.org/show_bug.cgi?id=191327

Reviewed by Michael Catanzaro.

No new tests. No change in behavior.

Moves generic implementation for MainThreadSharedTimerGlib.cpp into
MainThreadSharedTimer.cpp.

* platform/MainThreadSharedTimer.cpp:
(WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
(WebCore::MainThreadSharedTimer::setFireInterval):
(WebCore::MainThreadSharedTimer::stop):
(WebCore::MainThreadSharedTimer::invalidate):
* platform/MainThreadSharedTimer.h:
* platform/SourcesGLib.txt:
* platform/glib/MainThreadSharedTimerGLib.cpp: Removed.

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

Source/WebCore/ChangeLog
Source/WebCore/platform/MainThreadSharedTimer.cpp
Source/WebCore/platform/MainThreadSharedTimer.h
Source/WebCore/platform/SourcesGLib.txt
Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp [deleted file]

index f904d89..77d5f42 100644 (file)
@@ -1,3 +1,24 @@
+2018-11-07  Don Olmstead  <don.olmstead@sony.com>
+
+        Make generic MainThreadSharedTimer implementation
+        https://bugs.webkit.org/show_bug.cgi?id=191327
+
+        Reviewed by Michael Catanzaro.
+
+        No new tests. No change in behavior.
+
+        Moves generic implementation for MainThreadSharedTimerGlib.cpp into
+        MainThreadSharedTimer.cpp.
+
+        * platform/MainThreadSharedTimer.cpp:
+        (WebCore::MainThreadSharedTimer::MainThreadSharedTimer):
+        (WebCore::MainThreadSharedTimer::setFireInterval):
+        (WebCore::MainThreadSharedTimer::stop):
+        (WebCore::MainThreadSharedTimer::invalidate):
+        * platform/MainThreadSharedTimer.h:
+        * platform/SourcesGLib.txt:
+        * platform/glib/MainThreadSharedTimerGLib.cpp: Removed.
+
 2018-11-07  Ali Juma  <ajuma@chromium.org>
 
         IntersectionObserverEntry doesn't keep JS wrappers of rects alive
index 7923350..00dede9 100644 (file)
@@ -1,5 +1,8 @@
 /*
+ * Copyright (C) 2006-2016 Apple Inc. All rights reserved.
+ * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
  * Copyright (C) 2015 Igalia S.L.
+ * Copyright (C) 2018 Sony Interactive Entertainment.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #include <wtf/NeverDestroyed.h>
 
+#if USE(GLIB)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
+
 namespace WebCore {
 
 MainThreadSharedTimer& MainThreadSharedTimer::singleton()
@@ -36,8 +43,30 @@ MainThreadSharedTimer& MainThreadSharedTimer::singleton()
     return instance;
 }
 
-#if !PLATFORM(GTK) && !PLATFORM(WPE)
+#if USE(CF) || OS(WINDOWS)
+MainThreadSharedTimer::MainThreadSharedTimer() = default;
+#else
 MainThreadSharedTimer::MainThreadSharedTimer()
+    : m_timer(RunLoop::main(), this, &MainThreadSharedTimer::fired)
+{
+#if USE(GLIB)
+    m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
+    m_timer.setName("[WebKit] MainThreadDispatcherTimer");
+#endif
+}
+
+void MainThreadSharedTimer::setFireInterval(Seconds interval)
+{
+    ASSERT(m_firedFunction);
+    m_timer.startOneShot(interval);
+}
+
+void MainThreadSharedTimer::stop()
+{
+    m_timer.stop();
+}
+
+void MainThreadSharedTimer::invalidate()
 {
 }
 #endif
index 05bde47..45fbd78 100644 (file)
@@ -29,7 +29,7 @@
 #include "SharedTimer.h"
 #include <wtf/Forward.h>
 
-#if PLATFORM(GTK) || PLATFORM(WPE)
+#if !USE(CF) && !OS(WINDOWS)
 #include <wtf/RunLoop.h>
 #endif
 
@@ -53,7 +53,7 @@ private:
     MainThreadSharedTimer();
 
     WTF::Function<void()> m_firedFunction;
-#if PLATFORM(GTK) || PLATFORM(WPE)
+#if !USE(CF) && !OS(WINDOWS)
     RunLoop::Timer<MainThreadSharedTimer> m_timer;
 #endif
 };
index 8480191..b4b942c 100644 (file)
@@ -29,7 +29,6 @@ platform/glib/FileSystemGlib.cpp
 platform/glib/KeyedDecoderGlib.cpp
 platform/glib/KeyedEncoderGlib.cpp
 platform/glib/LowPowerModeNotifierGLib.cpp
-platform/glib/MainThreadSharedTimerGLib.cpp
 platform/glib/SSLKeyGeneratorGLib.cpp
 platform/glib/SharedBufferGlib.cpp
 platform/glib/UserAgentGLib.cpp
diff --git a/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp b/Source/WebCore/platform/glib/MainThreadSharedTimerGLib.cpp
deleted file mode 100644 (file)
index 8e05cd8..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Copyright (C) 2006-2016 Apple Inc.  All rights reserved.
- * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com
- * 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. ``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
- * 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 "MainThreadSharedTimer.h"
-
-#include <wtf/glib/RunLoopSourcePriority.h>
-
-namespace WebCore {
-
-MainThreadSharedTimer::MainThreadSharedTimer()
-    : m_timer(RunLoop::main(), this, &MainThreadSharedTimer::fired)
-{
-    m_timer.setPriority(RunLoopSourcePriority::MainThreadDispatcherTimer);
-    m_timer.setName("[WebKit] MainThreadDispatcherTimer");
-}
-
-void MainThreadSharedTimer::setFireInterval(Seconds interval)
-{
-    ASSERT(m_firedFunction);
-    m_timer.startOneShot(interval);
-}
-
-void MainThreadSharedTimer::stop()
-{
-    m_timer.stop();
-}
-
-void MainThreadSharedTimer::invalidate()
-{
-}
-
-} // namespace WebCore