Skip to content

Commit

Permalink
WebGL context loss does not work in workers
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=274769
rdar://128854821

Reviewed by Matt Woodrow and Mike Wyrzykowski.

WebGL in workers would not be able to restore contexts.
Before, the WebWorkerClient would store the main IPC connection
at creation time, before the worker thread was started. This was not
updated after a crash.

Instead, post a task to main thread GPUConnectionToWebProcess to obtain
the connection and other resources, such as shared object cache,
each time the connection is needed. Also obtain a weak ref to the
GPUConnectionToWebProcess that is then used to release the instance.

Make RemoteGraphicsContextGLProxy, RemoteGPUProxy and RemoteRenderingBackendProxy
all regular and use the same pattern.

Each have two create() functions:
  - ...Proxy::create(args.., Page&) for main thread instance
  - ...Proxy::create(args.., SerialFunctionDispatcher&) for worker instance

Rename createRemoteGPU to createGPU to match the other functions naming.

Pass in identifier as the first argument to the create/release messages.

Only send GPUConnectionToWebProcess::CreateRenderingBackend messages
from GPUConnectionToWebProcess.

Fixes an issue where WebGPU would not support receiving messages in
Workers, as the stream connection would get main runloop as the
dispatcher instead of the worker dispatcher.

* LayoutTests/ipc/restrictedendpoints/allow-access-webGPU.html:
* LayoutTests/ipc/restrictedendpoints/deny-access-webGPU.html:
* ManualTests/webgl/webgl-worker-context-lost-worker.js: Added.
* ManualTests/webgl/webgl-worker-context-lost.html: Added.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::maybeRestoreContext):
(WebCore::WebGLRenderingContextBase::forceContextLost):
* Source/WebKit/CMakeLists.txt:
* Source/WebKit/DerivedSources-input.xcfilelist:
* Source/WebKit/DerivedSources.make:
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:
(WebKit::GPUConnectionToWebProcess::createRenderingBackend):
(WebKit::GPUConnectionToWebProcess::createGraphicsContextGL):
(WebKit::GPUConnectionToWebProcess::releaseGraphicsContextGL):
(WebKit::GPUConnectionToWebProcess::createGPU):
(WebKit::GPUConnectionToWebProcess::releaseGPU):
(WebKit::GPUConnectionToWebProcess::createRemoteGPU): Deleted.
(WebKit::GPUConnectionToWebProcess::releaseRemoteGPU): Deleted.
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h:
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp:
(WebKit::RemoteRenderingBackend::create):
(WebKit::RemoteRenderingBackend::RemoteRenderingBackend):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendCreationParameters.h: Removed.
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendCreationParameters.serialization.in: Removed.

Remove RemoteRenderingBackendCreationParameters. It was used to pass RRB
identifier and page identifiers for debugging. The page identifiers were
not used in GPUP side at all. In WP side, the page identifiers were used
for logging only. The page identifiers are not uniquely identifying
worker instances from main thread instance. In the future, the main
thread instance cannot be bound to a single page, anyway.

* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/GPU/GPUProcessConnection.cpp:
(WebKit::GPUProcessConnection::createRenderingBackend):
(WebKit::GPUProcessConnection::releaseRenderingBackend):
(WebKit::GPUProcessConnection::createGraphicsContextGL):
(WebKit::GPUProcessConnection::releaseGraphicsContextGL):
(WebKit::GPUProcessConnection::createGPU):
(WebKit::GPUProcessConnection::releaseGPU):
* Source/WebKit/WebProcess/GPU/GPUProcessConnection.h:
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::send):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::create):
(WebKit::RemoteGraphicsContextGLProxy::RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::~RemoteGraphicsContextGLProxy):
(WebKit::RemoteGraphicsContextGLProxy::initializeIPC):
(WebKit::RemoteGraphicsContextGLProxy::waitUntilInitialized):
(WebKit::RemoteGraphicsContextGLProxy::didClose):
(WebKit::RemoteGraphicsContextGLProxy::abandonGpuProcess):
(WebKit::RemoteGraphicsContextGLProxy::disconnectGpuProcessIfNeeded):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.h:
(WebKit::RemoteGraphicsContextGLProxy::isContextLost const):
(WebKit::RemoteGraphicsContextGLProxy::send):
(WebKit::RemoteGraphicsContextGLProxy::sendSync):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.cpp:
(WebKit::RemoteImageBufferProxy::send):
(WebKit::RemoteImageBufferProxy::sendSync):
(WebKit::RemoteImageBufferProxy::ensureBackend const):
(WebKit::RemoteSerializedImageBufferProxy::RemoteSerializedImageBufferProxy):
* Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferSetProxy.cpp:
(WebKit::RemoteImageBufferSetProxy::send):
(WebKit::RemoteImageBufferSetProxy::sendSync):
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::create):
(WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy):
(WebKit::RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy):
(WebKit::RemoteRenderingBackendProxy::ensureGPUProcessConnection):
(WebKit::RemoteRenderingBackendProxy::send):
(WebKit::RemoteRenderingBackendProxy::sendSync):
(WebKit::RemoteRenderingBackendProxy::didClose):
(WebKit::RemoteRenderingBackendProxy::disconnectGPUProcess):
(WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const):
(WebKit::RemoteRenderingBackendProxy::ensureBackendCreated):
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h:
(WebKit::RemoteRenderingBackendProxy::parameters const): Deleted.
(WebKit::RemoteRenderingBackendProxy::connection): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
(WebKit::RemoteGPUProxy::create):
(WebKit::RemoteGPUProxy::RemoteGPUProxy):
(WebKit::RemoteGPUProxy::initializeIPC):
(WebKit::RemoteGPUProxy::disconnectGpuProcessIfNeeded):
(WebKit::RemoteGPUProxy::didClose):
(WebKit::RemoteGPUProxy::abandonGPUProcess):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h:
* Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/GPU/graphics/gbm/RemoteGraphicsContextGLProxyGBM.cpp:
(WebKit::RemoteGraphicsContextGLProxyGBM::RemoteGraphicsContextGLProxyGBM):
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/GPU/graphics/wc/RemoteGraphicsContextGLProxyWC.cpp:
(WebKit::RemoteGraphicsContextGLProxy::platformCreate):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createGraphicsContextGL const):
(WebKit::WebChromeClient::createGPUForWebGPU const):
* Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.cpp:
(WebKit::GPUProcessWebWorkerClient::createNestedWorkerClient):
(WebKit::GPUProcessWebWorkerClient::ensureRenderingBackend const):
(WebKit::GPUProcessWebWorkerClient::sinkIntoImageBuffer):
(WebKit::GPUProcessWebWorkerClient::createImageBuffer const):
(WebKit::GPUProcessWebWorkerClient::createGraphicsContextGL const):
(WebKit::GPUProcessWebWorkerClient::createGPUForWebGPU const):
(WebKit::WebWorkerClient::create):
(WebKit::WebWorkerClient::WebWorkerClient):
(WebKit::WebWorkerClient::createNestedWorkerClient):
(WebKit::WebWorkerClient::sinkIntoImageBuffer):
(WebKit::WebWorkerClient::createImageBuffer const):
(WebKit::WebWorkerClient::createGraphicsContextGL const):
(WebKit::WebWorkerClient::createGPUForWebGPU const):
(WebKit::WebWorkerClient::ensureRenderingBackend const): Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.h:
* Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::encodeArgument):
(WebKit::IPCTestingAPI::encodeRemoteRenderingBackendCreationParameters): Deleted.

Canonical link: https://commits.webkit.org/279694@main
  • Loading branch information
