Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WebPermissionControllerProxy::Query message reply should go to correct completion handler #5984

Conversation

achristensen07
Copy link
Contributor

@achristensen07 achristensen07 commented Oct 31, 2022

@achristensen07 achristensen07 self-assigned this Oct 31, 2022
@achristensen07 achristensen07 added WebKit Local Build WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore). labels Oct 31, 2022
@achristensen07 achristensen07 force-pushed the eng/WebPermissionControllerProxyQuery-message-reply-should-go-to-correct-completion-handler branch from 723d168 to 104a36d Compare October 31, 2022 22:47
Copy link
Contributor

@szewai szewai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patch is fine for making requests non-blocking and the code simpler; but I am not sure it will fix the crash in the radar.

If we are going to make this change, maybe we should also remove m_requests (just send Query message in query())

Copy link
Contributor

@johnwilander johnwilander left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to test this?


m_requests.takeFirst().completionHandler(state);
tryProcessingRequests();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will tryProcessingRequests() become dead code now? What did it do previously?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In existing implementation, tryProcessingRequests just sends one async message for the first request in queue. If the first request has already sent message and no reply, it will return. That means one unhandled request will block the other requests in queue.
When the reply is received, the first request will be taken out of queue and tryProcessingRequests` is called to proceed next message.

We had this design because WebPermissionController used to cache permission result, which means tryProcessingRequests might handle multiple requests at a time (if the result is in the cache), and receiving one message reply (caching the result) may benefit the subsequent requests.

But we removed the cache and send message for each request now, so we can send them when request is received, and finish CompletionHandler in message reply (as in this patch). And there is not need to store the requests in m_requests.

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 2, 2022
@achristensen07 achristensen07 force-pushed the eng/WebPermissionControllerProxyQuery-message-reply-should-go-to-correct-completion-handler branch from 104a36d to c9f3c29 Compare November 3, 2022 04:32
Copy link
Contributor

@szewai szewai left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@achristensen07 achristensen07 added unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing and removed merging-blocked Applied to prevent a change from being merged labels Nov 3, 2022
…t completion handler

https://bugs.webkit.org/show_bug.cgi?id=247295
rdar://100894959

Reviewed by Sihui Liu.

* Source/WebKit/WebProcess/WebCoreSupport/WebPermissionController.cpp:
(WebKit::WebPermissionController::tryProcessingRequests):
* Source/WebKit/WebProcess/WebCoreSupport/WebPermissionController.h:

Canonical link: https://commits.webkit.org/256298@main
@webkit-early-warning-system webkit-early-warning-system force-pushed the eng/WebPermissionControllerProxyQuery-message-reply-should-go-to-correct-completion-handler branch from c9f3c29 to 0310eb3 Compare November 3, 2022 23:18
@webkit-commit-queue
Copy link
Collaborator

Committed 256298@main (0310eb3): https://commits.webkit.org/256298@main

Reviewed commits have been landed. Closing PR #5984 and removing active labels.

@webkit-early-warning-system webkit-early-warning-system merged commit 0310eb3 into WebKit:main Nov 3, 2022
@webkit-commit-queue webkit-commit-queue removed the unsafe-merge-queue Applied to send a pull request to merge-queue, but skip building and testing label Nov 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
WebKit Misc. For miscellaneous bugs in the WebKit framework (and not JavaScriptCore or WebCore).
Projects
None yet
6 participants