Skip to content
Permalink
Browse files
Make sure AuxiliaryProcessProxy::sendMessage() is called on the main …
…thread

https://bugs.webkit.org/show_bug.cgi?id=224448

Reviewed by Geoffrey Garen.

Make sure AuxiliaryProcessProxy::sendMessage() is called on the main thread. This is a follow-up to
Bug 224377 but for trunk.

* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::sendMessage):
(WebKit::AuxiliaryProcessProxy::didFinishLaunching):
(WebKit::AuxiliaryProcessProxy::replyToPendingMessages):


Canonical link: https://commits.webkit.org/236407@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@275839 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
cdumez committed Apr 12, 2021
1 parent c8708fe commit 17c44dcb9d4310f21f893f1980ee4670b06ba1ef
Showing 2 changed files with 18 additions and 10 deletions.
@@ -1,3 +1,18 @@
2021-04-12 Chris Dumez <cdumez@apple.com>

Make sure AuxiliaryProcessProxy::sendMessage() is called on the main thread
https://bugs.webkit.org/show_bug.cgi?id=224448

Reviewed by Geoffrey Garen.

Make sure AuxiliaryProcessProxy::sendMessage() is called on the main thread. This is a follow-up to
Bug 224377 but for trunk.

* UIProcess/AuxiliaryProcessProxy.cpp:
(WebKit::AuxiliaryProcessProxy::sendMessage):
(WebKit::AuxiliaryProcessProxy::didFinishLaunching):
(WebKit::AuxiliaryProcessProxy::replyToPendingMessages):

2021-04-12 Ada Chan <ada.chan@apple.com>

Initial implementation of WebChromeClient::enumerateImmersiveXRDevices() and XRDeviceProxy
@@ -160,14 +160,7 @@ bool AuxiliaryProcessProxy::wasTerminated() const

bool AuxiliaryProcessProxy::sendMessage(UniqueRef<IPC::Encoder>&& encoder, OptionSet<IPC::SendOption> sendOptions, Optional<std::pair<CompletionHandler<void(IPC::Decoder*)>, uint64_t>>&& asyncReplyInfo, ShouldStartProcessThrottlerActivity shouldStartProcessThrottlerActivity)
{
// FIXME: We should turn this into a RELEASE_ASSERT().
ASSERT(isMainRunLoop());
if (!isMainRunLoop()) {
callOnMainRunLoop([protectedThis = makeRef(*this), encoder = WTFMove(encoder), sendOptions, asyncReplyInfo = WTFMove(asyncReplyInfo), shouldStartProcessThrottlerActivity]() mutable {
protectedThis->sendMessage(WTFMove(encoder), sendOptions, WTFMove(asyncReplyInfo), shouldStartProcessThrottlerActivity);
});
return true;
}
RELEASE_ASSERT(isMainRunLoop());

if (asyncReplyInfo && canSendMessage() && shouldStartProcessThrottlerActivity == ShouldStartProcessThrottlerActivity::Yes) {
auto completionHandler = std::exchange(asyncReplyInfo->first, nullptr);
@@ -235,7 +228,7 @@ bool AuxiliaryProcessProxy::dispatchSyncMessage(IPC::Connection& connection, IPC
void AuxiliaryProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection::Identifier connectionIdentifier)
{
ASSERT(!m_connection);
ASSERT(isMainRunLoop());
RELEASE_ASSERT(isMainRunLoop());

if (!IPC::Connection::identifierIsValid(connectionIdentifier))
return;
@@ -256,7 +249,7 @@ void AuxiliaryProcessProxy::didFinishLaunching(ProcessLauncher*, IPC::Connection

void AuxiliaryProcessProxy::replyToPendingMessages()
{
ASSERT(isMainRunLoop());
RELEASE_ASSERT(isMainRunLoop());
for (auto& pendingMessage : std::exchange(m_pendingMessages, { })) {
if (pendingMessage.asyncReplyInfo)
pendingMessage.asyncReplyInfo->first(nullptr);

0 comments on commit 17c44dc

Please sign in to comment.