Rename SharedBufferCopy to SharedBufferReference
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 May 2022 06:20:01 +0000 (06:20 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 25 May 2022 06:20:01 +0000 (06:20 +0000)
commit1dc6bdcbe1d4a439fc4d3bfc3611dcce764aad2f
tree4c4027ccbad0f4ad2139146b0b5cc6da6a830514
parentcef3dad8b64914a29ef06feee36bd2d2686f60d2
Rename SharedBufferCopy to SharedBufferReference
https://bugs.webkit.org/show_bug.cgi?id=240796
rdar://problem/93754681

Patch by Jean-Yves Avenard <jyavenard@gmail.com> on 2022-05-24
Reviewed by Jer Noble.

1. SharedBufferCopy doesn't perform a copy, but passes SharedMemory and return a SharedBuffer that wraps such SharedMemory.
Rename it to SharedBufferReference to more accurately reflect what it actually does.

2. Remove SharedBufferCopy::safeBuffer() and rename
 SharedBufferCopy::buffer with SharedBufferCopy::unsafeBuffer. This gives
 better clarity that accessing SharedBufferCopy should be treated with care.

3. Add SharedBufferCopy::isNull() method
4. When passing a SharedBufferReferal across multiple processes, we remove the need for a new allocation and copy of the content; instead we move the underlying SharedMemory.

No change of observable behaviour.

* Source/WebKit/GPUProcess/media/RemoteCDMInstanceProxy.h:
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp:
(WebKit::RemoteImageDecoderAVFProxy::createDecoder):
(WebKit::RemoteImageDecoderAVFProxy::setData):
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h:
* Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in:
* Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp:
(WebKit::NetworkResourceLoader::bufferingTimerFired):
(WebKit::NetworkResourceLoader::sendBuffer):
(WebKit::NetworkResourceLoader::dataReceivedThroughContentFilter):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.cpp:
(WebKit::ServiceWorkerDownloadTask::didReceiveData):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.h:
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.messages.in:
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp:
(WebKit::ServiceWorkerFetchTask::didReceiveData):
(WebKit::ServiceWorkerFetchTask::loadBodyFromPreloader):
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h:
* Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in:
* Source/WebKit/Platform/IPC/SharedBufferCopy.cpp: Removed.
* Source/WebKit/Platform/IPC/SharedBufferCopy.h: Removed.
* Source/WebKit/Platform/IPC/SharedBufferReference.cpp: Added.
(IPC::SharedBufferReference::encode const):
(IPC::SharedBufferReference::decode):
(IPC::SharedBufferReference::unsafeBuffer const):
(IPC::SharedBufferReference::data const):
* Source/WebKit/Platform/IPC/SharedBufferReference.h: Added.
(IPC::SharedBufferReference::SharedBufferReference):
(IPC::SharedBufferReference::size const):
(IPC::SharedBufferReference::isEmpty const):
(IPC::SharedBufferReference::isNull const):
* Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp:
(WebKit::CGDisplayListImageBufferBackend::createBackendHandle const):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
* Source/WebKit/Sources.txt:
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView createPDFWithConfiguration:completionHandler:]):
* Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm:
(WebKit::WebPageProxy::platformRegisterAttachment):
* Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm:
(WebKit::WebProcessProxy::sendAudioComponentRegistrations):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::CompletionHandler<void):
(WebKit::WebPageProxy::drawToPDF):
(WebKit::WebPageProxy::getLoadDecisionForIcon):
(WebKit::WebPageProxy::updateAttachmentAttributes):
(WebKit::WebPageProxy::registerAttachmentIdentifierFromData):
(WebKit::WebPageProxy::platformRegisterAttachment):
* Source/WebKit/UIProcess/WebPageProxy.h:
* Source/WebKit/UIProcess/WebPageProxy.messages.in:
* Source/WebKit/UIProcess/WebPasteboardProxy.h:
* Source/WebKit/UIProcess/WebPasteboardProxy.messages.in:
* Source/WebKit/UIProcess/WebURLSchemeTask.cpp:
(WebKit::WebURLSchemeTask::didReceiveData):
* Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp:
(WebKit::WebPasteboardProxy::readBuffer):
* Source/WebKit/UIProcess/ios/WKContentView.mm:
(-[WKContentView _wk_pageCountForPrintFormatter:]):
* Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm:
(WebKit::WebPageProxy::drawToPDFiOS):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
* Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h:
* Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVF.cpp:
(WebKit::RemoteImageDecoderAVF::setData):
* Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp:
(WebKit::RemoteImageDecoderAVFManager::createImageDecoder):
* Source/WebKit/WebProcess/Network/WebResourceLoader.cpp:
(WebKit::WebResourceLoader::didReceiveData):
* Source/WebKit/WebProcess/Network/WebResourceLoader.h:
* Source/WebKit/WebProcess/Network/WebResourceLoader.messages.in:
* Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp:
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveData):
(WebKit::WebServiceWorkerFetchTaskClient::didReceiveBlobChunk):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
* Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp:
(WebKit::WebEditorClient::registerAttachmentIdentifier):
* Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp:
(WebKit::WebPlatformStrategies::readBufferFromClipboard):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::getContentsAsMHTMLData):
(WebKit::WebPage::getSelectionAsWebArchiveData):
(WebKit::WebPage::getMainResourceDataOfFrame):
(WebKit::WebPage::getResourceDataFromFrame):
(WebKit::WebPage::getWebArchiveOfFrame):
(WebKit::WebPage::getAccessibilityTreeData):
(WebKit::WebPage::drawToPDF):
(WebKit::WebPage::drawPagesToPDF):
(WebKit::WebPage::didGetLoadDecisionForIcon):
(WebKit::WebPage::urlSchemeTaskDidReceiveData):
(WebKit::WebPage::updateAttachmentAttributes):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::drawToPDFiOS):
* Source/WebKit/WebProcess/WebProcess.h:
* Source/WebKit/WebProcess/WebProcess.messages.in:
* Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm:
(WebKit::WebProcess::consumeAudioComponentRegistrations):

link: https://commits.webkit.org/250949@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@294790 268f45cc-cd09-0410-ab3c-d52691b4dbfc
48 files changed:
Source/WebKit/GPUProcess/media/RemoteCDMInstanceProxy.h
Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.cpp
Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.h
Source/WebKit/GPUProcess/media/RemoteImageDecoderAVFProxy.messages.in
Source/WebKit/NetworkProcess/NetworkResourceLoader.cpp
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.cpp
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.h
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerDownloadTask.messages.in
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.cpp
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.h
Source/WebKit/NetworkProcess/ServiceWorker/ServiceWorkerFetchTask.messages.in
Source/WebKit/Platform/IPC/SharedBufferCopy.cpp [deleted file]
Source/WebKit/Platform/IPC/SharedBufferCopy.h [deleted file]
Source/WebKit/Platform/IPC/SharedBufferReference.cpp [new file with mode: 0644]
Source/WebKit/Platform/IPC/SharedBufferReference.h [new file with mode: 0644]
Source/WebKit/Shared/RemoteLayerTree/CGDisplayListImageBufferBackend.cpp
Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
Source/WebKit/Sources.txt
Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
Source/WebKit/UIProcess/Cocoa/WebPageProxyCocoa.mm
Source/WebKit/UIProcess/Cocoa/WebProcessProxyCocoa.mm
Source/WebKit/UIProcess/WebPageProxy.cpp
Source/WebKit/UIProcess/WebPageProxy.h
Source/WebKit/UIProcess/WebPageProxy.messages.in
Source/WebKit/UIProcess/WebPasteboardProxy.h
Source/WebKit/UIProcess/WebPasteboardProxy.messages.in
Source/WebKit/UIProcess/WebURLSchemeTask.cpp
Source/WebKit/UIProcess/gtk/WebPasteboardProxyGtk.cpp
Source/WebKit/UIProcess/ios/WKContentView.mm
Source/WebKit/UIProcess/ios/WebPageProxyIOS.mm
Source/WebKit/WebKit.xcodeproj/project.pbxproj
Source/WebKit/WebProcess/GPU/graphics/ImageBufferBackendHandle.h
Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVF.cpp
Source/WebKit/WebProcess/GPU/media/RemoteImageDecoderAVFManager.cpp
Source/WebKit/WebProcess/Network/WebResourceLoader.cpp
Source/WebKit/WebProcess/Network/WebResourceLoader.h
Source/WebKit/WebProcess/Network/WebResourceLoader.messages.in
Source/WebKit/WebProcess/Storage/WebServiceWorkerFetchTaskClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebEditorClient.cpp
Source/WebKit/WebProcess/WebCoreSupport/WebPlatformStrategies.cpp
Source/WebKit/WebProcess/WebPage/WebPage.cpp
Source/WebKit/WebProcess/WebPage/WebPage.h
Source/WebKit/WebProcess/WebPage/WebPage.messages.in
Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
Source/WebKit/WebProcess/WebProcess.h
Source/WebKit/WebProcess/WebProcess.messages.in
Source/WebKit/WebProcess/cocoa/WebProcessCocoa.mm