Title: [252218] trunk/Source/WebCore
Revision
252218
Author
[email protected]
Date
2019-11-07 16:57:59 -0800 (Thu, 07 Nov 2019)

Log Message

Drop GenericEventQueue class now that it is unused
https://bugs.webkit.org/show_bug.cgi?id=203980

Reviewed by Ryosuke Niwa.

Drop GenericEventQueue class now that it is unused. All users have been ported to the HTML
event loop. MainThreadGenericEventQueue remains for now but will get dropped in a follow-up
patch, once it is no longer used.

* dom/GenericEventQueue.cpp:
(WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
(WebCore::MainThreadGenericEventQueue::enqueueEvent):
(WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
(WebCore::MainThreadGenericEventQueue::close):
(WebCore::MainThreadGenericEventQueue::cancelAllEvents):
(WebCore::MainThreadGenericEventQueue::hasPendingEvents const):
(WebCore::MainThreadGenericEventQueue::hasPendingEventsOfType const):
(WebCore::MainThreadGenericEventQueue::setPaused):
(WebCore::MainThreadGenericEventQueue::suspend):
(WebCore::MainThreadGenericEventQueue::resume):
(WebCore::MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded):
(WebCore::MainThreadGenericEventQueue::stop):
(WebCore::MainThreadGenericEventQueue::activeDOMObjectName const):
(WebCore::TaskQueueConstructor::construct): Deleted.
(WebCore::TaskQueueConstructor<Timer>::construct): Deleted.
(WebCore::GenericEventQueueBase<T>::GenericEventQueueBase): Deleted.
(WebCore::GenericEventQueueBase<T>::enqueueEvent): Deleted.
(WebCore::GenericEventQueueBase<T>::dispatchOneEvent): Deleted.
(WebCore::GenericEventQueueBase<T>::close): Deleted.
(WebCore::GenericEventQueueBase<T>::cancelAllEvents): Deleted.
(WebCore::GenericEventQueueBase<T>::hasPendingEvents const): Deleted.
(WebCore::GenericEventQueueBase<T>::hasPendingEventsOfType const): Deleted.
(WebCore::GenericEventQueueBase<T>::setPaused): Deleted.
(WebCore::GenericEventQueueBase<T>::suspend): Deleted.
(WebCore::GenericEventQueueBase<T>::resume): Deleted.
(WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded): Deleted.
(WebCore::GenericEventQueueBase<T>::stop): Deleted.
(WebCore::GenericEventQueueBase<T>::activeDOMObjectName const): Deleted.
(WebCore::GenericEventQueue::create): Deleted.
* dom/GenericEventQueue.h:
(WebCore::GenericEventQueueBase::isSuspended const): Deleted.
(WebCore::GenericEventQueueBase::isSuspendedOrPausedByClient const): Deleted.
(WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue): Deleted.
(WebCore::GenericEventQueue::GenericEventQueue): Deleted.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (252217 => 252218)


--- trunk/Source/WebCore/ChangeLog	2019-11-08 00:52:28 UTC (rev 252217)
+++ trunk/Source/WebCore/ChangeLog	2019-11-08 00:57:59 UTC (rev 252218)
@@ -1,5 +1,52 @@
 2019-11-07  Chris Dumez  <[email protected]>
 
+        Drop GenericEventQueue class now that it is unused
+        https://bugs.webkit.org/show_bug.cgi?id=203980
+
+        Reviewed by Ryosuke Niwa.
+
+        Drop GenericEventQueue class now that it is unused. All users have been ported to the HTML
+        event loop. MainThreadGenericEventQueue remains for now but will get dropped in a follow-up
+        patch, once it is no longer used.
+
+        * dom/GenericEventQueue.cpp:
+        (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
+        (WebCore::MainThreadGenericEventQueue::enqueueEvent):
+        (WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
+        (WebCore::MainThreadGenericEventQueue::close):
+        (WebCore::MainThreadGenericEventQueue::cancelAllEvents):
+        (WebCore::MainThreadGenericEventQueue::hasPendingEvents const):
+        (WebCore::MainThreadGenericEventQueue::hasPendingEventsOfType const):
+        (WebCore::MainThreadGenericEventQueue::setPaused):
+        (WebCore::MainThreadGenericEventQueue::suspend):
+        (WebCore::MainThreadGenericEventQueue::resume):
+        (WebCore::MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded):
+        (WebCore::MainThreadGenericEventQueue::stop):
+        (WebCore::MainThreadGenericEventQueue::activeDOMObjectName const):
+        (WebCore::TaskQueueConstructor::construct): Deleted.
+        (WebCore::TaskQueueConstructor<Timer>::construct): Deleted.
+        (WebCore::GenericEventQueueBase<T>::GenericEventQueueBase): Deleted.
+        (WebCore::GenericEventQueueBase<T>::enqueueEvent): Deleted.
+        (WebCore::GenericEventQueueBase<T>::dispatchOneEvent): Deleted.
+        (WebCore::GenericEventQueueBase<T>::close): Deleted.
+        (WebCore::GenericEventQueueBase<T>::cancelAllEvents): Deleted.
+        (WebCore::GenericEventQueueBase<T>::hasPendingEvents const): Deleted.
+        (WebCore::GenericEventQueueBase<T>::hasPendingEventsOfType const): Deleted.
+        (WebCore::GenericEventQueueBase<T>::setPaused): Deleted.
+        (WebCore::GenericEventQueueBase<T>::suspend): Deleted.
+        (WebCore::GenericEventQueueBase<T>::resume): Deleted.
+        (WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded): Deleted.
+        (WebCore::GenericEventQueueBase<T>::stop): Deleted.
+        (WebCore::GenericEventQueueBase<T>::activeDOMObjectName const): Deleted.
+        (WebCore::GenericEventQueue::create): Deleted.
+        * dom/GenericEventQueue.h:
+        (WebCore::GenericEventQueueBase::isSuspended const): Deleted.
+        (WebCore::GenericEventQueueBase::isSuspendedOrPausedByClient const): Deleted.
+        (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue): Deleted.
+        (WebCore::GenericEventQueue::GenericEventQueue): Deleted.
+
+2019-11-07  Chris Dumez  <[email protected]>
+
         Port Worker to the HTML5 event loop
         https://bugs.webkit.org/show_bug.cgi?id=203919
 

Modified: trunk/Source/WebCore/dom/GenericEventQueue.cpp (252217 => 252218)


--- trunk/Source/WebCore/dom/GenericEventQueue.cpp	2019-11-08 00:52:28 UTC (rev 252217)
+++ trunk/Source/WebCore/dom/GenericEventQueue.cpp	2019-11-08 00:57:59 UTC (rev 252218)
@@ -36,27 +36,14 @@
 
 namespace WebCore {
 
-template<typename T> struct TaskQueueConstructor {
-    static UniqueRef<GenericTaskQueue<T>> construct(ScriptExecutionContext* context) { return makeUniqueRef<GenericTaskQueue<T>>(context); }
-};
-
-template<> struct TaskQueueConstructor<Timer> {
-    static UniqueRef<GenericTaskQueue<Timer>> construct(ScriptExecutionContext*) { return makeUniqueRef<GenericTaskQueue<Timer>>(); }
-};
-
-template<typename T>
-GenericEventQueueBase<T>::GenericEventQueueBase(EventTarget& owner)
+MainThreadGenericEventQueue::MainThreadGenericEventQueue(EventTarget& owner)
     : ActiveDOMObject(owner.scriptExecutionContext())
     , m_owner(owner)
-    , m_taskQueue(TaskQueueConstructor<T>::construct(owner.scriptExecutionContext()))
+    , m_taskQueue(makeUniqueRef<GenericTaskQueue<Timer>>())
 {
 }
 
-template<typename T>
-GenericEventQueueBase<T>::~GenericEventQueueBase() = default;
-
-template<typename T>
-void GenericEventQueueBase<T>::enqueueEvent(RefPtr<Event>&& event)
+void MainThreadGenericEventQueue::enqueueEvent(RefPtr<Event>&& event)
 {
     if (m_isClosed)
         return;
@@ -69,11 +56,10 @@
     if (isSuspendedOrPausedByClient())
         return;
 
-    m_taskQueue->enqueueTask(std::bind(&GenericEventQueueBase::dispatchOneEvent, this));
+    m_taskQueue->enqueueTask(std::bind(&MainThreadGenericEventQueue::dispatchOneEvent, this));
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::dispatchOneEvent()
+void MainThreadGenericEventQueue::dispatchOneEvent()
 {
     ASSERT(!m_pendingEvents.isEmpty());
 
@@ -86,8 +72,7 @@
     target.dispatchEvent(*event);
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::close()
+void MainThreadGenericEventQueue::close()
 {
     m_isClosed = true;
 
@@ -95,21 +80,18 @@
     m_pendingEvents.clear();
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::cancelAllEvents()
+void MainThreadGenericEventQueue::cancelAllEvents()
 {
     m_taskQueue->cancelAllTasks();
     m_pendingEvents.clear();
 }
 
-template<typename T>
-bool GenericEventQueueBase<T>::hasPendingEvents() const
+bool MainThreadGenericEventQueue::hasPendingEvents() const
 {
     return !m_pendingEvents.isEmpty();
 }
 
-template<typename T>
-bool GenericEventQueueBase<T>::hasPendingEventsOfType(const AtomString& type) const
+bool MainThreadGenericEventQueue::hasPendingEventsOfType(const AtomString& type) const
 {
     for (auto& event : m_pendingEvents) {
         if (event->type() == type)
@@ -119,8 +101,7 @@
     return false;
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::setPaused(bool shouldPause)
+void MainThreadGenericEventQueue::setPaused(bool shouldPause)
 {
     if (m_isPausedByClient == shouldPause)
         return;
@@ -132,8 +113,7 @@
         rescheduleAllEventsIfNeeded();
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::suspend(ReasonForSuspension)
+void MainThreadGenericEventQueue::suspend(ReasonForSuspension)
 {
     if (m_isSuspended)
         return;
@@ -142,8 +122,7 @@
     m_taskQueue->cancelAllTasks();
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::resume()
+void MainThreadGenericEventQueue::resume()
 {
     if (!m_isSuspended)
         return;
@@ -152,38 +131,25 @@
     rescheduleAllEventsIfNeeded();
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded()
+void MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded()
 {
     if (isSuspendedOrPausedByClient())
         return;
 
     for (unsigned i = 0; i < m_pendingEvents.size(); ++i)
-        m_taskQueue->enqueueTask(std::bind(&GenericEventQueueBase::dispatchOneEvent, this));
+        m_taskQueue->enqueueTask(std::bind(&MainThreadGenericEventQueue::dispatchOneEvent, this));
 }
 
-template<typename T>
-void GenericEventQueueBase<T>::stop()
+void MainThreadGenericEventQueue::stop()
 {
     close();
 }
 
-template<typename T>
-const char* GenericEventQueueBase<T>::activeDOMObjectName() const
+const char* MainThreadGenericEventQueue::activeDOMObjectName() const
 {
-    return "GenericEventQueueBase";
+    return "MainThreadGenericEventQueue";
 }
 
-template class GenericEventQueueBase<Timer>;
-template class GenericEventQueueBase<ScriptExecutionContext>;
-
-UniqueRef<GenericEventQueue> GenericEventQueue::create(EventTarget& eventTarget)
-{
-    auto eventQueue = makeUniqueRef<GenericEventQueue>(eventTarget);
-    eventQueue->suspendIfNeeded();
-    return eventQueue;
-}
-
 UniqueRef<MainThreadGenericEventQueue> MainThreadGenericEventQueue::create(EventTarget& eventTarget)
 {
     auto eventQueue = makeUniqueRef<MainThreadGenericEventQueue>(eventTarget);

Modified: trunk/Source/WebCore/dom/GenericEventQueue.h (252217 => 252218)


--- trunk/Source/WebCore/dom/GenericEventQueue.h	2019-11-08 00:52:28 UTC (rev 252217)
+++ trunk/Source/WebCore/dom/GenericEventQueue.h	2019-11-08 00:57:59 UTC (rev 252218)
@@ -39,12 +39,12 @@
 class Timer;
 class ScriptExecutionContext;
 
-template<typename T>
-class GenericEventQueueBase : public ActiveDOMObject {
+// All instances of MainThreadGenericEventQueue use a shared Timer for dispatching events.
+// FIXME: We should port call sites to the HTML event loop and remove this class.
+class MainThreadGenericEventQueue : public ActiveDOMObject {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    explicit GenericEventQueueBase(EventTarget&);
-    ~GenericEventQueueBase();
+    static UniqueRef<MainThreadGenericEventQueue> create(EventTarget&);
 
     void enqueueEvent(RefPtr<Event>&&);
     void close();
@@ -58,6 +58,9 @@
     bool isSuspended() const { return m_isSuspended; }
 
 private:
+    friend UniqueRef<MainThreadGenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<MainThreadGenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
+    explicit MainThreadGenericEventQueue(EventTarget&);
+
     void dispatchOneEvent();
 
     const char* activeDOMObjectName() const final;
@@ -69,7 +72,7 @@
     bool isSuspendedOrPausedByClient() const { return m_isSuspended || m_isPausedByClient; }
 
     EventTarget& m_owner;
-    UniqueRef<GenericTaskQueue<T>> m_taskQueue;
+    UniqueRef<GenericTaskQueue<Timer>> m_taskQueue;
     Deque<RefPtr<Event>> m_pendingEvents;
     bool m_isClosed { false };
     bool m_isPausedByClient { false };
@@ -76,30 +79,4 @@
     bool m_isSuspended { false };
 };
 
-// All instances of MainThreadGenericEventQueue use a shared Timer for dispatching events.
-class MainThreadGenericEventQueue : public GenericEventQueueBase<Timer> {
-public:
-    static UniqueRef<MainThreadGenericEventQueue> create(EventTarget&);
-
-private:
-    friend UniqueRef<MainThreadGenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<MainThreadGenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
-    explicit MainThreadGenericEventQueue(EventTarget& eventTarget)
-        : GenericEventQueueBase<Timer>(eventTarget)
-    {
-    }
-};
-
-class GenericEventQueue : public GenericEventQueueBase<ScriptExecutionContext> {
-    WTF_MAKE_FAST_ALLOCATED;
-public:
-    static UniqueRef<GenericEventQueue> create(EventTarget&);
-
-private:
-    friend UniqueRef<GenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<GenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
-    explicit GenericEventQueue(EventTarget& eventTarget)
-        : GenericEventQueueBase<ScriptExecutionContext>(eventTarget)
-    {
-    }
-};
-
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to