Make `ContentEventHandler` stop using strong pointers as far as possible
Categories
(Core :: DOM: UI Events & Focus Handling, defect, P2)
Tracking
()
Tracking | Status | |
---|---|---|
firefox118 | --- | fixed |
People
(Reporter: masayuki, Assigned: masayuki)
References
(Blocks 2 open bugs)
Details
(Whiteboard: [sp3])
Attachments
(5 files)
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
48 bytes,
text/x-phabricator-request
|
Details | Review | |
Bug 1845215 - part 5: Rename `ContentEventHandler::*RawRange*` to `*SimpleRange*` r=smaug!,#dom-core
48 bytes,
text/x-phabricator-request
|
Details | Review |
According to the profile reported in bug 1844470, ContentEventHandler
spends on the content iterator which updates and references its nsCOMPtr<nsINode>
members a lot. Additionally, ContentEventHandler::NodePosition
inherits RangeBoundary
and used for temporary use a lot. However, while they are being used, there is no call of MOZ_CAN_RUN_SCRIPT
. Therefore, we can make them work without strong pointers.
Assignee | ||
Comment 1•2 years ago
|
||
ContentEventHandler
works with PostContentIterator
and PreContentIterator
when it scans DOM nodes in a range. While iterating the DOM nodes, script
never runs. Therefore, we can make ContentEventHandler
work with new
content iterators which do not store nodes with strong pointers.
This patch makes ContentIteratorBase
a template class and create new
UnsafePostContentIterator
and UnsafePreContentIterator
. They will
check whether DOM mutation occurs before destruction to detect dangerous
regressions.
Assignee | ||
Comment 2•2 years ago
|
||
It's used for tying a set of node and offset in it in short time and
ContentEventHandler
does not flush pending things in most paths.
Therefore, it can avoid using RangeBoundary
for solving its performance
issue.
Depends on D184441
Assignee | ||
Comment 3•2 years ago
|
||
Ah, in this profile, ContentEventHandler::RawRange
appears too. I'll add a patch for it today.
Assignee | ||
Comment 4•2 years ago
|
||
Testing again with additional patches...
Assignee | ||
Comment 5•2 years ago
|
||
It's used as both a temporary object in the stack and storing first range
selection range while ContentEventHandler
handles everything. In the
first case, ContentEventHandler
won't call any methods marked as
MOZ_CAN_RUN_SCRIPT
. Therefore, we can make it store only raw nsINode
pointer and RawRangeBoundary
.
Depends on D184442
Assignee | ||
Comment 6•2 years ago
|
||
Depends on D184466
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Updated•2 years ago
|
Assignee | ||
Comment 7•2 years ago
|
||
RawRange
sounds like related to RawRangeBoundary
, but it now has
RangeBoundary
members and UnsafeRawRange
has RawRangeBoundary
s.
They are helpers for ContentEventHandler
to work faster than nsRange
and dom::StaticRange
with avoiding to do unnecessary things for
ContentEventHandler
. Therefore, this patch renames them to *SimplRange*
since they just store two range boundaries and their root node simply.
Depends on D184467
Comment 9•2 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/3601308f553b
https://hg.mozilla.org/mozilla-central/rev/681e574c9ccb
https://hg.mozilla.org/mozilla-central/rev/d0a2d3fc1837
https://hg.mozilla.org/mozilla-central/rev/716372eb9576
https://hg.mozilla.org/mozilla-central/rev/b2b54f91567d
Description
•