Changeset 252218 in webkit


Ignore:
Timestamp:
Nov 7, 2019 4:57:59 PM (4 years ago)
Author:
Chris Dumez
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.

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r252212 r252218  
     12019-11-07  Chris Dumez  <cdumez@apple.com>
     2
     3        Drop GenericEventQueue class now that it is unused
     4        https://bugs.webkit.org/show_bug.cgi?id=203980
     5
     6        Reviewed by Ryosuke Niwa.
     7
     8        Drop GenericEventQueue class now that it is unused. All users have been ported to the HTML
     9        event loop. MainThreadGenericEventQueue remains for now but will get dropped in a follow-up
     10        patch, once it is no longer used.
     11
     12        * dom/GenericEventQueue.cpp:
     13        (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue):
     14        (WebCore::MainThreadGenericEventQueue::enqueueEvent):
     15        (WebCore::MainThreadGenericEventQueue::dispatchOneEvent):
     16        (WebCore::MainThreadGenericEventQueue::close):
     17        (WebCore::MainThreadGenericEventQueue::cancelAllEvents):
     18        (WebCore::MainThreadGenericEventQueue::hasPendingEvents const):
     19        (WebCore::MainThreadGenericEventQueue::hasPendingEventsOfType const):
     20        (WebCore::MainThreadGenericEventQueue::setPaused):
     21        (WebCore::MainThreadGenericEventQueue::suspend):
     22        (WebCore::MainThreadGenericEventQueue::resume):
     23        (WebCore::MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded):
     24        (WebCore::MainThreadGenericEventQueue::stop):
     25        (WebCore::MainThreadGenericEventQueue::activeDOMObjectName const):
     26        (WebCore::TaskQueueConstructor::construct): Deleted.
     27        (WebCore::TaskQueueConstructor<Timer>::construct): Deleted.
     28        (WebCore::GenericEventQueueBase<T>::GenericEventQueueBase): Deleted.
     29        (WebCore::GenericEventQueueBase<T>::enqueueEvent): Deleted.
     30        (WebCore::GenericEventQueueBase<T>::dispatchOneEvent): Deleted.
     31        (WebCore::GenericEventQueueBase<T>::close): Deleted.
     32        (WebCore::GenericEventQueueBase<T>::cancelAllEvents): Deleted.
     33        (WebCore::GenericEventQueueBase<T>::hasPendingEvents const): Deleted.
     34        (WebCore::GenericEventQueueBase<T>::hasPendingEventsOfType const): Deleted.
     35        (WebCore::GenericEventQueueBase<T>::setPaused): Deleted.
     36        (WebCore::GenericEventQueueBase<T>::suspend): Deleted.
     37        (WebCore::GenericEventQueueBase<T>::resume): Deleted.
     38        (WebCore::GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded): Deleted.
     39        (WebCore::GenericEventQueueBase<T>::stop): Deleted.
     40        (WebCore::GenericEventQueueBase<T>::activeDOMObjectName const): Deleted.
     41        (WebCore::GenericEventQueue::create): Deleted.
     42        * dom/GenericEventQueue.h:
     43        (WebCore::GenericEventQueueBase::isSuspended const): Deleted.
     44        (WebCore::GenericEventQueueBase::isSuspendedOrPausedByClient const): Deleted.
     45        (WebCore::MainThreadGenericEventQueue::MainThreadGenericEventQueue): Deleted.
     46        (WebCore::GenericEventQueue::GenericEventQueue): Deleted.
     47
    1482019-11-07  Chris Dumez  <cdumez@apple.com>
    249
  • trunk/Source/WebCore/dom/GenericEventQueue.cpp

    r251244 r252218  
    3737namespace WebCore {
    3838
    39 template<typename T> struct TaskQueueConstructor {
    40     static UniqueRef<GenericTaskQueue<T>> construct(ScriptExecutionContext* context) { return makeUniqueRef<GenericTaskQueue<T>>(context); }
    41 };
    42 
    43 template<> struct TaskQueueConstructor<Timer> {
    44     static UniqueRef<GenericTaskQueue<Timer>> construct(ScriptExecutionContext*) { return makeUniqueRef<GenericTaskQueue<Timer>>(); }
    45 };
    46 
    47 template<typename T>
    48 GenericEventQueueBase<T>::GenericEventQueueBase(EventTarget& owner)
     39MainThreadGenericEventQueue::MainThreadGenericEventQueue(EventTarget& owner)
    4940    : ActiveDOMObject(owner.scriptExecutionContext())
    5041    , m_owner(owner)
    51     , m_taskQueue(TaskQueueConstructor<T>::construct(owner.scriptExecutionContext()))
     42    , m_taskQueue(makeUniqueRef<GenericTaskQueue<Timer>>())
    5243{
    5344}
    5445
    55 template<typename T>
    56 GenericEventQueueBase<T>::~GenericEventQueueBase() = default;
    57 
    58 template<typename T>
    59 void GenericEventQueueBase<T>::enqueueEvent(RefPtr<Event>&& event)
     46void MainThreadGenericEventQueue::enqueueEvent(RefPtr<Event>&& event)
    6047{
    6148    if (m_isClosed)
     
    7057        return;
    7158
    72     m_taskQueue->enqueueTask(std::bind(&GenericEventQueueBase::dispatchOneEvent, this));
     59    m_taskQueue->enqueueTask(std::bind(&MainThreadGenericEventQueue::dispatchOneEvent, this));
    7360}
    7461
    75 template<typename T>
    76 void GenericEventQueueBase<T>::dispatchOneEvent()
     62void MainThreadGenericEventQueue::dispatchOneEvent()
    7763{
    7864    ASSERT(!m_pendingEvents.isEmpty());
     
    8773}
    8874
    89 template<typename T>
    90 void GenericEventQueueBase<T>::close()
     75void MainThreadGenericEventQueue::close()
    9176{
    9277    m_isClosed = true;
     
    9681}
    9782
    98 template<typename T>
    99 void GenericEventQueueBase<T>::cancelAllEvents()
     83void MainThreadGenericEventQueue::cancelAllEvents()
    10084{
    10185    m_taskQueue->cancelAllTasks();
     
    10387}
    10488
    105 template<typename T>
    106 bool GenericEventQueueBase<T>::hasPendingEvents() const
     89bool MainThreadGenericEventQueue::hasPendingEvents() const
    10790{
    10891    return !m_pendingEvents.isEmpty();
    10992}
    11093
    111 template<typename T>
    112 bool GenericEventQueueBase<T>::hasPendingEventsOfType(const AtomString& type) const
     94bool MainThreadGenericEventQueue::hasPendingEventsOfType(const AtomString& type) const
    11395{
    11496    for (auto& event : m_pendingEvents) {
     
    120102}
    121103
    122 template<typename T>
    123 void GenericEventQueueBase<T>::setPaused(bool shouldPause)
     104void MainThreadGenericEventQueue::setPaused(bool shouldPause)
    124105{
    125106    if (m_isPausedByClient == shouldPause)
     
    133114}
    134115
    135 template<typename T>
    136 void GenericEventQueueBase<T>::suspend(ReasonForSuspension)
     116void MainThreadGenericEventQueue::suspend(ReasonForSuspension)
    137117{
    138118    if (m_isSuspended)
     
    143123}
    144124
    145 template<typename T>
    146 void GenericEventQueueBase<T>::resume()
     125void MainThreadGenericEventQueue::resume()
    147126{
    148127    if (!m_isSuspended)
     
    153132}
    154133
    155 template<typename T>
    156 void GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded()
     134void MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded()
    157135{
    158136    if (isSuspendedOrPausedByClient())
     
    160138
    161139    for (unsigned i = 0; i < m_pendingEvents.size(); ++i)
    162         m_taskQueue->enqueueTask(std::bind(&GenericEventQueueBase::dispatchOneEvent, this));
     140        m_taskQueue->enqueueTask(std::bind(&MainThreadGenericEventQueue::dispatchOneEvent, this));
    163141}
    164142
    165 template<typename T>
    166 void GenericEventQueueBase<T>::stop()
     143void MainThreadGenericEventQueue::stop()
    167144{
    168145    close();
    169146}
    170147
    171 template<typename T>
    172 const char* GenericEventQueueBase<T>::activeDOMObjectName() const
     148const char* MainThreadGenericEventQueue::activeDOMObjectName() const
    173149{
    174     return "GenericEventQueueBase";
    175 }
    176 
    177 template class GenericEventQueueBase<Timer>;
    178 template class GenericEventQueueBase<ScriptExecutionContext>;
    179 
    180 UniqueRef<GenericEventQueue> GenericEventQueue::create(EventTarget& eventTarget)
    181 {
    182     auto eventQueue = makeUniqueRef<GenericEventQueue>(eventTarget);
    183     eventQueue->suspendIfNeeded();
    184     return eventQueue;
     150    return "MainThreadGenericEventQueue";
    185151}
    186152
  • trunk/Source/WebCore/dom/GenericEventQueue.h

    r251244 r252218  
    4040class ScriptExecutionContext;
    4141
    42 template<typename T>
    43 class GenericEventQueueBase : public ActiveDOMObject {
     42// All instances of MainThreadGenericEventQueue use a shared Timer for dispatching events.
     43// FIXME: We should port call sites to the HTML event loop and remove this class.
     44class MainThreadGenericEventQueue : public ActiveDOMObject {
    4445    WTF_MAKE_FAST_ALLOCATED;
    4546public:
    46     explicit GenericEventQueueBase(EventTarget&);
    47     ~GenericEventQueueBase();
     47    static UniqueRef<MainThreadGenericEventQueue> create(EventTarget&);
    4848
    4949    void enqueueEvent(RefPtr<Event>&&);
     
    5959
    6060private:
     61    friend UniqueRef<MainThreadGenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<MainThreadGenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
     62    explicit MainThreadGenericEventQueue(EventTarget&);
     63
    6164    void dispatchOneEvent();
    6265
     
    7073
    7174    EventTarget& m_owner;
    72     UniqueRef<GenericTaskQueue<T>> m_taskQueue;
     75    UniqueRef<GenericTaskQueue<Timer>> m_taskQueue;
    7376    Deque<RefPtr<Event>> m_pendingEvents;
    7477    bool m_isClosed { false };
     
    7780};
    7881
    79 // All instances of MainThreadGenericEventQueue use a shared Timer for dispatching events.
    80 class MainThreadGenericEventQueue : public GenericEventQueueBase<Timer> {
    81 public:
    82     static UniqueRef<MainThreadGenericEventQueue> create(EventTarget&);
    83 
    84 private:
    85     friend UniqueRef<MainThreadGenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<MainThreadGenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
    86     explicit MainThreadGenericEventQueue(EventTarget& eventTarget)
    87         : GenericEventQueueBase<Timer>(eventTarget)
    88     {
    89     }
    90 };
    91 
    92 class GenericEventQueue : public GenericEventQueueBase<ScriptExecutionContext> {
    93     WTF_MAKE_FAST_ALLOCATED;
    94 public:
    95     static UniqueRef<GenericEventQueue> create(EventTarget&);
    96 
    97 private:
    98     friend UniqueRef<GenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<GenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&);
    99     explicit GenericEventQueue(EventTarget& eventTarget)
    100         : GenericEventQueueBase<ScriptExecutionContext>(eventTarget)
    101     {
    102     }
    103 };
    104 
    10582} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.