Bug 210944 - Reduce use of WebPageProxy::VoidCallback
Summary: Reduce use of WebPageProxy::VoidCallback
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: New Bugs (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Alex Christensen
URL:
Keywords: InRadar
Depends on:
Blocks:
 
Reported: 2020-04-23 16:40 PDT by Alex Christensen
Modified: 2020-04-27 10:14 PDT (History)
3 users (show)

See Also:


Attachments
Patch (39.58 KB, patch)
2020-04-23 16:51 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff
Patch (39.55 KB, patch)
2020-04-24 13:56 PDT, Alex Christensen
no flags Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alex Christensen 2020-04-23 16:40:58 PDT
Reduce use of WebPageProxy::VoidCallback
Comment 1 Alex Christensen 2020-04-23 16:51:16 PDT
Created attachment 397401 [details]
Patch
Comment 2 Darin Adler 2020-04-24 11:17:19 PDT
Comment on attachment 397401 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=397401&action=review

> Source/WebKit/UIProcess/WebPageProxy.cpp:2176
> +    sendWithAsyncReply(Messages::WebPage::SetInitialFocus(forward, isKeyboardEventValid, keyboardEvent), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::setInitialFocus"_s)] () mutable {

Why does this need to be "mutable"? Same question about the various other similar cases below.

> Source/WebKit/UIProcess/WebPageProxy.h:782
> +    void focusNextFocusedElement(bool isForward, CompletionHandler<void()>&& = []() { });

I believe our coding style is to omit the () here. There are 10 or more other cases of this in this patch. I suggest removing them all.
Comment 3 Alex Christensen 2020-04-24 13:49:06 PDT
Calling a CompletionHandler deletes its callable immediately after calling, which requires it to be non-const.
Will remove unnecessary ().
Comment 4 Alex Christensen 2020-04-24 13:56:19 PDT
Created attachment 397503 [details]
Patch
Comment 5 Darin Adler 2020-04-25 11:23:14 PDT
Comment on attachment 397503 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=397503&action=review

> Source/WebKit/UIProcess/WebPageProxy.cpp:2314
> +    sendWithAsyncReply(Messages::WebPage::ExecuteEditCommandWithCallback(commandName, argument), [callbackFunction = WTFMove(callbackFunction), backgroundActivity = m_process->throttler().backgroundActivity("WebPageProxy::executeEditCommand"_s)] () mutable {

One last case of () that you didn't delete yet.
Comment 6 Alex Christensen 2020-04-27 10:08:38 PDT
Comment on attachment 397503 [details]
Patch

That is unfortunately necessary because of the mutable in C++ until http://wg21.link/P1102 is accepted.
Comment 7 EWS 2020-04-27 10:13:22 PDT
Committed r260764: <https://trac.webkit.org/changeset/260764>

All reviewed patches have been landed. Closing bug and clearing flags on attachment 397503 [details].
Comment 8 Radar WebKit Bug Importer 2020-04-27 10:14:14 PDT
<rdar://problem/62457381>