Changeset 252218 in webkit
- Timestamp:
- Nov 7, 2019 4:57:59 PM (4 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r252212 r252218 1 2019-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 1 48 2019-11-07 Chris Dumez <cdumez@apple.com> 2 49 -
trunk/Source/WebCore/dom/GenericEventQueue.cpp
r251244 r252218 37 37 namespace WebCore { 38 38 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) 39 MainThreadGenericEventQueue::MainThreadGenericEventQueue(EventTarget& owner) 49 40 : ActiveDOMObject(owner.scriptExecutionContext()) 50 41 , m_owner(owner) 51 , m_taskQueue( TaskQueueConstructor<T>::construct(owner.scriptExecutionContext()))42 , m_taskQueue(makeUniqueRef<GenericTaskQueue<Timer>>()) 52 43 { 53 44 } 54 45 55 template<typename T> 56 GenericEventQueueBase<T>::~GenericEventQueueBase() = default; 57 58 template<typename T> 59 void GenericEventQueueBase<T>::enqueueEvent(RefPtr<Event>&& event) 46 void MainThreadGenericEventQueue::enqueueEvent(RefPtr<Event>&& event) 60 47 { 61 48 if (m_isClosed) … … 70 57 return; 71 58 72 m_taskQueue->enqueueTask(std::bind(& GenericEventQueueBase::dispatchOneEvent, this));59 m_taskQueue->enqueueTask(std::bind(&MainThreadGenericEventQueue::dispatchOneEvent, this)); 73 60 } 74 61 75 template<typename T> 76 void GenericEventQueueBase<T>::dispatchOneEvent() 62 void MainThreadGenericEventQueue::dispatchOneEvent() 77 63 { 78 64 ASSERT(!m_pendingEvents.isEmpty()); … … 87 73 } 88 74 89 template<typename T> 90 void GenericEventQueueBase<T>::close() 75 void MainThreadGenericEventQueue::close() 91 76 { 92 77 m_isClosed = true; … … 96 81 } 97 82 98 template<typename T> 99 void GenericEventQueueBase<T>::cancelAllEvents() 83 void MainThreadGenericEventQueue::cancelAllEvents() 100 84 { 101 85 m_taskQueue->cancelAllTasks(); … … 103 87 } 104 88 105 template<typename T> 106 bool GenericEventQueueBase<T>::hasPendingEvents() const 89 bool MainThreadGenericEventQueue::hasPendingEvents() const 107 90 { 108 91 return !m_pendingEvents.isEmpty(); 109 92 } 110 93 111 template<typename T> 112 bool GenericEventQueueBase<T>::hasPendingEventsOfType(const AtomString& type) const 94 bool MainThreadGenericEventQueue::hasPendingEventsOfType(const AtomString& type) const 113 95 { 114 96 for (auto& event : m_pendingEvents) { … … 120 102 } 121 103 122 template<typename T> 123 void GenericEventQueueBase<T>::setPaused(bool shouldPause) 104 void MainThreadGenericEventQueue::setPaused(bool shouldPause) 124 105 { 125 106 if (m_isPausedByClient == shouldPause) … … 133 114 } 134 115 135 template<typename T> 136 void GenericEventQueueBase<T>::suspend(ReasonForSuspension) 116 void MainThreadGenericEventQueue::suspend(ReasonForSuspension) 137 117 { 138 118 if (m_isSuspended) … … 143 123 } 144 124 145 template<typename T> 146 void GenericEventQueueBase<T>::resume() 125 void MainThreadGenericEventQueue::resume() 147 126 { 148 127 if (!m_isSuspended) … … 153 132 } 154 133 155 template<typename T> 156 void GenericEventQueueBase<T>::rescheduleAllEventsIfNeeded() 134 void MainThreadGenericEventQueue::rescheduleAllEventsIfNeeded() 157 135 { 158 136 if (isSuspendedOrPausedByClient()) … … 160 138 161 139 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)); 163 141 } 164 142 165 template<typename T> 166 void GenericEventQueueBase<T>::stop() 143 void MainThreadGenericEventQueue::stop() 167 144 { 168 145 close(); 169 146 } 170 147 171 template<typename T> 172 const char* GenericEventQueueBase<T>::activeDOMObjectName() const 148 const char* MainThreadGenericEventQueue::activeDOMObjectName() const 173 149 { 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"; 185 151 } 186 152 -
trunk/Source/WebCore/dom/GenericEventQueue.h
r251244 r252218 40 40 class ScriptExecutionContext; 41 41 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. 44 class MainThreadGenericEventQueue : public ActiveDOMObject { 44 45 WTF_MAKE_FAST_ALLOCATED; 45 46 public: 46 explicit GenericEventQueueBase(EventTarget&); 47 ~GenericEventQueueBase(); 47 static UniqueRef<MainThreadGenericEventQueue> create(EventTarget&); 48 48 49 49 void enqueueEvent(RefPtr<Event>&&); … … 59 59 60 60 private: 61 friend UniqueRef<MainThreadGenericEventQueue> WTF::makeUniqueRefWithoutFastMallocCheck<MainThreadGenericEventQueue, WebCore::EventTarget&>(WebCore::EventTarget&); 62 explicit MainThreadGenericEventQueue(EventTarget&); 63 61 64 void dispatchOneEvent(); 62 65 … … 70 73 71 74 EventTarget& m_owner; 72 UniqueRef<GenericTaskQueue<T >> m_taskQueue;75 UniqueRef<GenericTaskQueue<Timer>> m_taskQueue; 73 76 Deque<RefPtr<Event>> m_pendingEvents; 74 77 bool m_isClosed { false }; … … 77 80 }; 78 81 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 105 82 } // namespace WebCore
Note: See TracChangeset
for help on using the changeset viewer.