RESOLVED FIXED 48606
Connection::sendSyncMessage needs to dispatch incoming sync messages
https://bugs.webkit.org/show_bug.cgi?id=48606
Summary Connection::sendSyncMessage needs to dispatch incoming sync messages
Anders Carlsson
Reported 2010-10-28 18:34:42 PDT
Connection::sendSyncMessage needs to dispatch incoming sync messages
Attachments
Patch (6.13 KB, patch)
2010-10-28 18:38 PDT, Anders Carlsson
aroben: review+
Anders Carlsson
Comment 1 2010-10-28 18:38:51 PDT
Adam Roben (:aroben)
Comment 2 2010-10-28 19:12:20 PDT
Comment on attachment 72282 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=72282&action=review > WebKit2/Platform/CoreIPC/Connection.cpp:235 > - // First, check if there is a sync reply at the top of the stack. > + // First, check if we have any incoming sync messages that we need to process. > + Vector<IncomingMessage> syncMessagesReceivedWhileWaitingForSyncReply; > + m_syncMessagesReceivedWhileWaitingForSyncReply.swap(syncMessagesReceivedWhileWaitingForSyncReply); > + > + if (!syncMessagesReceivedWhileWaitingForSyncReply.isEmpty()) { > + // Make sure to unlock the mutex here because we're calling out to client code which could in turn send > + // another sync message and we don't want that to deadlock. > + m_syncReplyStateMutex.unlock(); > + > + for (size_t i = 0; i < syncMessagesReceivedWhileWaitingForSyncReply.size(); ++i) { > + IncomingMessage& message = syncMessagesReceivedWhileWaitingForSyncReply[i]; > + OwnPtr<ArgumentDecoder> arguments = message.releaseArguments(); > + > + dispatchSyncMessage(message.messageID(), arguments.get()); > + } > + m_syncReplyStateMutex.lock(); > + } > + > + // Second, check if there is a sync reply at the top of the stack. I think it would be clearer to use two separately-scoped MutexLockers instead of manually unlocking/locking. I guess you save an unlock/lock in the case where we haven't received any sync messages; maybe that's important? > WebKit2/Platform/CoreIPC/Connection.cpp:281 > + // Add this message and wake up the client thread. > + m_waitForSyncReplySemaphore.signal(); > + return; The "Add this message" part of this comment seems misplaced, since you already added it.
Anders Carlsson
Comment 3 2010-10-29 10:25:49 PDT
Note You need to log in before you can comment on or make changes to this bug.