+2015-04-17 Tim Horton <timothy_horton@apple.com>
+
+ Clients sometimes block for 500ms in waitForPossibleGeometryUpdates
+ https://bugs.webkit.org/show_bug.cgi?id=143901
+ <rdar://problem/20488655>
+
+ Reviewed by Anders Carlsson.
+
+ * Platform/IPC/Connection.cpp:
+ (IPC::Connection::waitForMessage):
+ InterruptWaitingIfSyncMessageArrives already cancels waitForMessage if
+ a sync message arrives while waiting, but it should also avoid waiting
+ if there's a sync message already in the queue when the waiting starts,
+ as that will have the same nasty effect.
+
+ * UIProcess/mac/TiledCoreAnimationDrawingAreaProxy.mm:
+ (WebKit::TiledCoreAnimationDrawingAreaProxy::waitForPossibleGeometryUpdate):
+ If a synchronous message comes in from the Web process while we're waiting,
+ cancel our synchronous wait for DidUpdateGeometry. This will cause the size
+ change to not synchronize with the Web process' painting, but that is better
+ than pointlessly blocking for 500ms.
+
2015-04-17 Chris Dumez <cdumez@apple.com>
Possible null pointer dereference in WebDiagnosticLoggingClient::logDiagnosticMessageWithValue()
{
ASSERT(&m_clientRunLoop == &RunLoop::current());
+ bool hasIncomingSynchronousMessage = false;
+
// First, check if this message is already in the incoming messages queue.
{
std::lock_guard<std::mutex> lock(m_incomingMessagesMutex);
m_incomingMessages.remove(it);
return returnedMessage;
}
+
+ if (message->isSyncMessage())
+ hasIncomingSynchronousMessage = true;
}
}
+ // Don't even start waiting if we have InterruptWaitingIfSyncMessageArrives and there's a sync message already in the queue.
+ if (hasIncomingSynchronousMessage && waitForMessageFlags & InterruptWaitingIfSyncMessageArrives) {
+ m_waitingForMessage = nullptr;
+ return nullptr;
+ }
+
WaitForMessageState waitingForMessage(messageReceiverName, messageName, destinationID, waitForMessageFlags);
{
m_waitingForMessage = &waitingForMessage;
}
-
+
// Now wait for it to be set.
while (true) {
std::unique_lock<std::mutex> lock(m_waitForMessageMutex);
if (m_webPageProxy.process().state() != WebProcessProxy::State::Running)
return;
- m_webPageProxy.process().connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidUpdateGeometry>(m_webPageProxy.pageID(), timeout);
+ m_webPageProxy.process().connection()->waitForAndDispatchImmediately<Messages::DrawingAreaProxy::DidUpdateGeometry>(m_webPageProxy.pageID(), timeout, InterruptWaitingIfSyncMessageArrives);
}
void TiledCoreAnimationDrawingAreaProxy::colorSpaceDidChange()