[webkit-changes] [WebKit/WebKit] aeb697: Make MachSendRight require an explicit copy constr...

mattwoodrow noreply at github.com
Wed Jul 26 13:52:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: aeb697fb2c06d08aa65994876b261e8056377213
      https://github.com/WebKit/WebKit/commit/aeb697fb2c06d08aa65994876b261e8056377213
  Author: Matt Woodrow <mattwoodrow at apple.com>
  Date:   2023-07-26 (Wed, 26 Jul 2023)

  Changed paths:
    M Source/WTF/wtf/MachSendRight.h
    M Source/WTF/wtf/cocoa/MachSendRight.cpp
    M Source/WebCore/html/HTMLMediaElement.cpp
    M Source/WebCore/html/HTMLMediaElement.h
    M Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm
    M Source/WebCore/platform/ProcessIdentity.cpp
    M Source/WebCore/platform/ProcessIdentity.h
    M Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.h
    M Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm
    M Source/WebCore/platform/graphics/ImageBuffer.h
    M Source/WebCore/platform/graphics/MediaPlayer.cpp
    M Source/WebCore/platform/graphics/MediaPlayer.h
    M Source/WebCore/platform/graphics/MediaPlayerPrivate.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h
    M Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.mm
    M Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp
    M Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp
    M Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h
    M Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp
    M Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm
    M Source/WebKit/Platform/IPC/ArgumentCoders.h
    M Source/WebKit/Platform/IPC/darwin/ArgumentCodersDarwin.h
    M Source/WebKit/Platform/IPC/darwin/ArgumentCodersDarwin.mm
    M Source/WebKit/Platform/cocoa/SharedMemoryCocoa.cpp
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Scripts/webkit/tests/TestWithLegacyReceiverMessages.h
    M Source/WebKit/Scripts/webkit/tests/TestWithStreamMessages.h
    M Source/WebKit/Scripts/webkit/tests/TestWithoutAttributesMessages.h
    M Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm
    M Source/WebKit/Shared/GPUProcessConnectionParameters.serialization.in
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/Shared/WebCoreArgumentCoders.h
    M Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in
    M Source/WebKit/Shared/WebProcessCreationParameters.serialization.in
    M Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm
    M Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm
    M Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp
    M Source/WebKit/UIProcess/WebProcessPool.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteCompositorIntegrationProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp
    M Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
    M Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp
    M Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h
    M Source/WebKit/WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm
    M Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp
    M Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.h
    M Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.mm
    M Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h
    M Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm
    M Tools/TestWebKitAPI/Tests/WTF/darwin/MachSendRight.cpp

  Log Message:
  -----------
  Make MachSendRight require an explicit copy constructor to be copied.
https://bugs.webkit.org/show_bug.cgi?id=257580
<rdar://problem/110431180>

Reviewed by Kimmo Kinnunen.

MachSendRight are expensive to copy, since it calls into the kernel. We generally don't want to do that by accident.

This deletes the MachSendRight copy assignment operator, and makes the copy constructor explicit.
It switches callers to use the explicit copy constructor where they do want a duplicate.
It removes a lot of implicit and unnecessary copies in the process.

It also changes the generated IPC code for MachSendRight to only take an rvalue reference, so all callers
must either move their send right into IPC (and make an explicit copy if desired).

