Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: c0fbc10840e61fe3fe357f6d83a1ed99dda21489
https://github.com/WebKit/WebKit/commit/c0fbc10840e61fe3fe357f6d83a1ed99dda21489
Author: Chris Dumez <[email protected]>
Date: 2026-09-19 (Sat, 19 Sep 2026)
Changed paths:
M Source/WebKit/Platform/IPC/Connection.cpp
M Source/WebKit/Platform/IPC/Connection.h
M Source/WebKit/Scripts/IPCTestingHeaders-input.xcfilelist
M Source/WebKit/Scripts/IPCTestingHeaders-output.xcfilelist
M Tools/TestWebKitAPI/Tests/IPC/ConnectionTests.cpp
Log Message:
-----------
[IPC] Support MESSAGE_CHECK in work queue message receivers
https://bugs.webkit.org/show_bug.cgi?id=324431
Reviewed by Ben Nham.
MESSAGE_CHECK reports a failure through
Connection::markCurrentlyDispatchedMessageAsInvalid(),
which records it on the Connection. Only Connection::dispatchMessage() consumes
that state, so
the mechanism is limited to receivers running on the connection's client run
loop. Receivers
registered with addWorkQueueMessageReceiver() or addMessageReceiver(dispatcher,
...) are
dispatched through dispatchMessageReceiverMessage(), which has no equivalent
handling.
Connection-wide state cannot serve those receivers: a single connection can
dispatch on its
client run loop and on any number of receive queues at once, and dispatch nests
whenever a
handler sends sync IPC. Track it per dispatch instead, on the dispatching
thread's stack.
Connection::MessageDispatchScope is a stack-allocated RAII object kept on a
thread-local stack;
each dispatch pushes one, markCurrentlyDispatchedMessageAsInvalid() marks the
innermost scope
belonging to that connection, and whoever created the scope reports the result
once the handler
returns. dispatchMessageReceiverMessage() reports via
dispatchDidReceiveInvalidMessage(), which
already hops to the client thread.
Both dispatch paths share the scope, so dispatchMessage() no longer saves and
restores state
around each message, and m_inDispatchMessageCount goes away: the presence of a
scope is a more
precise assertion and it is per thread. Also lock m_errorString, which is
written from receive
queue threads under ENABLE(IPC_TESTING_API), and export
WorkQueueMessageReceiver.h to the IPC
testing headers so tests can implement a work queue receiver.
Test: Tools/TestWebKitAPI/Tests/IPC/ConnectionTests.cpp
* Source/WebKit/Platform/IPC/Connection.cpp:
(IPC::Connection::dispatchMessageReceiverMessage):
(IPC::Connection::dispatchMessage):
* Source/WebKit/Platform/IPC/Connection.h:
(IPC::Connection::MessageDispatchScope::MessageDispatchScope):
(IPC::Connection::MessageDispatchScope::~MessageDispatchScope):
(IPC::Connection::MessageDispatchScope::didReceiveInvalidMessage const):
(IPC::Connection::MessageDispatchScope::currentFor):
(IPC::Connection::hasErrorString const):
(IPC::Connection::setErrorString):
(IPC::Connection::takeErrorString):
(IPC::Connection::markCurrentMessageDispatchScopeAsInvalid):
(IPC::Connection::markCurrentlyDispatchedMessageAsInvalid):
* Source/WebKit/Scripts/IPCTestingHeaders-input.xcfilelist:
* Source/WebKit/Scripts/IPCTestingHeaders-output.xcfilelist:
* Tools/TestWebKitAPI/Tests/IPC/ConnectionTests.cpp:
(TestWebKitAPI::TEST_F(ConnectionTest,
WorkQueueMessageReceiverMessageCheckIsReported)):
Canonical link: https://commits.webkit.org/321450@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications