[webkit-changes] [WebKit/WebKit] 4f873b: RemoteRenderingBackend and GraphicsContextGL are o...

Kimmo Kinnunen noreply at github.com
Wed May 24 00:42:11 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4f873b82003414b287d074b42e02d508cc6138e0
      https://github.com/WebKit/WebKit/commit/4f873b82003414b287d074b42e02d508cc6138e0
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2023-05-24 (Wed, 24 May 2023)

  Changed paths:
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp
    M Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.cpp
    M Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h
    M Source/WebKit/Platform/IPC/StreamServerConnection.cpp
    M Source/WebKit/Platform/IPC/StreamServerConnection.h
    M Source/WebKit/Shared/IPCStreamTester.cpp
    M Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp

  Log Message:
  -----------
  RemoteRenderingBackend and GraphicsContextGL are opening the stream connection in inconsistent manner
https://bugs.webkit.org/show_bug.cgi?id=249769
rdar://103635894

Reviewed by Fujii Hironori and Mike Wyrzykowski.

Align IPC::StreamServerConnection with IPC::Connection and adjust the
callers:
 - open(dispatcher) is currently called in the dispatcher of the connection
 - open(dispatcher) takes the dispatcher as the argument instead
   of passing it in the constructor
 - invalidate() is currently called in the dispatcher of the connection

Make StreamConnectionWorkQueue a SerialFunctionDispatcher. This way it
is the dispatcher that IPC::Connection is opened in.

Open the StreamServerConnection in the RemoteRenderingBackend and
RemoteGraphicsContextGL work queues. Currently other options are not
really thread-safe.

Start receiving the messages for a particular instances in the work
queue.

Stop receiving the messages for a particular instance in the work queue.

Invalidate the StreamServerConnection in the work queue. Currently other
options are not really thread-safe.

The messages stop being processed after all receivers are removed and
invalidate() has been called.

Move the registration of StreamServerConnection to a particular work
queue to be done during StreamServerConnection::open() time. Conversely
unregister during StreamServerConnection::invalidate(). Since each
connection is only registered once, store the StreamServerConnection
list as a vector instead of a counted set.

* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::workQueueInitialize):
(WebKit::RemoteGraphicsContextGL::workQueueUninitialize):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::startListeningForIPC):
(WebKit::RemoteRenderingBackend::stopListeningForIPC):
(WebKit::RemoteRenderingBackend::workQueueInitialize):
(WebKit::RemoteRenderingBackend::workQueueUninitialize):
(WebKit::RemoteRenderingBackend::didCreateImageBufferBackend):
(WebKit::RemoteRenderingBackend::releaseResourceWithQualifiedIdentifier):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h:
(WebKit::RemoteRenderingBackend::workQueue const):
(WebKit::RemoteRenderingBackend::WTF_GUARDED_BY_LOCK): Deleted.
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp:
(WebKit::RemoteGPU::RemoteGPU):
(WebKit::RemoteGPU::initialize):
(WebKit::RemoteGPU::stopListeningForIPC):
(WebKit::RemoteGPU::workQueueInitialize):
(WebKit::RemoteGPU::workQueueUninitialize):
* Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.cpp:
(IPC::StreamConnectionWorkQueue::stopAndWaitForCompletion):
Avoid moving the thread away from the queue during stop.
Otherwise the tasks running before stop is done cannot
assert that the work queue is current.

* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::RemoteGraphicsContextGL):
(WebKit::RemoteGraphicsContextGL::workQueueInitialize):
(WebKit::RemoteGraphicsContextGL::workQueueUninitialize):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
(WebKit::RemoteRenderingBackend::stopListeningForIPC):
(WebKit::RemoteRenderingBackend::workQueueInitialize):
(WebKit::RemoteRenderingBackend::workQueueUninitialize):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp:
(WebKit::RemoteGPU::RemoteGPU):
(WebKit::RemoteGPU::workQueueInitialize):
(WebKit::RemoteGPU::workQueueUninitialize):
* Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.cpp:
(IPC::StreamConnectionWorkQueue::dispatch):
(IPC::StreamConnectionWorkQueue::addStreamConnection):
(IPC::StreamConnectionWorkQueue::removeStreamConnection):
(IPC::StreamConnectionWorkQueue::stopAndWaitForCompletion):
* Source/WebKit/Platform/IPC/StreamConnectionWorkQueue.h:
* Source/WebKit/Platform/IPC/StreamServerConnection.cpp:
(IPC::StreamServerConnection::create):
(IPC::StreamServerConnection::StreamServerConnection):
(IPC::StreamServerConnection::open):
(IPC::StreamServerConnection::invalidate):
(IPC::StreamServerConnection::startReceivingMessages):
(IPC::StreamServerConnection::stopReceivingMessages):
(IPC::StreamServerConnection::enqueueMessage):
(IPC::StreamServerConnection::didReceiveMessage):
(IPC::StreamServerConnection::didReceiveSyncMessage):
(IPC::StreamServerConnection::didClose):
(IPC::StreamServerConnection::didReceiveInvalidMessage):
(): Deleted.
* Source/WebKit/Platform/IPC/StreamServerConnection.h:
* Source/WebKit/Shared/IPCStreamTester.cpp:
(WebKit::IPCStreamTester::IPCStreamTester):
(WebKit::IPCStreamTester::initialize):
(WebKit::IPCStreamTester::stopListeningForIPC):
* Tools/TestWebKitAPI/Tests/IPC/StreamConnectionTests.cpp:
(TestWebKitAPI::TEST_F):
(TestWebKitAPI::TEST_P):

Canonical link: https://commits.webkit.org/264465@main




More information about the webkit-changes mailing list