[webkit-changes] [WebKit/WebKit] 60aeff: Use smart pointers to store references to ObjectHeap

Alex Christensen noreply at github.com
Wed Mar 13 10:51:48 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 60aeffa2f9b8aaa7da3ae2fe2815090ca79f2e9d
      https://github.com/WebKit/WebKit/commit/60aeffa2f9b8aaa7da3ae2fe2815090ca79f2e9d
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2024-03-13 (Wed, 13 Mar 2024)

  Changed paths:
    M Source/WebCore/Modules/WebGPU/Implementation/WebGPUCompositorIntegrationImpl.cpp
    M Source/WebCore/Modules/WebGPU/Implementation/WebGPUCompositorIntegrationImpl.h
    M Source/WebCore/Modules/WebGPU/InternalAPI/WebGPUCompositorIntegration.h
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
    M Source/WebKit/GPUProcess/ShapeDetection/RemoteBarcodeDetector.cpp
    M Source/WebKit/GPUProcess/ShapeDetection/RemoteBarcodeDetector.h
    M Source/WebKit/GPUProcess/ShapeDetection/RemoteFaceDetector.cpp
    M Source/WebKit/GPUProcess/ShapeDetection/RemoteFaceDetector.h
    M Source/WebKit/GPUProcess/ShapeDetection/RemoteTextDetector.cpp
    M Source/WebKit/GPUProcess/ShapeDetection/RemoteTextDetector.h
    M Source/WebKit/GPUProcess/ShapeDetection/ShapeDetectionObjectHeap.h
    M Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroup.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroup.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroupLayout.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroupLayout.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandBuffer.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandBuffer.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandEncoder.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandEncoder.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCompositorIntegration.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCompositorIntegration.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePassEncoder.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePassEncoder.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePipeline.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePipeline.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteExternalTexture.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteExternalTexture.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePipelineLayout.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePipelineLayout.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQuerySet.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQuerySet.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQueue.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQueue.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundle.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundle.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundleEncoder.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundleEncoder.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPassEncoder.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPassEncoder.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPipeline.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPipeline.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteSampler.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteSampler.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteShaderModule.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteShaderModule.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTexture.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTexture.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTextureView.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTextureView.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/WebGPUObjectHeap.h
    M Source/WebKit/GPUProcess/mac/LocalAudioSessionRoutingArbitrator.cpp
    M Source/WebKit/GPUProcess/mac/LocalAudioSessionRoutingArbitrator.h
    M Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp
    M Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.h
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.h
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp
    M Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.h
    M Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp
    M Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h
    M Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp
    M Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.h
    M Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp
    M Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.h
    M Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.cpp
    M Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.h
    M Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp
    M Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h
    M Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp
    M Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteCompositorIntegrationProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteCompositorIntegrationProxy.h

  Log Message:
  -----------
  Use smart pointers to store references to ObjectHeap
https://bugs.webkit.org/show_bug.cgi?id=270892
rdar://124497369

Reviewed by Mike Wyrzykowski.

We expect the objects to never outlive the ObjectHeap, so use WeakRef
instead of WeakPtr.  However, the objects are ThreadSafeRefCounted,
so if something does happen and something keeps a strong reference to
the objects to keep them alive beyond the lifetime of the ObjectHeap,
we want to dereference null and crash safely instead of using a C++
reference to a freed object.

While I was at it, I did the same with all stored C++ references in
Source/WebKit/GPUProcess, and made withDisplayBufferAsNativeImage
always call its completion handler.

