⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 292282 in webkit


Ignore:
Timestamp:
Apr 4, 2022, 12:53:56 AM (4 years ago)
Author:
commit-queue@webkit.org
Message:

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

Patch by Kimmo Kinnunen <kkinnunen@apple.com> 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):

Location:
trunk/Source/WebKit
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r292280 r292282  
     12022-04-04  Kimmo Kinnunen  <kkinnunen@apple.com>
     2
     3        StreamClientConnection should have waitForAndDispatchImmediately
     4        https://bugs.webkit.org/show_bug.cgi?id=238622
     5
     6        Reviewed by Simon Fraser.
     7
     8        IPC::StreamClientConnection should have the same communication methods
     9        as the IPC::Connection. The stream connection will forward
     10        the calls to underlying IPC::Connection, if needed.
     11        Add missing IPC::StreamClientConnection::waitForAndDispatchImmediately()
     12        and use it.
     13        Remove conveinence accessor methods for the IPC::Connection, as that should be
     14        accessed by accessing the stream connection in the respective classes.
     15
     16        No new tests, refactor.
     17
     18        * Platform/IPC/StreamClientConnection.h:
     19        (IPC::StreamClientConnection::waitForAndDispatchImmediately):
     20        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
     21        (WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
     22        (WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized):
     23        * WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
     24        (WebKit::RemoteGraphicsContextGLProxy::sendSync):
     25        * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
     26        (WebKit::RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend):
     27        (WebKit::RemoteRenderingBackendProxy::waitForDidFlush):
     28        (WebKit::RemoteRenderingBackendProxy::streamConnection):
     29        * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
     30        * WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
     31        (WebKit::RemoteGPUProxy::RemoteGPUProxy):
     32        (WebKit::RemoteGPUProxy::waitUntilInitialized):
     33
    1342022-04-04  Kimmo Kinnunen  <kkinnunen@apple.com>
    235
  • trunk/Source/WebKit/Platform/IPC/StreamClientConnection.h

    r291428 r292282  
    7575    template<typename T, typename U>
    7676    SendSyncResult sendSync(T&& message, typename T::Reply&&, ObjectIdentifier<U> destinationID, Timeout);
     77
     78    template<typename T, typename U>
     79    bool waitForAndDispatchImmediately(ObjectIdentifier<U> destinationID, Timeout, OptionSet<WaitForOption> = { });
     80
    7781    StreamConnectionBuffer& bufferForTesting();
    7882
     
    178182    sendProcessOutOfStreamMessage(WTFMove(*span));
    179183    return m_connection.sendSync(WTFMove(message), WTFMove(reply), destinationID.toUInt64(), timeout);
     184}
     185
     186template<typename T, typename U>
     187bool StreamClientConnection::waitForAndDispatchImmediately(ObjectIdentifier<U> destinationID, Timeout timeout, OptionSet<WaitForOption> waitForOptions)
     188{
     189    return m_connection.waitForAndDispatchImmediately<T>(destinationID, timeout, waitForOptions);
    180190}
    181191
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp

    r291902 r292282  
    5555    m_gpuProcessConnection->addClient(*this);
    5656    m_gpuProcessConnection->messageReceiverMap().addMessageReceiver(Messages::RemoteGraphicsContextGLProxy::messageReceiverName(), m_graphicsContextGLIdentifier.toUInt64(), *this);
    57     connection().send(Messages::GPUConnectionToWebProcess::CreateGraphicsContextGL(attributes, m_graphicsContextGLIdentifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
     57    m_gpuProcessConnection->connection().send(Messages::GPUConnectionToWebProcess::CreateGraphicsContextGL(attributes, m_graphicsContextGLIdentifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
    5858    // TODO: We must wait until initialized, because at the moment we cannot receive IPC messages
    5959    // during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211.
     
    315315    if (m_didInitialize)
    316316        return;
    317     if (connection().waitForAndDispatchImmediately<Messages::RemoteGraphicsContextGLProxy::WasCreated>(m_graphicsContextGLIdentifier, defaultSendTimeout))
     317    if (m_streamConnection.waitForAndDispatchImmediately<Messages::RemoteGraphicsContextGLProxy::WasCreated>(m_graphicsContextGLIdentifier, defaultSendTimeout))
    318318        return;
    319319    markContextLost();
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h

    r291749 r292282  
    343343        return m_streamConnection.sendSync(WTFMove(message), WTFMove(reply), m_graphicsContextGLIdentifier, defaultSendTimeout);
    344344    }
    345     IPC::Connection& connection() const { return m_gpuProcessConnection->connection(); }
    346345
    347346    GraphicsContextGLIdentifier m_graphicsContextGLIdentifier { GraphicsContextGLIdentifier::generate() };
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp

    r292143 r292282  
    8686}
    8787
    88 IPC::Connection& RemoteRenderingBackendProxy::gpuProcessConnection()
    89 {
    90     return ensureGPUProcessConnection().connection();
    91 }
    92 
    9388void RemoteRenderingBackendProxy::gpuProcessConnectionDidClose(GPUProcessConnection& previousConnection)
    9489{
     
    108103RemoteRenderingBackendProxy::DidReceiveBackendCreationResult RemoteRenderingBackendProxy::waitForDidCreateImageBufferBackend()
    109104{
    110     if (!gpuProcessConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateImageBufferBackend>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives))
     105    if (!streamConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateImageBufferBackend>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives))
    111106        return DidReceiveBackendCreationResult::TimeoutOrIPCFailure;
    112107    return DidReceiveBackendCreationResult::ReceivedAnyResponse;
     
    115110bool RemoteRenderingBackendProxy::waitForDidFlush()
    116111{
    117     return gpuProcessConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidFlush>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
     112    return streamConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidFlush>(renderingBackendIdentifier(), 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
    118113}
    119114
     
    418413    ensureGPUProcessConnection();
    419414    if (UNLIKELY(m_needsWakeUpSemaphoreForDisplayListStream))
    420         gpuProcessConnection().waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateWakeUpSemaphoreForDisplayListStream>(renderingBackendIdentifier(), 3_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
     415        m_streamConnection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::DidCreateWakeUpSemaphoreForDisplayListStream>(renderingBackendIdentifier(), 3_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives);
    421416    return *m_streamConnection;
    422417}
  • trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h

    r291733 r292282  
    162162
    163163    GPUProcessConnection& ensureGPUProcessConnection();
    164     IPC::Connection& gpuProcessConnection();
    165164
    166165    // Returns std::nullopt if no update is needed or allocation failed.
  • trunk/Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp

    r291323 r292282  
    5151    m_gpuProcessConnection->addClient(*this);
    5252    m_gpuProcessConnection->messageReceiverMap().addMessageReceiver(Messages::RemoteGPUProxy::messageReceiverName(), identifier.toUInt64(), *this);
    53     connection().send(Messages::GPUConnectionToWebProcess::CreateRemoteGPU(identifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
     53    m_gpuProcessConnection->connection().send(Messages::GPUConnectionToWebProcess::CreateRemoteGPU(identifier, renderingBackend, m_streamConnection.streamBuffer()), 0, IPC::SendOption::DispatchMessageEvenWhenWaitingForSyncReply);
    5454    // TODO: We must wait until initialized, because at the moment we cannot receive IPC messages
    5555    // during wait while in synchronous stream send. Should be fixed as part of https://bugs.webkit.org/show_bug.cgi?id=217211.
     
    8686    if (m_didInitialize)
    8787        return;
    88     if (connection().waitForAndDispatchImmediately<Messages::RemoteGPUProxy::WasCreated>(m_backing, defaultSendTimeout))
     88    if (m_streamConnection.waitForAndDispatchImmediately<Messages::RemoteGPUProxy::WasCreated>(m_backing, defaultSendTimeout))
    8989        return;
    9090    m_lost = true;
Note: See TracChangeset for help on using the changeset viewer.