[webkit-changes] [WebKit/WebKit] dec125: Refine smart pointer use in GPU process

Alex Christensen noreply at github.com
Thu Mar 14 01:39:22 PDT 2024


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

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/fast/webgpu/write-to-destroyed-buffer.html
    M Source/WTF/wtf/WeakPtr.h
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp
    M Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp
    M Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h
    M Source/WebKit/GPUProcess/graphics/WebGPU/WebGPUObjectHeap.cpp
    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/RemoteAudioHardwareListenerProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteAudioHardwareListenerProxy.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/RemoteAudioTrackProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteAudioTrackProxy.h
    M Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.h
    M Source/WebKit/GPUProcess/media/RemoteCDMInstanceProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.h
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h
    M Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.h
    M Source/WebKit/GPUProcess/media/RemoteRemoteCommandListenerProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteRemoteCommandListenerProxy.h
    M Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h
    M Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.h
    M Source/WebKit/GPUProcess/media/RemoteVideoTrackProxy.cpp
    M Source/WebKit/GPUProcess/media/RemoteVideoTrackProxy.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

  Log Message:
  -----------
  Refine smart pointer use in GPU process
https://bugs.webkit.org/show_bug.cgi?id=270961
rdar://124589610

Reviewed by Kimmo Kinnunen.

RemoteGPU and WebGPU::ObjectHeap are used exclusively on a non-main thread, but they are
constructed on the main thread.  Introduce WeakPtrFactory::prepareForUseOnlyOnNonMainThread
to make this safe use of WeakRef and WeakPtr not assert.

GPUConnectionToWebProcess is ThreadSafeRefCounted and used on main and non-main threads.
Use ThreadSafeWeakPtr for all weak references to it.  This added a lot of null checks where possible.