* Source/WebKit/GPUProcess/ShapeDetection/RemoteBarcodeDetector.h:
* Source/WebKit/GPUProcess/ShapeDetection/RemoteFaceDetector.h:
* Source/WebKit/GPUProcess/ShapeDetection/RemoteTextDetector.h:
* Source/WebKit/GPUProcess/ShapeDetection/ShapeDetectionObjectHeap.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp:
(WebKit::RemoteAdapter::destruct):
(WebKit::RemoteAdapter::requestDevice):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroup.cpp:
(WebKit::RemoteBindGroup::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroup.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroupLayout.cpp:
(WebKit::RemoteBindGroupLayout::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBindGroupLayout.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.cpp:
(WebKit::RemoteBuffer::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteBuffer.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandBuffer.cpp:
(WebKit::RemoteCommandBuffer::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandBuffer.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandEncoder.cpp:
(WebKit::RemoteCommandEncoder::destruct):
(WebKit::RemoteCommandEncoder::beginRenderPass):
(WebKit::RemoteCommandEncoder::beginComputePass):
(WebKit::RemoteCommandEncoder::copyBufferToBuffer):
(WebKit::RemoteCommandEncoder::copyBufferToTexture):
(WebKit::RemoteCommandEncoder::copyTextureToBuffer):
(WebKit::RemoteCommandEncoder::copyTextureToTexture):
(WebKit::RemoteCommandEncoder::clearBuffer):
(WebKit::RemoteCommandEncoder::writeTimestamp):
(WebKit::RemoteCommandEncoder::resolveQuerySet):
(WebKit::RemoteCommandEncoder::finish):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCommandEncoder.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCompositorIntegration.cpp:
(WebKit::RemoteCompositorIntegration::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteCompositorIntegration.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePassEncoder.cpp:
(WebKit::RemoteComputePassEncoder::destruct):
(WebKit::RemoteComputePassEncoder::setPipeline):
(WebKit::RemoteComputePassEncoder::dispatchIndirect):
(WebKit::RemoteComputePassEncoder::setBindGroup):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePassEncoder.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePipeline.cpp:
(WebKit::RemoteComputePipeline::destruct):
(WebKit::RemoteComputePipeline::getBindGroupLayout):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteComputePipeline.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp:
(WebKit::RemoteDevice::destruct):
(WebKit::RemoteDevice::createBuffer):
(WebKit::RemoteDevice::createTexture):
(WebKit::RemoteDevice::createSampler):
(WebKit::RemoteDevice::importExternalTextureFromVideoFrame):
(WebKit::RemoteDevice::createBindGroupLayout):
(WebKit::RemoteDevice::createPipelineLayout):
(WebKit::RemoteDevice::createBindGroup):
(WebKit::RemoteDevice::createShaderModule):
(WebKit::RemoteDevice::createComputePipeline):
(WebKit::RemoteDevice::createRenderPipeline):
(WebKit::RemoteDevice::createComputePipelineAsync):
(WebKit::RemoteDevice::createRenderPipelineAsync):
(WebKit::RemoteDevice::createCommandEncoder):
(WebKit::RemoteDevice::createRenderBundleEncoder):
(WebKit::RemoteDevice::createQuerySet):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteExternalTexture.cpp:
(WebKit::RemoteExternalTexture::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteExternalTexture.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePipelineLayout.cpp:
(WebKit::RemotePipelineLayout::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePipelineLayout.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.cpp:
(WebKit::RemotePresentationContext::configure):
(WebKit::RemotePresentationContext::getCurrentTexture):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemotePresentationContext.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQuerySet.cpp:
(WebKit::RemoteQuerySet::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQuerySet.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQueue.cpp:
(WebKit::RemoteQueue::destruct):
(WebKit::RemoteQueue::submit):
(WebKit::RemoteQueue::writeBuffer):
(WebKit::RemoteQueue::writeTexture):
(WebKit::RemoteQueue::copyExternalImageToTexture):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteQueue.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundle.cpp:
(WebKit::RemoteRenderBundle::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundle.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundleEncoder.cpp:
(WebKit::RemoteRenderBundleEncoder::destruct):
(WebKit::RemoteRenderBundleEncoder::setPipeline):
(WebKit::RemoteRenderBundleEncoder::setIndexBuffer):
(WebKit::RemoteRenderBundleEncoder::setVertexBuffer):
(WebKit::RemoteRenderBundleEncoder::drawIndirect):
(WebKit::RemoteRenderBundleEncoder::drawIndexedIndirect):
(WebKit::RemoteRenderBundleEncoder::setBindGroup):
(WebKit::RemoteRenderBundleEncoder::finish):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderBundleEncoder.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPassEncoder.cpp:
(WebKit::RemoteRenderPassEncoder::destruct):
(WebKit::RemoteRenderPassEncoder::setPipeline):
(WebKit::RemoteRenderPassEncoder::setIndexBuffer):
(WebKit::RemoteRenderPassEncoder::setVertexBuffer):
(WebKit::RemoteRenderPassEncoder::drawIndirect):
(WebKit::RemoteRenderPassEncoder::drawIndexedIndirect):
(WebKit::RemoteRenderPassEncoder::setBindGroup):
(WebKit::RemoteRenderPassEncoder::setBlendConstant):
(WebKit::RemoteRenderPassEncoder::executeBundles):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPassEncoder.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPipeline.cpp:
(WebKit::RemoteRenderPipeline::destruct):
(WebKit::RemoteRenderPipeline::getBindGroupLayout):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteRenderPipeline.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteSampler.cpp:
(WebKit::RemoteSampler::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteSampler.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteShaderModule.cpp:
(WebKit::RemoteShaderModule::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteShaderModule.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTexture.cpp:
(WebKit::RemoteTexture::createView):
(WebKit::RemoteTexture::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTexture.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTextureView.cpp:
(WebKit::RemoteTextureView::destruct):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteTextureView.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/WebGPUObjectHeap.h:

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



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list