[webkit-changes] [WebKit/WebKit] e6f858: [WebGPU] Make RemoteGPU owned by RemoteRenderingBa...

Myles C. Maxfield noreply at github.com
Mon Apr 17 20:00:37 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e6f858aaaea1422afde832fa05d3c227edf75247
      https://github.com/WebKit/WebKit/commit/e6f858aaaea1422afde832fa05d3c227edf75247
  Author: Myles C. Maxfield <mmaxfield at apple.com>
  Date:   2023-04-17 (Mon, 17 Apr 2023)

  Changed paths:
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.messages.in
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp

  Log Message:
  -----------
  [WebGPU] Make RemoteGPU owned by RemoteRenderingBackend rather than GPUConnectionToWebProcess
https://bugs.webkit.org/show_bug.cgi?id=255429
<rdar://problem/108171820>

Reviewed by Matt Woodrow.

This patch isn't strictly necessary, but I do think this is a better design.

Previously, every GPU object in the web process got its own identifier, and that identifier got sent to the GPU process.
The GPU process has a GPUConnectionToWebProcess for each web process, and it owned a HashMap<> of the GPU objects for
that web process.

That's okay, but it doesn't fit very well with the design of the GPU process. Every Page in the web process has an
associated RemoteRenderingBackend for that page, which is the owner of all the resources used by that page (the
RemoteRenderingBackend owns a RemoteResourceCache which contains all the resources). It's a generally better design to
match this for WebGPU, and make the GPU object owned by the RemoteRenderingBackend rather than the
GPUConnectionToWebProcess.

There are a few benefits to this design:
1. It more closely matches the ownership model for normal page drawing, which just makes it less complicated to understand
       and reason about
2. At some point, we're going to have to implement interactions with other parts of the web platform (videos, canvas 2d,
       etc.) in WebGPU. All those resources are owned by the RemoteRenderingBackend. We could have each individual entry
       point reach into the RemoteRenderingBackend to pull out what it needs, but it's a more convenient design if
       everything just already lives in the same place.

No tests because there is no behavior change.

* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:
(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::createRemoteGPU):
(WebKit::RemoteRenderingBackend::releaseRemoteGPU):
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h:
* Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp:
(WebKit::RemoteGPU::RemoteGPU):
(WebKit::RemoteGPU::initialize):
(WebKit::RemoteGPU::stopListeningForIPC):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h:
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.cpp:
(WebKit::RemoteGPUProxy::create):
(WebKit::RemoteGPUProxy::RemoteGPUProxy):
(WebKit::RemoteGPUProxy::~RemoteGPUProxy):
(WebKit::RemoteGPUProxy::initializeIPC):
(WebKit::RemoteGPUProxy::disconnectGpuProcessIfNeeded): Deleted.
(WebKit::RemoteGPUProxy::gpuProcessConnectionDidClose): Deleted.
(WebKit::RemoteGPUProxy::abandonGPUProcess): Deleted.
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteGPUProxy.h:
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::createGPUForWebGPU const):

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




More information about the webkit-changes mailing list