Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WebGL context loss does not work in workers
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