Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 88b877c5ccdb356ac1be2b3614c7f167eeb14a74
      
https://github.com/WebKit/WebKit/commit/88b877c5ccdb356ac1be2b3614c7f167eeb14a74
  Author: Alex Christensen <achristen...@apple.com>
  Date:   2025-03-21 (Fri, 21 Mar 2025)

  Changed paths:
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/Platform/IPC/Connection.cpp
    M Source/WebKit/Platform/IPC/Connection.h
    M Source/WebKit/Platform/IPC/MessageSenderInlines.h
    M Source/WebKit/Platform/IPC/StreamClientConnection.h
    M Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm
    M Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
    M Source/WebKit/UIProcess/API/wpe/WPEWebViewLegacy.cpp
    M Source/WebKit/UIProcess/API/wpe/WPEWebViewPlatform.cpp
    M Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp
    M 
Source/WebKit/UIProcess/CoordinatedGraphics/DrawingAreaProxyCoordinatedGraphics.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/UIProcess/WebPageProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.messages.in
    M Source/WebKit/UIProcess/ios/WKContentViewInteraction.mm
    M Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm
    M Source/WebKit/WebProcess/WebPage/EventDispatcher.cpp
    M Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp

  Log Message:
  -----------
  sendWithAsyncReply reply lambdas should have optional Connection parameter
https://bugs.webkit.org/show_bug.cgi?id=290144
rdar://147543627

Reviewed by Chris Dumez.

When we receive IPC, we receive it from a Connection.  We already have logic in 
HandleMessage.h
that uses sfinae to add the Connection as the first parameter if the receiver 
has a Connection*
parameter, like WebPageProxy::pageScaleFactorDidChange.

This PR makes a similar mechanism for the reply of sendWithAsyncReply.  We now 
have the ability
to just put a Connection* parameter in the reply and it'll just be called with 
the connection
that sent the reply.  This allows us to message check the correct connection, 
for example.

There is an edge case when AuxiliaryProcessProxy::sendWithAsyncReply is called 
and the process
has either already terminated or it is waiting for its process to start and it 
never successfully
starts.  In this case, there is no Connection to cancel the reply with.  
Because this case is
unavoidable, I made it so we always call the completion handler with a null 
connection when we
are cancelling a reply.  At that point, even if we do have a connection, the 
connection is on
its way to its end anyways, so there is no point in message checking it and 
there's nothing else
we can do with the connection.  I made the message checks more tolerant of null 
connections too.

* Source/WebKit/Platform/IPC/Connection.cpp:
(IPC::Connection::createEmptyForAuxiliaryProcessReply):
(IPC::Connection::Connection):
(IPC::Connection::invalidate):
(IPC::Connection::sendMessageImpl):
(IPC::Connection::sendMessageWithAsyncReply):
(IPC::Connection::sendMessageWithAsyncReplyWithDispatcher):
(IPC::Connection::processIncomingMessage):
(IPC::Connection::dispatchIncomingMessageForTesting):
(IPC::Connection::dispatchOnReceiveQueueForTesting):
(IPC::Connection::dispatchMessage):
(IPC::Connection::cancelAsyncReplyHandlers):
(IPC::CompletionHandler<void):
* Source/WebKit/Platform/IPC/Connection.h:
(IPC::Connection::waitForAsyncReplyAndDispatchImmediately):
(IPC::CompletionHandler<void):
(IPC::Connection::makeAsyncReplyHandlerWithDispatcher):
(IPC::callWithConnectionAndArgsTuple):
(IPC::Connection::callReply):
(IPC::Connection::cancelReply):
(IPC::Connection::protectedConnectionQueue const): Deleted.
* Source/WebKit/Platform/IPC/MessageSenderInlines.h:
(IPC::cancelReplyWithoutUsingConnection):
(IPC::callReplyWithoutUsingConnection):
(IPC::MessageSender::sendWithAsyncReplyWithoutUsingIPCConnection const):
* Source/WebKit/Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::sendWithAsyncReply):
* Source/WebKit/Platform/IPC/cocoa/ConnectionCocoa.mm:
(IPC::Connection::platformOpen):
* Source/WebKit/UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::sendMessage):
(WebKit::AuxiliaryProcessProxy::replyToPendingMessages):
* Source/WebKit/UIProcess/Network/NetworkProcessProxy.cpp:
(WebKit::NetworkProcessProxy::getNetworkProcessConnection):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::sendGestureEvent):
(WebKit::WebPageProxy::sendPreventableTouchEvent):
(WebKit::WebPageProxy::handlePreventableTouchEvent):
(WebKit::WebPageProxy::handleTouchEvent):
(WebKit::WebPageProxy::didReceiveEvent):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
(WebKit::TiledCoreAnimationDrawingAreaProxy::dispatchPresentationCallbacksAfterFlushingLayers):
* Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::jsSendWithAsyncReply):
(WebKit::IPCTestingAPI::jsWaitForAsyncReplyAndDispatchImmediately):

Canonical link: https://commits.webkit.org/292508@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to