* Source/WTF/wtf/MachSendRight.h:
* Source/WTF/wtf/cocoa/MachSendRight.cpp:
(WTF::MachSendRight::copySendRight const): Deleted.
* Source/WebCore/html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::setVideoInlineSizeFenced):
* Source/WebCore/html/HTMLMediaElement.h:
* Source/WebCore/html/canvas/GPUCanvasContextCocoa.mm:
* Source/WebCore/platform/ProcessIdentity.cpp:
(WebCore::ProcessIdentity::operator=):
* Source/WebCore/platform/ProcessIdentity.h:
* Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.h:
* Source/WebCore/platform/cocoa/VideoFullscreenModelVideoElement.mm:
(WebCore::VideoFullscreenModelVideoElement::setVideoSizeFenced):
* Source/WebCore/platform/graphics/ImageBuffer.h:
* Source/WebCore/platform/graphics/MediaPlayer.cpp:
(WebCore::MediaPlayer::setVideoInlineSizeFenced):
* Source/WebCore/platform/graphics/MediaPlayer.h:
* Source/WebCore/platform/graphics/MediaPlayerPrivate.h:
(WebCore::MediaPlayerPrivateInterface::setVideoInlineSizeFenced):
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaSourceAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaSourceAVFObjC::setVideoInlineSizeFenced):
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.h:
* Source/WebCore/platform/graphics/avfoundation/objc/MediaPlayerPrivateMediaStreamAVFObjC.mm:
(WebCore::MediaPlayerPrivateMediaStreamAVFObjC::setVideoInlineSizeFenced):
* Source/WebCore/platform/graphics/ca/PlatformCALayer.mm:
(WebCore::PlatformCALayer::setDelegatedContents):
* Source/WebCore/platform/graphics/cocoa/GraphicsContextGLCocoa.mm:
(WebCore::GraphicsContextGLCocoa::createEGLSync):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGL.cpp:
(WebKit::RemoteGraphicsContextGL::createAndBindExternalImage):
* Source/WebKit/GPUProcess/graphics/RemoteGraphicsContextGLCocoa.cpp:
(WebKit::RemoteGraphicsContextGLCocoa::createEGLSync):
(WebKit::RemoteGraphicsContextGLCocoa::platformWorkQueueInitialize):
* Source/WebKit/GPUProcess/media/RemoteMediaPlayerProxy.h:
* Source/WebKit/GPUProcess/media/RemoteVideoFrameObjectHeap.cpp:
(WebKit::RemoteVideoFrameObjectHeap::getVideoFrameBuffer):
(WebKit::RemoteVideoFrameObjectHeap::convertFrameBuffer):
* Source/WebKit/GPUProcess/media/cocoa/RemoteMediaPlayerProxyCocoa.mm:
(WebKit::RemoteMediaPlayerProxy::setVideoInlineSizeFenced):
* Source/WebKit/Platform/IPC/ArgumentCoders.h:
* Source/WebKit/Platform/IPC/darwin/ArgumentCodersDarwin.h:
* Source/WebKit/Platform/IPC/darwin/ArgumentCodersDarwin.mm:
* Source/WebKit/Platform/cocoa/SharedMemoryCocoa.cpp:
(WebKit::SharedMemory::createSendRight const):
* Source/WebKit/Scripts/webkit/messages.py:
(types_that_must_be_moved):
* Source/WebKit/Scripts/webkit/tests/TestWithLegacyReceiverMessages.h:
(Messages::TestWithLegacyReceiver::DidCreateWebProcessConnection::DidCreateWebProcessConnection):
* Source/WebKit/Scripts/webkit/tests/TestWithStreamMessages.h:
(Messages::TestWithStream::SendMachSendRight::SendMachSendRight):
(Messages::TestWithStream::SendAndReceiveMachSendRight::SendAndReceiveMachSendRight):
* Source/WebKit/Scripts/webkit/tests/TestWithoutAttributesMessages.h:
(Messages::TestWithoutAttributes::DidCreateWebProcessConnection::DidCreateWebProcessConnection):
* Source/WebKit/Shared/Cocoa/WebCoreArgumentCodersCocoa.mm:
(IPC::ArgumentCoder<WebCore::GraphicsContextGL::ExternalImageSourceIOSurfaceHandle>::encode):
(IPC::ArgumentCoder<WebCore::GraphicsContextGL::ExternalImageSourceMTLSharedTextureHandle>::encode):
* Source/WebKit/Shared/GPUProcessConnectionParameters.serialization.in:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::encode const):
(WebKit::RemoteLayerBackingStore::setDelegatedContents):
* Source/WebKit/Shared/WebCoreArgumentCoders.h:
* Source/WebKit/Shared/WebCoreArgumentCoders.serialization.in:
* Source/WebKit/Shared/WebProcessCreationParameters.serialization.in:
* Source/WebKit/UIProcess/Cocoa/ModelElementControllerCocoa.mm:
(WebKit::ModelElementController::modelElementSizeDidChange):
* Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp:
(WebKit::UserMediaCaptureManagerProxy::clone):
* Source/WebKit/UIProcess/Cocoa/VideoFullscreenManagerProxy.mm:
(WebKit::VideoFullscreenManagerProxy::setVideoLayerFrame):
* Source/WebKit/UIProcess/GPU/GPUProcessProxy.cpp:
(WebKit::GPUProcessProxy::createGPUProcessConnection):
* Source/WebKit/UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::initializeNewWebProcess):
* Source/WebKit/WebProcess/GPU/graphics/RemoteDisplayListRecorderProxy.cpp:
(WebKit::RemoteDisplayListRecorderProxy::recordPaintVideoFrame):
* Source/WebKit/WebProcess/GPU/graphics/RemoteGraphicsContextGLProxy.cpp:
(WebKit::RemoteGraphicsContextGLProxy::copyTextureFromVideoFrame):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteCompositorIntegrationProxy.cpp:
(WebKit::WebGPU::RemoteCompositorIntegrationProxy::recreateRenderBuffers):
* Source/WebKit/WebProcess/GPU/graphics/WebGPU/RemoteDeviceProxy.cpp:
(WebKit::WebGPU::RemoteDeviceProxy::importExternalTexture):
* Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp:
(WebKit::ImageBufferRemoteIOSurfaceBackend::createBackendHandle const):
* Source/WebKit/WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm:
* Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp:
(WebKit::MediaPlayerPrivateRemote::setVideoInlineSizeFenced):
* Source/WebKit/WebProcess/GPU/media/MediaPlayerPrivateRemote.h:
* Source/WebKit/WebProcess/GPU/media/cocoa/VideoLayerRemoteCocoa.mm:
(-[WKVideoLayerRemote resolveBounds]):
* Source/WebKit/WebProcess/GPU/webrtc/LibWebRTCCodecs.cpp:
(WebKit::LibWebRTCCodecs::encodeFrameInternal):
* Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::videoFrameAvailable):
* Source/WebKit/WebProcess/GPU/webrtc/RemoteVideoFrameObjectHeapProxyProcessor.cpp:
(WebKit::RemoteVideoFrameObjectHeapProxyProcessor::getNativeImage):
* Source/WebKit/WebProcess/GPU/webrtc/SampleBufferDisplayLayer.cpp:
(WebKit::SampleBufferDisplayLayer::updateBoundsAndPosition):
(WebKit::SampleBufferDisplayLayer::enqueueBlackFrameFrom):
(WebKit::SampleBufferDisplayLayer::enqueueVideoFrame):
* Source/WebKit/WebProcess/GPU/webrtc/SharedVideoFrame.h:
(WebKit::SharedVideoFrame::encode):
(WebKit::SharedVideoFrame::encode const): Deleted.
* Source/WebKit/WebProcess/Model/mac/ARKitInlinePreviewModelPlayerMac.mm:
(WebKit::ARKitInlinePreviewModelPlayerMac::sizeDidChange):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.mm:
* Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.h:
* Source/WebKit/WebProcess/cocoa/VideoFullscreenManager.mm:
(WebKit::VideoFullscreenManager::setVideoLayerFrameFenced):
* Tools/TestWebKitAPI/Tests/WTF/darwin/MachSendRight.cpp:
(TestWebKitAPI::TEST):

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




More information about the webkit-changes mailing list