WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
221316
Optimize PointerCaptureController::elementWasRemoved()
https://bugs.webkit.org/show_bug.cgi?id=221316
Summary
Optimize PointerCaptureController::elementWasRemoved()
Simon Fraser (smfr)
Reported
2021-02-02 21:27:55 PST
Optimize PointerCaptureController::elementWasRemoved()
Attachments
Patch
(8.39 KB, patch)
2021-02-02 21:29 PST
,
Simon Fraser (smfr)
rniwa
: review+
ews-feeder
: commit-queue-
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Simon Fraser (smfr)
Comment 1
2021-02-02 21:29:17 PST
Created
attachment 419102
[details]
Patch
Ryosuke Niwa
Comment 2
2021-02-02 22:02:50 PST
Comment on
attachment 419102
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=419102&action=review
> Source/WebCore/page/PointerCaptureController.cpp:178 > +void PointerCaptureController::updateHaveAnyCapturingElement()
Do we need to eagerly update this or can we compute it lazily? e.g. use Optional<bool> for m_haveAnyCapturingElement and then haveAnyCapturingElement() inlined like haveAnyCapturingElement() { return m_haveAnyCapturingElement ? *m_haveAnyCapturingElement : haveAnyCapturingElementSlowCase(); }
> Source/WebCore/page/PointerCaptureController.cpp:180 > + auto haveAnyCapturingElement = [&] {
Do we really need to use lambda here? I find that setting m_haveAnyCapturingElement = false and breaking when the condition is hit would be easier to read. Alternatively, can we just use anyOf in Algorithms.h so that: m_haveAnyCapturingElement = WTF::anyOf(m_activePointerIdsToCapturingData.values(), [&] { ~ })
> Source/WebCore/page/PointerCaptureController.cpp:183 > + if (capturingData.pendingTargetOverride || capturingData.targetOverride
Can we add a helper function on CapturingData like CapturingData::hasCapturingElement()?
Simon Fraser (smfr)
Comment 3
2021-02-03 10:07:48 PST
(In reply to Ryosuke Niwa from
comment #2
)
> Comment on
attachment 419102
[details]
> Patch > > View in context: >
https://bugs.webkit.org/attachment.cgi?id=419102&action=review
> > > Source/WebCore/page/PointerCaptureController.cpp:178 > > +void PointerCaptureController::updateHaveAnyCapturingElement() > > Do we need to eagerly update this or can we compute it lazily? > e.g. use Optional<bool> for m_haveAnyCapturingElement > and then haveAnyCapturingElement() inlined like haveAnyCapturingElement() { > return m_haveAnyCapturingElement ? *m_haveAnyCapturingElement : > haveAnyCapturingElementSlowCase(); }
I think it's better to do the work eagerly in the functions that start/stop capture, since the no-capture case is massively more common than the capturing case.
> > > Source/WebCore/page/PointerCaptureController.cpp:180 > > + auto haveAnyCapturingElement = [&] { > > Do we really need to use lambda here? > I find that setting m_haveAnyCapturingElement = false and breaking when the > condition is hit would be easier to read. > Alternatively, can we just use anyOf in Algorithms.h so that: > m_haveAnyCapturingElement = > WTF::anyOf(m_activePointerIdsToCapturingData.values(), [&] { ~ })
I like the lambda. but I can change it.
> > Source/WebCore/page/PointerCaptureController.cpp:183 > > + if (capturingData.pendingTargetOverride || capturingData.targetOverride > > Can we add a helper function on CapturingData like > CapturingData::hasCapturingElement()?
Will do.
Ryosuke Niwa
Comment 4
2021-02-03 10:31:15 PST
(In reply to Simon Fraser (smfr) from
comment #3
)
> (In reply to Ryosuke Niwa from
comment #2
) > > Comment on
attachment 419102
[details]
> > Patch > > > > View in context: > >
https://bugs.webkit.org/attachment.cgi?id=419102&action=review
> > > > > Source/WebCore/page/PointerCaptureController.cpp:178 > > > +void PointerCaptureController::updateHaveAnyCapturingElement() > > > > Do we need to eagerly update this or can we compute it lazily? > > e.g. use Optional<bool> for m_haveAnyCapturingElement > > and then haveAnyCapturingElement() inlined like haveAnyCapturingElement() { > > return m_haveAnyCapturingElement ? *m_haveAnyCapturingElement : > > haveAnyCapturingElementSlowCase(); } > > I think it's better to do the work eagerly in the functions that start/stop > capture, since the no-capture case is massively more common than the > capturing case.
Ok.
> > > Source/WebCore/page/PointerCaptureController.cpp:180 > > > + auto haveAnyCapturingElement = [&] { > > > > Do we really need to use lambda here? > > I find that setting m_haveAnyCapturingElement = false and breaking when the > > condition is hit would be easier to read. > > Alternatively, can we just use anyOf in Algorithms.h so that: > > m_haveAnyCapturingElement = > > WTF::anyOf(m_activePointerIdsToCapturingData.values(), [&] { ~ }) > > I like the lambda. but I can change it.
Please use anyOf then.
Simon Fraser (smfr)
Comment 5
2021-02-03 10:44:53 PST
https://trac.webkit.org/changeset/272331/webkit
Radar WebKit Bug Importer
Comment 6
2021-02-03 10:45:18 PST
<
rdar://problem/73939380
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug