Changeset 285413 in webkit
- Timestamp:
- Nov 8, 2021 10:37:35 AM (8 months ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
-
ChangeLog (modified) (1 diff)
-
html/HTMLSourceElement.cpp (modified) (4 diffs)
-
html/HTMLSourceElement.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r285410 r285413 1 2021-11-08 Chris Dumez <cdumez@apple.com> 2 3 Stop using a timer to dispatch the source element's error event asynchronously 4 https://bugs.webkit.org/show_bug.cgi?id=232817 5 6 Reviewed by Youenn Fablet. 7 8 Stop using a timer to dispatch the source element's error event asynchronously and use 9 the HTML5 event loop instead. 10 11 * html/HTMLSourceElement.cpp: 12 (WebCore::HTMLSourceElement::HTMLSourceElement): 13 (WebCore::HTMLSourceElement::scheduleErrorEvent): 14 (WebCore::HTMLSourceElement::cancelPendingErrorEvent): 15 (WebCore::HTMLSourceElement::errorEventTimerFired): Deleted. 16 (WebCore::HTMLSourceElement::suspend): Deleted. 17 (WebCore::HTMLSourceElement::resume): Deleted. 18 * html/HTMLSourceElement.h: 19 1 20 2021-11-08 Wenson Hsieh <wenson_hsieh@apple.com> 2 21 -
trunk/Source/WebCore/html/HTMLSourceElement.cpp
r283851 r285413 55 55 : HTMLElement(tagName, document) 56 56 , ActiveDOMObject(document) 57 , m_errorEventTimer(*this, &HTMLSourceElement::errorEventTimerFired)58 57 { 59 58 LOG(Media, "HTMLSourceElement::HTMLSourceElement - %p", this); … … 126 125 { 127 126 LOG(Media, "HTMLSourceElement::scheduleErrorEvent - %p", this); 128 if (m_errorEvent Timer.isActive())127 if (m_errorEventCancellationGroup.hasPendingTask()) 129 128 return; 130 129 131 m_errorEventTimer.startOneShot(0_s);130 queueCancellableTaskToDispatchEvent(*this, TaskSource::MediaElement, m_errorEventCancellationGroup, Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::Yes)); 132 131 } 133 132 … … 135 134 { 136 135 LOG(Media, "HTMLSourceElement::cancelPendingErrorEvent - %p", this); 137 m_errorEventTimer.stop(); 138 } 139 140 void HTMLSourceElement::errorEventTimerFired() 141 { 142 LOG(Media, "HTMLSourceElement::errorEventTimerFired - %p", this); 143 dispatchEvent(Event::create(eventNames().errorEvent, Event::CanBubble::No, Event::IsCancelable::Yes)); 136 m_errorEventCancellationGroup.cancel(); 144 137 } 145 138 … … 152 145 { 153 146 return "HTMLSourceElement"; 154 }155 156 void HTMLSourceElement::suspend(ReasonForSuspension reason)157 {158 // FIXME: Shouldn't this also stop the timer for PageWillBeSuspended?159 if (reason == ReasonForSuspension::BackForwardCache) {160 m_shouldRescheduleErrorEventOnResume = m_errorEventTimer.isActive();161 m_errorEventTimer.stop();162 }163 }164 165 void HTMLSourceElement::resume()166 {167 if (m_shouldRescheduleErrorEventOnResume) {168 m_errorEventTimer.startOneShot(0_s);169 m_shouldRescheduleErrorEventOnResume = false;170 }171 147 } 172 148 -
trunk/Source/WebCore/html/HTMLSourceElement.h
r284078 r285413 54 54 // ActiveDOMObject. 55 55 const char* activeDOMObjectName() const final; 56 void suspend(ReasonForSuspension) final;57 void resume() final;58 56 void stop() final; 59 57 … … 62 60 void attributeChanged(const QualifiedName&, const AtomString& oldValue, const AtomString& newValue, AttributeModificationReason) final; 63 61 64 void errorEventTimerFired(); 65 66 Timer m_errorEventTimer; 67 bool m_shouldRescheduleErrorEventOnResume { false }; 62 TaskCancellationGroup m_errorEventCancellationGroup; 68 63 bool m_shouldCallSourcesChanged { false }; 69 64 mutable std::optional<RefPtr<const MediaQuerySet>> m_cachedParsedMediaAttribute;
Note: See TracChangeset
for help on using the changeset viewer.