RESOLVED FIXED 78840
Abstract ImageEventSender into a general purpose EventSender
https://bugs.webkit.org/show_bug.cgi?id=78840
Summary Abstract ImageEventSender into a general purpose EventSender
Daniel Bates
Reported 2012-02-16 14:03:21 PST
We should abstract the functionality of ImageEventSender into a general purpose class, called EventSender. This general purpose class may be useful towards fixing bug #38995.
Attachments
Patch (12.34 KB, patch)
2012-02-16 14:06 PST, Daniel Bates
no flags
Patch (14.55 KB, patch)
2012-02-16 16:27 PST, Daniel Bates
abarth: review+
Daniel Bates
Comment 1 2012-02-16 14:06:08 PST
Created attachment 127438 [details] Patch The name "EventSender" is a bit vague. The purpose of this class is to queue up senders of a specific DOM event, say a Load event, and to call each sender back when they should dispatch such an event. Maybe EventSenderScheduler or EventSenderQueue would be a more descriptive name?
Daniel Bates
Comment 2 2012-02-16 15:20:30 PST
Comment on attachment 127438 [details] Patch Clearing review flag as I need to add EventSender.h to all build systems.
Daniel Bates
Comment 3 2012-02-16 16:27:42 PST
Adam Barth
Comment 4 2012-02-21 12:35:54 PST
Comment on attachment 127464 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=127464&action=review > Source/WebCore/dom/EventSender.h:88 > + if (m_dispatchSoonList.isEmpty()) > + m_timer.stop(); Do you mean to check whether the list is empty or whether it contains all zeros? I'm not sure how this function could result in m_dispatchSoonList being empty if it wasn't already empty. > Source/WebCore/loader/ImageLoader.cpp:-385 > - if (m_dispatchSoonList.isEmpty()) > - m_timer.stop(); I see this was here already. We might want to ask the original author why they intended here.
Daniel Bates
Comment 5 2012-02-22 15:19:15 PST
(In reply to comment #4) > (From update of attachment 127464 [details]) > View in context: https://bugs.webkit.org/attachment.cgi?id=127464&action=review > > > Source/WebCore/dom/EventSender.h:88 > > + if (m_dispatchSoonList.isEmpty()) > > + m_timer.stop(); > > Do you mean to check whether the list is empty or whether it contains all zeros? I'm not sure how this function could result in m_dispatchSoonList being empty if it wasn't already empty. As far as I can tell this code isn't necessary anymore and is an artifact of using a QPtrList data structure for this functionality when it was originally in DocumentImpl::removeImage() (see <http://trac.webkit.org/browser/trunk/WebCore/khtml/xml/DocumentImpl.cpp?rev=12515#L2302>). In particular, DocumentImpl::removeImage() actually removed items from its QPtrList m_imageLoadEventDispatchSoonList (as opposed to zeroing out its items as we do today) ;=> m_imageLoadEventDispatchSoonList could become empty. I'll remove this code before landing. CC'ing Darin Adler since he may be interested to see this go by given that he kept this "if (m_dispatchSoonList.isEmpty())" code through both <http://trac.webkit.org/changeset/39296> (changed functionality to zero out list entries) and <http://trac.webkit.org/changeset/41766> (moved functionality out of Document.cpp).
Daniel Bates
Comment 6 2012-02-22 15:27:57 PST
Yong Li
Comment 7 2013-01-25 07:18:41 PST
This EventSender should be SuspendableTimer or at least ActiveDOMObject?
Note You need to log in before you can comment on or make changes to this bug.