* LayoutTests/TestExpectations:
* LayoutTests/fast/webgpu/write-to-destroyed-buffer.html:
* Source/WTF/wtf/WeakPtr.h:
(WTF::WeakPtrFactory::prepareForUseOnlyOnNonMainThread):
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp:
* Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h:
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.cpp:
(WebKit::RemoteAdapter::requestDevice):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteAdapter.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.cpp:
(WebKit::RemoteDevice::importExternalTextureFromVideoFrame):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteDevice.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.cpp:
(WebKit::RemoteGPU::RemoteGPU):
(WebKit::RemoteGPU::requestAdapter):
* Source/WebKit/GPUProcess/graphics/WebGPU/RemoteGPU.h:
* Source/WebKit/GPUProcess/graphics/WebGPU/WebGPUObjectHeap.cpp:
(WebKit::WebGPU::ObjectHeap::ObjectHeap):
* Source/WebKit/GPUProcess/mac/LocalAudioSessionRoutingArbitrator.cpp:
(WebKit::LocalAudioSessionRoutingArbitrator::beginRoutingArbitrationWithCategory):
(WebKit::LocalAudioSessionRoutingArbitrator::leaveRoutingAbritration):
(WebKit::LocalAudioSessionRoutingArbitrator::logger):
(WebKit::LocalAudioSessionRoutingArbitrator::canLog const):
* Source/WebKit/GPUProcess/mac/LocalAudioSessionRoutingArbitrator.h:
* Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.cpp:
(WebKit::RemoteAudioDestinationManager::createAudioDestination):
(WebKit::RemoteAudioDestinationManager::deleteAudioDestination):
(WebKit::RemoteAudioDestinationManager::startAudioDestination):
(WebKit::RemoteAudioDestinationManager::stopAudioDestination):
* Source/WebKit/GPUProcess/media/RemoteAudioDestinationManager.h:
* Source/WebKit/GPUProcess/media/RemoteAudioHardwareListenerProxy.cpp:
(WebKit::RemoteAudioHardwareListenerProxy::audioHardwareDidBecomeActive):
(WebKit::RemoteAudioHardwareListenerProxy::audioHardwareDidBecomeInactive):
(WebKit::RemoteAudioHardwareListenerProxy::audioOutputDeviceChanged):
* Source/WebKit/GPUProcess/media/RemoteAudioHardwareListenerProxy.h:
* Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.cpp:
(WebKit::RemoteAudioSessionProxy::gpuConnectionToWebProcess const):
(WebKit::RemoteAudioSessionProxy::processIdentifier):
(WebKit::RemoteAudioSessionProxy::audioSessionManager):
(WebKit::RemoteAudioSessionProxy::allowTestOnlyIPC):
(WebKit::RemoteAudioSessionProxy::connection):
(WebKit::RemoteAudioSessionProxy::triggerBeginInterruptionForTesting):
(WebKit::RemoteAudioSessionProxy::triggerEndInterruptionForTesting):
* Source/WebKit/GPUProcess/media/RemoteAudioSessionProxy.h:
* Source/WebKit/GPUProcess/media/RemoteAudioSessionProxyManager.cpp:
(WebKit::RemoteAudioSessionProxyManager::updatePresentingProcesses):
* Source/WebKit/GPUProcess/media/RemoteAudioTrackProxy.cpp:
(WebKit::RemoteAudioTrackProxy::RemoteAudioTrackProxy):
(WebKit::RemoteAudioTrackProxy::configurationChanged):
* Source/WebKit/GPUProcess/media/RemoteAudioTrackProxy.h:
* Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.cpp:
(WebKit::RemoteCDMFactoryProxy::removeInstance):
(WebKit::RemoteCDMFactoryProxy::logger const):
* Source/WebKit/GPUProcess/media/RemoteCDMFactoryProxy.h:
* Source/WebKit/GPUProcess/media/RemoteCDMInstanceProxy.cpp:
(WebKit::RemoteCDMInstanceProxy::unrequestedInitializationDataReceived):
* Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp:
(WebKit::RemoteCDMInstanceSessionProxy::updateKeyStatuses):
(WebKit::RemoteCDMInstanceSessionProxy::sendMessage):
(WebKit::RemoteCDMInstanceSessionProxy::sessionIdChanged):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::deleteDecoder):
(WebKit::RemoteImageDecoderAVFProxy::encodedDataStatusChanged):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.cpp:
(WebKit::RemoteLegacyCDMFactoryProxy::clear):
(WebKit::RemoteLegacyCDMFactoryProxy::addProxy):
(WebKit::RemoteLegacyCDMFactoryProxy::removeProxy):
(WebKit::RemoteLegacyCDMFactoryProxy::addSession):
(WebKit::RemoteLegacyCDMFactoryProxy::removeSession):
(WebKit::RemoteLegacyCDMFactoryProxy::logger const):
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMFactoryProxy.h:
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMProxy.cpp:
(WebKit::RemoteLegacyCDMProxy::cdmMediaPlayer const):
* Source/WebKit/GPUProcess/media/RemoteLegacyCDMSessionProxy.cpp:
(WebKit::RemoteLegacyCDMSessionProxy::sendMessage):
(WebKit::RemoteLegacyCDMSessionProxy::sendError):
(WebKit::RemoteLegacyCDMSessionProxy::mediaKeysStorageDirectory const):
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp:
(WebKit::RemoteMediaPlayerManagerProxy::createMediaPlayer):
(WebKit::RemoteMediaPlayerManagerProxy::deleteMediaPlayer):
(WebKit::RemoteMediaPlayerManagerProxy::logger):
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerManagerProxy.h:
(WebKit::RemoteMediaPlayerManagerProxy::gpuConnectionToWebProcess):
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.cpp:
(WebKit::RemoteMediaSourceProxy::RemoteMediaSourceProxy):
(WebKit::RemoteMediaSourceProxy::disconnect):
(WebKit::RemoteMediaSourceProxy::waitForTarget):
(WebKit::RemoteMediaSourceProxy::seekToTime):
(WebKit::RemoteMediaSourceProxy::addSourceBuffer):
(WebKit::RemoteMediaSourceProxy::shutdown):
* Source/WebKit/GPUProcess/media/RemoteMediaSourceProxy.h:
* Source/WebKit/GPUProcess/media/RemoteRemoteCommandListenerProxy.cpp:
(WebKit::RemoteRemoteCommandListenerProxy::updateSupportedCommands):
* Source/WebKit/GPUProcess/media/RemoteRemoteCommandListenerProxy.h:
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.cpp:
(WebKit::RemoteSourceBufferProxy::RemoteSourceBufferProxy):
(WebKit::RemoteSourceBufferProxy::disconnect):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveInitializationSegment):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateHighestPresentationTimestampChanged):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDurationChanged):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateBufferedChanged):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidDropSample):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateDidReceiveRenderingError):
(WebKit::RemoteSourceBufferProxy::sourceBufferPrivateEvictionDataChanged):
(WebKit::RemoteSourceBufferProxy::append):
(WebKit::RemoteSourceBufferProxy::shutdown):
* Source/WebKit/GPUProcess/media/RemoteSourceBufferProxy.h:
* Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.cpp:
(WebKit::RemoteTextTrackProxy::RemoteTextTrackProxy):
(WebKit::RemoteTextTrackProxy::configurationChanged):
(WebKit::RemoteTextTrackProxy::addDataCue):
(WebKit::RemoteTextTrackProxy::updateDataCue):
(WebKit::RemoteTextTrackProxy::removeDataCue):
(WebKit::RemoteTextTrackProxy::addGenericCue):
(WebKit::RemoteTextTrackProxy::updateGenericCue):
(WebKit::RemoteTextTrackProxy::removeGenericCue):
(WebKit::RemoteTextTrackProxy::parseWebVTTFileHeader):
(WebKit::RemoteTextTrackProxy::parseWebVTTCueData):
* Source/WebKit/GPUProcess/media/RemoteTextTrackProxy.h:
* Source/WebKit/GPUProcess/media/RemoteVideoTrackProxy.cpp:
(WebKit::RemoteVideoTrackProxy::RemoteVideoTrackProxy):
(WebKit::RemoteVideoTrackProxy::updateConfiguration):
* Source/WebKit/GPUProcess/media/RemoteVideoTrackProxy.h:
* Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.cpp:
(WebKit::RemoteMediaSessionHelperProxy::applicationWillEnterForeground):
(WebKit::RemoteMediaSessionHelperProxy::applicationDidEnterBackground):
(WebKit::RemoteMediaSessionHelperProxy::applicationWillBecomeInactive):
(WebKit::RemoteMediaSessionHelperProxy::applicationDidBecomeActive):
(WebKit::RemoteMediaSessionHelperProxy::externalOutputDeviceAvailableDidChange):
(WebKit::RemoteMediaSessionHelperProxy::isPlayingToAutomotiveHeadUnitDidChange):
(WebKit::RemoteMediaSessionHelperProxy::activeAudioRouteDidChange):
(WebKit::RemoteMediaSessionHelperProxy::activeVideoRouteDidChange):
(WebKit::RemoteMediaSessionHelperProxy::activeAudioRouteSupportsSpatialPlaybackDidChange):
* Source/WebKit/GPUProcess/media/ios/RemoteMediaSessionHelperProxy.h:
* Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.cpp:
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::createUnit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::deleteUnit):
(WebKit::RemoteAudioMediaStreamTrackRendererInternalUnitManager::notifyLastToCaptureAudioChanged):
* Source/WebKit/GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererInternalUnitManager.h:
* Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.cpp:
(WebKit::RemoteMediaRecorder::audioSamplesStorageChanged):
(WebKit::RemoteMediaRecorder::audioSamplesAvailable):
* Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorder.h:
* Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.cpp:
(WebKit::RemoteMediaRecorderManager::createRecorder):
(WebKit::RemoteMediaRecorderManager::releaseRecorder):
* Source/WebKit/GPUProcess/webrtc/RemoteMediaRecorderManager.h:
* Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.cpp:
(WebKit::RemoteSampleBufferDisplayLayer::RemoteSampleBufferDisplayLayer):
* Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayer.h:
* Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.cpp:
(WebKit::RemoteSampleBufferDisplayLayerManager::startListeningForIPC):
(WebKit::RemoteSampleBufferDisplayLayerManager::close):
(WebKit::RemoteSampleBufferDisplayLayerManager::createLayer):
* Source/WebKit/GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager.h:

Canonical link: https://commits.webkit.org/276077@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