We should have a flag on waitForAndDispatchImmediately that makes it bail immediately if a sync message comes in from the other direction. For example: 1. UI process is waitForAndDispatchImmediatelying, waiting for message X from the Web process 2. Web process timer fires, sends sync message Y to the UI process. Y won't return until the UI process main thread gets a chance to run, but it's currently waiting. <a long time goes by with both processes doing nothing useful> 3. *Eventually* we hit the waitForAndDispatchImmediately timeout, and everything proceeds normally from there. Instead: 1. UI process is waitForAndDispatchImmediatelying, waiting for message X from the Web process 2. Web process timer fires, sends sync message Y to the UI process. 3. The waitForAndDispatchImmediately on message X bails immediately. 4. Message Y is handled. <a long time didn't have to go by>
Created attachment 232833 [details] patch
Created attachment 232834 [details] patch
Comment on attachment 232834 [details] patch View in context: https://bugs.webkit.org/attachment.cgi?id=232834&action=review > Source/WebKit2/Platform/IPC/Connection.cpp:392 > + WaitForMessageInfo waitingForMessage(messageReceiverName, messageName, destinationID, flags); There's still no run loop assertion here! > Source/WebKit2/Platform/IPC/Connection.h:172 > + template<typename T> bool waitForAndDispatchImmediately(uint64_t destinationID, std::chrono::milliseconds timeout, WaitForMessageFlags = (WaitForMessageFlags)0); Please use an unsigned instead of the cast. > Source/WebKit2/Platform/IPC/Connection.h:280 > + struct WaitForMessageInfo { > + WaitForMessageInfo(StringReference messageReceiverName, StringReference messageName, uint64_t destinationID, WaitForMessageFlags flags) > + : messageReceiverName(messageReceiverName) > + , messageName(messageName) > + , destinationID(destinationID) > + , waitForMessageFlags(flags) > + { } > + > + StringReference messageReceiverName; > + StringReference messageName; > + uint64_t destinationID; > + > + WaitForMessageFlags waitForMessageFlags; > + bool messageWaitingInterrupted = false; > + > + std::unique_ptr<MessageDecoder> decoder; > + }; > + > + WaitForMessageInfo* m_waitingForMessage; I think you can forward declare this and just stick it in the .cpp file. Maybe call it WaitForMessageState?
Created attachment 232891 [details] anders changes
Comment on attachment 232891 [details] anders changes View in context: https://bugs.webkit.org/attachment.cgi?id=232891&action=review > Source/WebKit2/Platform/IPC/Connection.cpp:45 > + { } Newline after { > Source/WebKit2/Platform/IPC/Connection.cpp:428 > + std::unique_ptr<MessageDecoder> decoder = std::move(m_waitingForMessage->decoder); auto decoder =
http://trac.webkit.org/changeset/169825