RESOLVED FIXED 222095
Avoid heap allocation for EventContexts
https://bugs.webkit.org/show_bug.cgi?id=222095
Summary Avoid heap allocation for EventContexts
Ryosuke Niwa
Reported 2021-02-18 00:59:51 PST
We don't need to a class hierarchy to represent different kinds of EventContext. Merge all the subclasses of EventContext onto itself to avoid heap allocation in EventPath.
Attachments
WIP (21.08 KB, patch)
2021-02-18 01:00 PST, Ryosuke Niwa
ews-feeder: commit-queue-
WIP2 (21.53 KB, patch)
2021-02-18 18:58 PST, Ryosuke Niwa
no flags
WIP2 + cleanup (27.51 KB, patch)
2021-02-19 17:59 PST, Ryosuke Niwa
no flags
Patch (33.71 KB, patch)
2021-02-24 21:51 PST, Ryosuke Niwa
simon.fraser: review+
Ryosuke Niwa
Comment 1 2021-02-18 01:00:10 PST
Ryosuke Niwa
Comment 2 2021-02-18 18:58:12 PST
Ryosuke Niwa
Comment 3 2021-02-19 17:59:50 PST
Created attachment 421066 [details] WIP2 + cleanup
Radar WebKit Bug Importer
Comment 4 2021-02-22 00:33:39 PST
Ryosuke Niwa
Comment 5 2021-02-24 21:51:29 PST
Simon Fraser (smfr)
Comment 6 2021-02-24 22:16:06 PST
Comment on attachment 421500 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=421500&action=review > Source/WebCore/dom/EventContext.h:62 > + bool isMouseOrFocusEventContext() const { return m_type == Type::MouseOrFocus; } > + bool isTouchEventContext() const { return m_type == Type::Touch; } > + bool isWindowContext() const { return m_type == Type::Window; } Not this patch, but it's weird how the context is sometimes about the type of event, and sometimes about the object it's fired on? > Source/WebCore/dom/EventContext.h:104 > + , m_type(type) Can't this be m_type { type } ?
Ryosuke Niwa
Comment 7 2021-02-25 00:22:48 PST
(In reply to Simon Fraser (smfr) from comment #6) > Comment on attachment 421500 [details] > Patch > > View in context: > https://bugs.webkit.org/attachment.cgi?id=421500&action=review > > > Source/WebCore/dom/EventContext.h:62 > > + bool isMouseOrFocusEventContext() const { return m_type == Type::MouseOrFocus; } > > + bool isTouchEventContext() const { return m_type == Type::Touch; } > > + bool isWindowContext() const { return m_type == Type::Window; } > > Not this patch, but it's weird how the context is sometimes about the type > of event, and sometimes about the object it's fired on? Yup, we should do that. I was initially going to do that in this patch but I decided against it to keep this patch simple & mechanical. > > Source/WebCore/dom/EventContext.h:104 > > + , m_type(type) > > Can't this be m_type { type } ? Oops, fixed. Not sure what happened there. Thanks for the reviews!
Ryosuke Niwa
Comment 8 2021-02-25 00:31:02 PST
Note You need to log in before you can comment on or make changes to this bug.