Title: [292282] trunk/Source/WebKit
Revision
292282
Author
[email protected]
Date
2022-04-04 00:53:56 -0700 (Mon, 04 Apr 2022)

Log Message

StreamClientConnection should have waitForAndDispatchImmediately
https://bugs.webkit.org/show_bug.cgi?id=238622

Patch by Kimmo Kinnunen <[email protected]> on 2022-04-04
Reviewed by Simon Fraser.

IPC::StreamClientConnection should have the same communication methods
as the IPC::Connection. The stream connection will forward
the calls to underlying IPC::Connection, if needed.
Add missing IPC::StreamClientConnection::waitForAndDispatchImmediately()
and use it.
Remove conveinence accessor methods for the IPC::Connection, as that should be
accessed by accessing the stream connection in the respective classes.

No new tests, refactor.

* Platform/IPC/StreamClientConnection.h:
(IPC::StreamClientConnection::waitForAndDispatchImmediately):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized):
* WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
(WebKit::RemoteGraphicsContextGLProxy::sendSync):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
(WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
(WebKit::RemoteRenderingBackendProxy::streamConnection):
* WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
* WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
(WebKit::RemoteGPUProxy::RemoteGPUProxy):
(WebKit::RemoteGPUProxy::waitUntilInitialized):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (292281 => 292282)


--- trunk/Source/WebKit/ChangeLog	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/ChangeLog	2022-04-04 07:53:56 UTC (rev 292282)
@@ -1,5 +1,38 @@
 2022-04-04  Kimmo Kinnunen  <[email protected]>
 
+        StreamClientConnection should have waitForAndDispatchImmediately
+        https://bugs.webkit.org/show_bug.cgi?id=238622
+
+        Reviewed by Simon Fraser.
+
+        IPC::StreamClientConnection should have the same communication methods
+        as the IPC::Connection. The stream connection will forward
+        the calls to underlying IPC::Connection, if needed.
+        Add missing IPC::StreamClientConnection::waitForAndDispatchImmediately()
+        and use it.
+        Remove conveinence accessor methods for the IPC::Connection, as that should be
+        accessed by accessing the stream connection in the respective classes.
+
+        No new tests, refactor.
+
+        * Platform/IPC/StreamClientConnection.h:
+        (IPC::StreamClientConnection::waitForAndDispatchImmediately):
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
+        (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
+        (WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized):
+        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
+        (WebKit::RemoteGraphicsContextGLProxy::sendSync):
+        * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
+        (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
+        (WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
+        (WebKit::RemoteRenderingBackendProxy::streamConnection):
+        * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
+        * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
+        (WebKit::RemoteGPUProxy::RemoteGPUProxy):
+        (WebKit::RemoteGPUProxy::waitUntilInitialized):
+
+2022-04-04  Kimmo Kinnunen  <[email protected]>
+
         IPC::StreamServerConnectionBase has only one subclass, it should be removed
         https://bugs.webkit.org/show_bug.cgi?id=238676
 

Modified: trunk/Source/WebKit/Platform/IPC/StreamClientConnection.h (292281 => 292282)


--- trunk/Source/WebKit/Platform/IPC/StreamClientConnection.h	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/Platform/IPC/StreamClientConnection.h	2022-04-04 07:53:56 UTC (rev 292282)
@@ -74,6 +74,10 @@
     using SendSyncResult = Connection::SendSyncResult;
     template<typename T, typename U>
     SendSyncResult sendSync(T&& message, typename T::Reply&&, ObjectIdentifier<U> destinationID, Timeout);
+
+    template<typename T, typename U>
+    bool waitForAndDispatchImmediately(ObjectIdentifier<U> destinationID, Timeout, OptionSet<WaitForOption> = { });
+
     StreamConnectionBuffer& bufferForTesting();
 
 private:
@@ -179,6 +183,12 @@
     return m_connection.sendSync(WTFMove(message), WTFMove(reply), destinationID.toUInt64(), timeout);
 }
 
+template<typename T, typename U>
+bool StreamClientConnection::waitForAndDispatchImmediately(ObjectIdentifier<U> destinationID, Timeout timeout, OptionSet<WaitForOption> waitForOptions)
+{
+    return m_connection.waitForAndDispatchImmediately<T>(destinationID, timeout, waitForOptions);
+}
+
 template<typename T>
 std::optional<StreamClientConnection::SendSyncResult> StreamClientConnection::trySendSyncStream(T& message, typename T::Reply& reply, Timeout timeout, Span& span)
 {

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp (292281 => 292282)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp	2022-04-04 07:53:56 UTC (rev 292282)
@@ -54,7 +54,7 @@
 {
     m_gpuProcessConnection->addClient(*this);
     m_gpuProcessConnection->messageReceiverMap().addMessageReceiver(Messages::RemoteGraphicsContextGLProxy::messageReceiverName(), m_graphicsContextGLIdentifier.toUInt64(), *this);
-    connection().send(Messages::GPUConnectionToWebProcess::CreateGraphicsContextGL(attributes, m_graphicsContextGLIdentifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
+    m_gpuProcessConnection->connection().send(Messages::GPUConnectionToWebProcess::CreateGraphicsContextGL(attributes, m_graphicsContextGLIdentifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
     // TODO: We must wait until initialized, because at the moment we cannot receive IPC messages
     // during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211.
     waitUntilInitialized();
@@ -314,7 +314,7 @@
         return;
     if (m_didInitialize)
         return;
-    if (connection().waitForAndDispatchImmediately<Messages::RemoteGraphicsContextGLProxy::WasCreated>(m_graphicsContextGLIdentifier, defaultSendTimeout))
+    if (m_streamConnection.waitForAndDispatchImmediately<Messages::RemoteGraphicsContextGLProxy::WasCreated>(m_graphicsContextGLIdentifier, defaultSendTimeout))
         return;
     markContextLost();
 }

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h (292281 => 292282)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h	2022-04-04 07:53:56 UTC (rev 292282)
@@ -342,7 +342,6 @@
     {
         return m_streamConnection.sendSync(WTFMove(message), WTFMove(reply), m_graphicsContextGLIdentifier, defaultSendTimeout);
     }
-    IPC::Connection& connection() const { return m_gpuProcessConnection->connection(); }
 
     GraphicsContextGLIdentifier m_graphicsContextGLIdentifier { GraphicsContextGLIdentifier::generate() };
 private:

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (292281 => 292282)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-04-04 07:53:56 UTC (rev 292282)
@@ -85,11 +85,6 @@
     return *m_gpuProcessConnection;
 }
 
-IPC::Connection& RemoteRenderingBackendProxy::gpuProcessConnection()
-{
-    return ensureGPUProcessConnection().connection();
-}
-
 void RemoteRenderingBackendProxy::gpuProcessConnectionDidClose(GPUProcessConnection& previousConnection)
 {
     previousConnection.removeClient(*this);
@@ -107,7 +102,7 @@
 
 RemoteRenderingBackendProxy::DidReceiveBackendCreationResult RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend()
 {
-    if (!gpuProcessConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateImageBufferBackend>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives))
+    if (!streamConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateImageBufferBackend>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives))
         return DidReceiveBackendCreationResult::TimeoutOrIPCFailure;
     return DidReceiveBackendCreationResult::ReceivedAnyResponse;
 }
@@ -114,7 +109,7 @@
 
 bool RemoteRenderingBackendProxy::waitForDidFlush()
 {
-    return gpuProcessConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidFlush>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
+    return streamConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidFlush>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
 }
 
 void RemoteRenderingBackendProxy::createRemoteImageBuffer(ImageBuffer& imageBuffer)
@@ -417,7 +412,7 @@
 {
     ensureGPUProcessConnection();
     if (UNLIKELY(m_needsWakeUpSemaphoreForDisplayListStream))
-        gpuProcessConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateWakeUpSemaphoreForDisplayListStream>(renderingBackendIdentifier(), 3_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
+        m_streamConnection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateWakeUpSemaphoreForDisplayListStream>(renderingBackendIdentifier(), 3_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
     return *m_streamConnection;
 }
 

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h (292281 => 292282)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h	2022-04-04 07:53:56 UTC (rev 292282)
@@ -161,7 +161,6 @@
     void gpuProcessConnectionDidClose(GPUProcessConnection&) final;
 
     GPUProcessConnection& ensureGPUProcessConnection();
-    IPC::Connection& gpuProcessConnection();
 
     // Returns std::nullopt if no update is needed or allocation failed.
     // Returns handle if that should be sent to the receiver process.

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp (292281 => 292282)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp	2022-04-04 07:36:38 UTC (rev 292281)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp	2022-04-04 07:53:56 UTC (rev 292282)
@@ -50,7 +50,7 @@
 {
     m_gpuProcessConnection->addClient(*this);
     m_gpuProcessConnection->messageReceiverMap().addMessageReceiver(Messages::RemoteGPUProxy::messageReceiverName(), identifier.toUInt64(), *this);
-    connection().send(Messages::GPUConnectionToWebProcess::CreateRemoteGPU(identifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
+    m_gpuProcessConnection->connection().send(Messages::GPUConnectionToWebProcess::CreateRemoteGPU(identifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
     // TODO: We must wait until initialized, because at the moment we cannot receive IPC messages
     // during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211.
     waitUntilInitialized();
@@ -85,7 +85,7 @@
 {
     if (m_didInitialize)
         return;
-    if (connection().waitForAndDispatchImmediately<Messages::RemoteGPUProxy::WasCreated>(m_backing, defaultSendTimeout))
+    if (m_streamConnection.waitForAndDispatchImmediately<Messages::RemoteGPUProxy::WasCreated>(m_backing, defaultSendTimeout))
         return;
     m_lost = true;
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to