[webkit-changes] [WebKit/WebKit] 9fb944: WebGL is available in webworker but not available ...

Kimmo Kinnunen noreply at github.com
Mon Jan 8 08:07:22 PST 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9fb944e082ca85e9c509d60d879e898476822bd8
      https://github.com/WebKit/WebKit/commit/9fb944e082ca85e9c509d60d879e898476822bd8
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-01-08 (Mon, 08 Jan 2024)

  Changed paths:
    M LayoutTests/platform/glib/TestExpectations
    A LayoutTests/webgl/resources/webgl-nested-worker.js
    A LayoutTests/webgl/resources/webgl-worker.js
    A LayoutTests/webgl/webgl-worker-expected.txt
    A LayoutTests/webgl/webgl-worker.html
    M Source/WebCore/page/WorkerClient.h
    M Source/WebCore/workers/WorkerMessagingProxy.cpp
    M Source/WebCore/workers/WorkerThread.h
    M Source/WebKit/Shared/WTFArgumentCoders.serialization.in
    M Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RenderingBackendIdentifier.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.h
    M Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp

  Log Message:
  -----------
  WebGL is available in webworker but not available in sub webworker
https://bugs.webkit.org/show_bug.cgi?id=266825
rdar://120279728

Reviewed by Matt Woodrow.

WorkerThread::setWorkerClient()
WorkerThread::m_workerClient
WorkerThread::workerClient()
These were part of constructor argument-like property used to store a
WorkerClient to WorkerThread::m_workerClient. The instance would be
moved from the WorkerThread to WorkerGlobalScope when WorkerGlobalScope
was instantiated. When creating a nested worker, the worker client used
as factory was looked up via
`parentWorkerGlobalScope->thread().workerClient()`. This was invalid, as
the property was always nullptr, since the parentWorkerGlobalScope is
the scope created by its thread and thus the property was moved to the
global scope. The intended accessor call was
`parentWorkerGlobalScope->workerClient()`.

Fix by calling the intended function and removing the errorneous
`WorkerThread::workerClient()`, as that is not needed.

WebWorkerClient would store
RemoteRenderingBackendCreationParameters. This is redundant, as the
intention is to not store the future RRB identifier. Instead, the
identifier should be generated when the instance is created. Otherwise
all nested WebWorkerClients would use the identifier genererated for the
top-level Worker. This would cause two RRB instantiations with same
identifier and thus assertions in GPUP.

Fix by storing just the page identifiers and generating the RRB
indentifier upon instantiation.

RenderingBackendIdentifier was not thread-safe, generation would assert
in nested Worker.

Fix by using AtomicObjectIdentifier, as the new id generation for a
nested Worker happens in the parent Worker, running in its own thread.

* LayoutTests/webgl/resources/webgl-nested-worker.js: Added.
* LayoutTests/webgl/resources/webgl-worker.js: Added.
* LayoutTests/webgl/webgl-worker-expected.txt: Added.
* LayoutTests/webgl/webgl-worker.html: Added.
* Source/WebCore/page/WorkerClient.h:
* Source/WebCore/workers/WorkerMessagingProxy.cpp:
(WebCore::WorkerMessagingProxy::startWorkerGlobalScope):
* Source/WebCore/workers/WorkerThread.h:
(WebCore::WorkerThread::setWorkerClient):
(WebCore::WorkerThread::workerClient): Deleted.
* Source/WebKit/Shared/WTFArgumentCoders.serialization.in:
* Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp:
(WebKit::RemoteRenderingBackendProxy::create):
* Source/WebKit/WebProcess/GPU/graphics/RenderingBackendIdentifier.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createWorkerClient):
* Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.cpp:
(WebKit::WebWorkerClient::create):
(WebKit::WebWorkerClient::WebWorkerClient):
(WebKit::WebWorkerClient::ensureRenderingBackend const):
(WebKit::WebWorkerClient::createNestedWorkerClient):
(WebKit::WebWorkerClient::clone): Deleted.
* Source/WebKit/WebProcess/WebCoreSupport/WebWorkerClient.h:
* Source/WebKit/WebProcess/WebPage/IPCTestingAPI.cpp:
(WebKit::IPCTestingAPI::getObjectIdentifierFromProperty):
(WebKit::IPCTestingAPI::encodeRemoteRenderingBackendCreationParameters):

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




More information about the webkit-changes mailing list