kkinnunen-apple committed Jun 4, 2024
1 parent c07095b commit b9db2e5
Show file tree
Hide file tree
Showing 33 changed files with 382 additions and 451 deletions.
9 changes: 2 additions & 7 deletions LayoutTests/ipc/restrictedendpoints/allow-access-webGPU.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
IPC.webPageProxyID,
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name,
[
{ // creationParameters
type: 'RemoteRenderingBackendCreationParameters',
identifier: renderingBackendID,
pageProxyID: IPC.webPageProxyID,
pageID: IPC.pageID,
},
{ type: 'uint64_t', value: renderingBackendID },
{
type: 'StreamServerConnectionHandle',
value: rrbStreamConnectionHandle,
Expand All @@ -39,7 +34,7 @@
var result = IPC.sendMessage(
'GPU',
IPC.webPageProxyID,
IPC.messages.GPUConnectionToWebProcess_CreateRemoteGPU.name,
IPC.messages.GPUConnectionToWebProcess_CreateGPU.name,
[
{ type: 'uint64_t', value: webGPUID }, // identifier
{ type: 'uint64_t', value: renderingBackendID }, // renderingBackendIdentifier
Expand Down
9 changes: 2 additions & 7 deletions LayoutTests/ipc/restrictedendpoints/deny-access-webGPU.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,7 @@
IPC.webPageProxyID,
IPC.messages.GPUConnectionToWebProcess_CreateRenderingBackend.name,
[
{ // creationParameters
type: 'RemoteRenderingBackendCreationParameters',
identifier: renderingBackendID,
pageProxyID: IPC.webPageProxyID,
pageID: IPC.pageID,
},
{ type: 'uint64_t', value: renderingBackendID },
{
type: 'StreamServerConnectionHandle',
value: rrbStreamConnectionHandle,
Expand All @@ -39,7 +34,7 @@
var result = IPC.sendMessage(
'GPU',
IPC.webPageProxyID,
IPC.messages.GPUConnectionToWebProcess_CreateRemoteGPU.name,
IPC.messages.GPUConnectionToWebProcess_CreateGPU.name,
[
{ type: 'uint64_t', value: webGPUID }, // identifier
{ type: 'uint64_t', value: renderingBackendID }, // renderingBackendIdentifier
Expand Down
16 changes: 16 additions & 0 deletions ManualTests/webgl/webgl-worker-context-lost-worker.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
self.addEventListener("message", (e) => {
const oc = e.data.oc;
console.log("worker support WebGL: " + oc);
let gl = oc.getContext('webgl');
oc.addEventListener("webglcontextlost", (event) => {
console.log("context lost");
event.preventDefault();
});
oc.addEventListener("webglcontextrestored", (event) => {
console.log("context restored");
gl.clearColor(0, 1, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
});
gl.clearColor(1, 0, 0, 1);
gl.clear(gl.COLOR_BUFFER_BIT);
});
12 changes: 12 additions & 0 deletions ManualTests/webgl/webgl-worker-context-lost.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<body>
<canvas id="c"></canvas>
<script>
// python3 -m http.server
// run-minibrowser --debug http://localhost:8000/webgl-worker-context-lost.html
// killall GPU.Development
// observe green
const worker = new Worker("./webgl-worker-context-lost-worker.js");
let oc = c.transferControlToOffscreen();
worker.postMessage({ oc }, [oc]);
</script>
</body>
1 change: 0 additions & 1 deletion Source/WebKit/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,6 @@ set(WebKit_SERIALIZATION_IN_FILES

GPUProcess/graphics/PathSegment.serialization.in
GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.serialization.in
GPUProcess/graphics/RemoteRenderingBackendCreationParameters.serialization.in

GPUProcess/graphics/WebGPU/RemoteGPURequestAdapterResponse.serialization.in

Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/DerivedSources-input.xcfilelist
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ $(PROJECT_DIR)/GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.se
$(PROJECT_DIR)/GPUProcess/graphics/RemoteImageBuffer.messages.in
$(PROJECT_DIR)/GPUProcess/graphics/RemoteImageBufferSet.messages.in
$(PROJECT_DIR)/GPUProcess/graphics/RemoteRenderingBackend.messages.in
$(PROJECT_DIR)/GPUProcess/graphics/RemoteRenderingBackendCreationParameters.serialization.in
$(PROJECT_DIR)/GPUProcess/graphics/WebGPU/RemoteAdapter.messages.in
$(PROJECT_DIR)/GPUProcess/graphics/WebGPU/RemoteBindGroup.messages.in
$(PROJECT_DIR)/GPUProcess/graphics/WebGPU/RemoteBindGroupLayout.messages.in
Expand Down
1 change: 0 additions & 1 deletion Source/WebKit/DerivedSources.make
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,6 @@ SERIALIZATION_DESCRIPTION_FILES = \
GPUProcess/GPUProcessSessionParameters.serialization.in \
GPUProcess/graphics/PathSegment.serialization.in \
GPUProcess/graphics/RemoteGraphicsContextGLInitializationState.serialization.in \
GPUProcess/graphics/RemoteRenderingBackendCreationParameters.serialization.in \
GPUProcess/graphics/WebGPU/RemoteGPURequestAdapterResponse.serialization.in \
GPUProcess/media/AudioTrackPrivateRemoteConfiguration.serialization.in \
GPUProcess/media/InitializationSegmentInfo.serialization.in \
Expand Down
21 changes: 10 additions & 11 deletions Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
#include "RemoteRemoteCommandListenerProxy.h"
#include "RemoteRemoteCommandListenerProxyMessages.h"
#include "RemoteRenderingBackend.h"
#include "RemoteRenderingBackendCreationParameters.h"
#include "RemoteSampleBufferDisplayLayerManager.h"
#include "RemoteSampleBufferDisplayLayerManagerMessages.h"
#include "RemoteSampleBufferDisplayLayerMessages.h"
Expand Down Expand Up @@ -659,7 +658,7 @@ RemoteImageDecoderAVFProxy& GPUConnectionToWebProcess::imageDecoderAVFProxy()
}
#endif

void GPUConnectionToWebProcess::createRenderingBackend(RemoteRenderingBackendCreationParameters&& creationParameters, IPC::StreamServerConnection::Handle&& connectionHandle)
void GPUConnectionToWebProcess::createRenderingBackend(RenderingBackendIdentifier identifier, IPC::StreamServerConnection::Handle&& connectionHandle)
{
IPC::StreamServerConnectionParameters params;
#if ENABLE(IPC_TESTING_API)
Expand All @@ -668,8 +667,8 @@ void GPUConnectionToWebProcess::createRenderingBackend(RemoteRenderingBackendCre
auto streamConnection = IPC::StreamServerConnection::tryCreate(WTFMove(connectionHandle), params);
MESSAGE_CHECK(streamConnection);

auto addResult = m_remoteRenderingBackendMap.ensure(creationParameters.identifier, [&, streamConnection = WTFMove(streamConnection)] () mutable {
return IPC::ScopedActiveMessageReceiveQueue { RemoteRenderingBackend::create(*this, WTFMove(creationParameters), streamConnection.releaseNonNull()) };
auto addResult = m_remoteRenderingBackendMap.ensure(identifier, [&, streamConnection = WTFMove(streamConnection)] () mutable {
return IPC::ScopedActiveMessageReceiveQueue { RemoteRenderingBackend::create(*this, identifier, streamConnection.releaseNonNull()) };
});
ASSERT_UNUSED(addResult, addResult.isNewEntry);
}
Expand All @@ -682,7 +681,7 @@ void GPUConnectionToWebProcess::releaseRenderingBackend(RenderingBackendIdentifi
}

#if ENABLE(WEBGL)
void GPUConnectionToWebProcess::createGraphicsContextGL(WebCore::GraphicsContextGLAttributes attributes, GraphicsContextGLIdentifier graphicsContextGLIdentifier, RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnection::Handle&& connectionHandle)
void GPUConnectionToWebProcess::createGraphicsContextGL(GraphicsContextGLIdentifier identifier, WebCore::GraphicsContextGLAttributes attributes, RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnection::Handle&& connectionHandle)
{
MESSAGE_CHECK(!isLockdownModeEnabled());

Expand All @@ -698,17 +697,17 @@ void GPUConnectionToWebProcess::createGraphicsContextGL(WebCore::GraphicsContext
auto streamConnection = IPC::StreamServerConnection::tryCreate(WTFMove(connectionHandle), params);
MESSAGE_CHECK(streamConnection);

auto addResult = m_remoteGraphicsContextGLMap.ensure(graphicsContextGLIdentifier, [&, streamConnection = WTFMove(streamConnection)] () mutable {
return IPC::ScopedActiveMessageReceiveQueue { RemoteGraphicsContextGL::create(*this, WTFMove(attributes), graphicsContextGLIdentifier, *renderingBackend, streamConnection.releaseNonNull()) };
auto addResult = m_remoteGraphicsContextGLMap.ensure(identifier, [&, streamConnection = WTFMove(streamConnection)] () mutable {
return IPC::ScopedActiveMessageReceiveQueue { RemoteGraphicsContextGL::create(*this, WTFMove(attributes), identifier, *renderingBackend, streamConnection.releaseNonNull()) };
});
ASSERT_UNUSED(addResult, addResult.isNewEntry);
}

void GPUConnectionToWebProcess::releaseGraphicsContextGL(GraphicsContextGLIdentifier graphicsContextGLIdentifier)
void GPUConnectionToWebProcess::releaseGraphicsContextGL(GraphicsContextGLIdentifier identifier)
{
MESSAGE_CHECK(!isLockdownModeEnabled());

m_remoteGraphicsContextGLMap.remove(graphicsContextGLIdentifier);
m_remoteGraphicsContextGLMap.remove(identifier);
if (m_remoteGraphicsContextGLMap.isEmpty())
protectedGPUProcess()->tryExitIfUnusedAndUnderMemoryPressure();
}
Expand Down Expand Up @@ -742,7 +741,7 @@ void GPUConnectionToWebProcess::performWithMediaPlayerOnMainThread(MediaPlayerId
}
#endif

void GPUConnectionToWebProcess::createRemoteGPU(WebGPUIdentifier identifier, RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnection::Handle&& connectionHandle)
void GPUConnectionToWebProcess::createGPU(WebGPUIdentifier identifier, RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnection::Handle&& connectionHandle)
{
MESSAGE_CHECK(isWebGPUEnabled());

Expand All @@ -764,7 +763,7 @@ void GPUConnectionToWebProcess::createRemoteGPU(WebGPUIdentifier identifier, Ren
ASSERT_UNUSED(addResult, addResult.isNewEntry);
}

void GPUConnectionToWebProcess::releaseRemoteGPU(WebGPUIdentifier identifier)
void GPUConnectionToWebProcess::releaseGPU(WebGPUIdentifier identifier)
{
bool result = m_remoteGPUMap.remove(identifier);
ASSERT_UNUSED(result, result);
Expand Down
9 changes: 4 additions & 5 deletions Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,6 @@ class UserMediaCaptureManagerProxy;
struct GPUProcessConnectionParameters;
struct MediaOverridesForTesting;
struct RemoteAudioSessionConfiguration;
struct RemoteRenderingBackendCreationParameters;

#if USE(GRAPHICS_LAYER_WC)
class RemoteWCLayerTreeHost;
Expand Down Expand Up @@ -282,16 +281,16 @@ class GPUConnectionToWebProcess
RemoteMediaRecorderManager& mediaRecorderManager();
#endif

void createRenderingBackend(RemoteRenderingBackendCreationParameters&&, IPC::StreamServerConnection::Handle&&);
void createRenderingBackend(RenderingBackendIdentifier, IPC::StreamServerConnection::Handle&&);
void releaseRenderingBackend(RenderingBackendIdentifier);

#if ENABLE(WEBGL)
void createGraphicsContextGL(WebCore::GraphicsContextGLAttributes, GraphicsContextGLIdentifier, RenderingBackendIdentifier, IPC::StreamServerConnection::Handle&&);
void createGraphicsContextGL(GraphicsContextGLIdentifier, WebCore::GraphicsContextGLAttributes, RenderingBackendIdentifier, IPC::StreamServerConnection::Handle&&);
void releaseGraphicsContextGL(GraphicsContextGLIdentifier);
#endif

void createRemoteGPU(WebGPUIdentifier, RenderingBackendIdentifier, IPC::StreamServerConnection::Handle&&);
void releaseRemoteGPU(WebGPUIdentifier);
void createGPU(WebGPUIdentifier, RenderingBackendIdentifier, IPC::StreamServerConnection::Handle&&);
void releaseGPU(WebGPUIdentifier);

void clearNowPlayingInfo();
void setNowPlayingInfo(WebCore::NowPlayingInfo&&);
Expand Down
10 changes: 5 additions & 5 deletions Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@
#if ENABLE(GPU_PROCESS)

messages -> GPUConnectionToWebProcess WantsDispatchMessage {
void CreateRenderingBackend(struct WebKit::RemoteRenderingBackendCreationParameters creationParameters, IPC::StreamServerConnectionHandle connectionHandle) AllowedWhenWaitingForSyncReply
void CreateRenderingBackend(WebKit::RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnectionHandle connectionHandle) AllowedWhenWaitingForSyncReply
void ReleaseRenderingBackend(WebKit::RenderingBackendIdentifier renderingBackendIdentifier) AllowedWhenWaitingForSyncReply
#if ENABLE(WEBGL)
[EnabledIf='isWebGLEnabled()'] void CreateGraphicsContextGL(struct WebCore::GraphicsContextGLAttributes attributes, WebKit::GraphicsContextGLIdentifier graphicsContextGLIdentifier, WebKit::RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnectionHandle serverConnection) AllowedWhenWaitingForSyncReply
[EnabledIf='isWebGLEnabled()'] void ReleaseGraphicsContextGL(WebKit::GraphicsContextGLIdentifier graphicsContextGLIdentifier) AllowedWhenWaitingForSyncReply
[EnabledIf='isWebGLEnabled()'] void CreateGraphicsContextGL(WebKit::GraphicsContextGLIdentifier identifier, struct WebCore::GraphicsContextGLAttributes attributes, WebKit::RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnectionHandle serverConnection) AllowedWhenWaitingForSyncReply
[EnabledIf='isWebGLEnabled()'] void ReleaseGraphicsContextGL(WebKit::GraphicsContextGLIdentifier identifier) AllowedWhenWaitingForSyncReply
#endif
[EnabledIf='isWebGPUEnabled()'] void CreateRemoteGPU(WebKit::WebGPUIdentifier identifier, WebKit::RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnectionHandle serverConnection) AllowedWhenWaitingForSyncReply
[EnabledIf='isWebGPUEnabled()'] void ReleaseRemoteGPU(WebKit::WebGPUIdentifier identifier) AllowedWhenWaitingForSyncReply
[EnabledIf='isWebGPUEnabled()'] void CreateGPU(WebKit::WebGPUIdentifier identifier, WebKit::RenderingBackendIdentifier renderingBackendIdentifier, IPC::StreamServerConnectionHandle serverConnection) AllowedWhenWaitingForSyncReply
[EnabledIf='isWebGPUEnabled()'] void ReleaseGPU(WebKit::WebGPUIdentifier identifier) AllowedWhenWaitingForSyncReply
void ClearNowPlayingInfo()
void SetNowPlayingInfo(struct WebCore::NowPlayingInfo nowPlayingInfo)
#if USE(AUDIO_SESSION)
Expand Down
9 changes: 4 additions & 5 deletions Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@
#include "RemoteImageBufferSet.h"
#include "RemoteMediaPlayerManagerProxy.h"
#include "RemoteMediaPlayerProxy.h"
#include "RemoteRenderingBackendCreationParameters.h"
#include "RemoteRenderingBackendMessages.h"
#include "RemoteRenderingBackendProxyMessages.h"
#include "RemoteSharedResourceCache.h"
Expand Down Expand Up @@ -104,19 +103,19 @@ bool isSmallLayerBacking(const ImageBufferParameters& parameters)
&& (parameters.pixelFormat == PixelFormat::BGRA8 || parameters.pixelFormat == PixelFormat::BGRX8);
}

Ref<RemoteRenderingBackend> RemoteRenderingBackend::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RemoteRenderingBackendCreationParameters&& creationParameters, Ref<IPC::StreamServerConnection>&& streamConnection)
Ref<RemoteRenderingBackend> RemoteRenderingBackend::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier identifier, Ref<IPC::StreamServerConnection>&& streamConnection)
{
auto instance = adoptRef(*new RemoteRenderingBackend(gpuConnectionToWebProcess, WTFMove(creationParameters), WTFMove(streamConnection)));
auto instance = adoptRef(*new RemoteRenderingBackend(gpuConnectionToWebProcess, identifier, WTFMove(streamConnection)));
instance->startListeningForIPC();
return instance;
}

RemoteRenderingBackend::RemoteRenderingBackend(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RemoteRenderingBackendCreationParameters&& creationParameters, Ref<IPC::StreamServerConnection>&& streamConnection)
RemoteRenderingBackend::RemoteRenderingBackend(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier identifier, Ref<IPC::StreamServerConnection>&& streamConnection)
: m_workQueue(IPC::StreamConnectionWorkQueue::create("RemoteRenderingBackend work queue"_s))
, m_streamConnection(WTFMove(streamConnection))
, m_gpuConnectionToWebProcess(gpuConnectionToWebProcess)
, m_sharedResourceCache(gpuConnectionToWebProcess.sharedResourceCache())
, m_renderingBackendIdentifier(creationParameters.identifier)
, m_renderingBackendIdentifier(identifier)
, m_shapeDetectionObjectHeap(ShapeDetection::ObjectHeap::create())
{
ASSERT(RunLoop::isMain());
Expand Down
6 changes: 2 additions & 4 deletions Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "MessageReceiver.h"
#include "MessageSender.h"
#include "RemoteImageBufferSetIdentifier.h"
#include "RemoteRenderingBackendCreationParameters.h"
#include "RemoteResourceCache.h"
#include "RemoteSerializedImageBufferIdentifier.h"
#include "RenderingBackendIdentifier.h"
Expand Down Expand Up @@ -83,7 +82,6 @@ class RemoteSharedResourceCache;
struct BufferIdentifierSet;
struct ImageBufferSetPrepareBufferForDisplayInputData;
struct ImageBufferSetPrepareBufferForDisplayOutputData;
struct RemoteRenderingBackendCreationParameters;
enum class SwapBuffersDisplayRequirement : uint8_t;

namespace ShapeDetection {
Expand All @@ -92,7 +90,7 @@ class ObjectHeap;

class RemoteRenderingBackend : private IPC::MessageSender, public IPC::StreamMessageReceiver, public CanMakeWeakPtr<RemoteRenderingBackend> {
public:
static Ref<RemoteRenderingBackend> create(GPUConnectionToWebProcess&, RemoteRenderingBackendCreationParameters&&, Ref<IPC::StreamServerConnection>&&);
static Ref<RemoteRenderingBackend> create(GPUConnectionToWebProcess&, RenderingBackendIdentifier, Ref<IPC::StreamServerConnection>&&);
virtual ~RemoteRenderingBackend();
void stopListeningForIPC();

Expand Down Expand Up @@ -124,7 +122,7 @@ class RemoteRenderingBackend : private IPC::MessageSender, public IPC::StreamMes
RenderingBackendIdentifier identifier() { return m_renderingBackendIdentifier; }
private:
friend class RemoteImageBufferSet;
RemoteRenderingBackend(GPUConnectionToWebProcess&, RemoteRenderingBackendCreationParameters&&, Ref<IPC::StreamServerConnection>&&);
RemoteRenderingBackend(GPUConnectionToWebProcess&, RenderingBackendIdentifier, Ref<IPC::StreamServerConnection>&&);
void startListeningForIPC();
void workQueueInitialize();
void workQueueUninitialize();
Expand Down

This file was deleted.

Loading

0 comments on commit b9db2e5

Please sign in to comment.