WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-217809-20201016124531.patch (text/plain), 146.65 KB, created by
Said Abou-Hallawa
on 2020-10-16 12:45:32 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Said Abou-Hallawa
Created:
2020-10-16 12:45:32 PDT
Size:
146.65 KB
patch
obsolete
>Subversion Revision: 268565 >diff --git a/Source/WebKit/ChangeLog b/Source/WebKit/ChangeLog >index 8cd67f18ada4c0508dd5cd11477edd1055b4f0cb..98f388b0ea3d58795c70f45b0d3592f791dd02e8 100644 >--- a/Source/WebKit/ChangeLog >+++ b/Source/WebKit/ChangeLog >@@ -1,3 +1,96 @@ >+2020-10-16 Said Abou-Hallawa <sabouhallawa@apple.com> >+ >+ [GPU Process] Exchange RemoteImageBuffer and RemoteImageBufferProxy >+ https://bugs.webkit.org/show_bug.cgi?id=217809 >+ >+ Reviewed by Simon Fraser. >+ >+ The names of the GPU rendering classes have been confusing. RemoteImageBuffer >+ should be the real object in the GPU Process because it owns the backend. >+ And RemoteImageBufferProxy should be a proxy to this object in the Web >+ Process. So we are going to exchange the following classes: >+ >+ -- RemoteImageBuffer <-> RemoteImageBufferProxy >+ -- RemoteRenderingBackend <-> RemoteRenderingBackendProxy >+ -- RemoteImageBufferMessageHandler <-> RemoteImageBufferMessageHandlerProxy >+ >+ * CMakeLists.txt: >+ * DerivedSources-input.xcfilelist: >+ * DerivedSources.make: >+ * GPUProcess/GPUConnectionToWebProcess.cpp: >+ (WebKit::GPUConnectionToWebProcess::createRenderingBackend): >+ (WebKit::GPUConnectionToWebProcess::releaseRenderingBackend): >+ * GPUProcess/GPUConnectionToWebProcess.h: >+ * GPUProcess/graphics/PlatformRemoteImageBuffer.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h. >+ * GPUProcess/graphics/RemoteImageBuffer.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h. >+ (WebKit::RemoteImageBuffer::create): >+ (WebKit::RemoteImageBuffer::RemoteImageBuffer): >+ (WebKit::RemoteImageBuffer::~RemoteImageBuffer): >+ (WebKit::RemoteImageBuffer::apply): >+ * GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp. >+ (WebKit::RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler): >+ (WebKit::RemoteImageBufferMessageHandler::createBackend): >+ (WebKit::RemoteImageBufferMessageHandler::commitFlushContext): >+ * GPUProcess/graphics/RemoteImageBufferMessageHandler.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h. >+ (WebKit::RemoteImageBufferMessageHandler::backend): >+ * GPUProcess/graphics/RemoteRenderingBackend.cpp: Renamed from Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp. >+ (WebKit::RemoteRenderingBackend::create): >+ (WebKit::RemoteRenderingBackend::RemoteRenderingBackend): >+ (WebKit::RemoteRenderingBackend::~RemoteRenderingBackend): >+ (WebKit::RemoteRenderingBackend::messageSenderConnection const): >+ (WebKit::RemoteRenderingBackend::messageSenderDestinationID const): >+ (WebKit::RemoteRenderingBackend::createImageBuffer): >+ (WebKit::RemoteRenderingBackend::releaseRemoteResource): >+ (WebKit::RemoteRenderingBackend::getImageData): >+ (WebKit::RemoteRenderingBackend::flushImageBufferDrawingContext): >+ (WebKit::RemoteRenderingBackend::flushImageBufferDrawingContextAndCommit): >+ (WebKit::RemoteRenderingBackend::gpuConnectionToWebProcess const): >+ * GPUProcess/graphics/RemoteRenderingBackend.h: Renamed from Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h. >+ (WebKit::RemoteRenderingBackend::renderingBackendIdentifier const): >+ * GPUProcess/graphics/RemoteRenderingBackend.messages.in: Renamed from Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in. >+ * GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp: >+ * Sources.txt: >+ * WebKit.xcodeproj/project.pbxproj: >+ * WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h: Renamed from Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h. >+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp: Removed. >+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Added. >+ (WebKit::RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::~RemoteImageBufferMessageHandlerProxy): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::getImageData const): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::waitForCreateImageBufferBackend): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::waitForCommitImageBufferFlushContext): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContext): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::flushDrawingContextAndWaitCommit): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::commitFlushContext): >+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h. >+ (WebKit::RemoteImageBufferMessageHandlerProxy::remoteResourceIdentifier const): >+ (WebKit::RemoteImageBufferMessageHandlerProxy::isPendingFlush const): >+ * WebProcess/GPU/graphics/RemoteImageBufferProxy.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h. >+ (WebKit::RemoteImageBufferProxy::create): >+ (WebKit::RemoteImageBufferProxy::~RemoteImageBufferProxy): >+ (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy): >+ (WebKit::RemoteImageBufferProxy::putImageData): >+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp. >+ (WebKit::RemoteRenderingBackendProxy::create): >+ (WebKit::RemoteRenderingBackendProxy::RemoteRenderingBackendProxy): >+ (WebKit::RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy): >+ (WebKit::RemoteRenderingBackendProxy::messageSenderConnection const): >+ (WebKit::RemoteRenderingBackendProxy::messageSenderDestinationID const): >+ (WebKit::RemoteRenderingBackendProxy::waitForCreateImageBufferBackend): >+ (WebKit::RemoteRenderingBackendProxy::waitForCommitImageBufferFlushContext): >+ (WebKit::RemoteRenderingBackendProxy::createImageBuffer): >+ (WebKit::RemoteRenderingBackendProxy::releaseRemoteResource): >+ (WebKit::RemoteRenderingBackendProxy::createImageBufferBackend): >+ (WebKit::RemoteRenderingBackendProxy::commitImageBufferFlushContext): >+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h. >+ (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const): >+ * WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in: Renamed from Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in. >+ * WebProcess/WebCoreSupport/WebChromeClient.cpp: >+ (WebKit::WebChromeClient::ensureRemoteRenderingBackendProxy const): >+ (WebKit::WebChromeClient::createImageBuffer const): >+ (WebKit::WebChromeClient::ensureRemoteRenderingBackend const): Deleted. >+ * WebProcess/WebCoreSupport/WebChromeClient.h: >+ > 2020-10-15 Per Arne Vollan <pvollan@apple.com> > > [macOS] Add telemetry for distributed notification service >diff --git a/Source/WebKit/CMakeLists.txt b/Source/WebKit/CMakeLists.txt >index c9f6b43b8e871a33fdbd641927f4c87d8adb43f6..b27c50cca659ce98959b980a2ab8dfbebdb3d5ca 100644 >--- a/Source/WebKit/CMakeLists.txt >+++ b/Source/WebKit/CMakeLists.txt >@@ -122,7 +122,7 @@ set(WebKit_MESSAGES_IN_FILES > GPUProcess/GPUConnectionToWebProcess > GPUProcess/GPUProcess > >- GPUProcess/graphics/RemoteRenderingBackendProxy >+ GPUProcess/graphics/RemoteRenderingBackend > > GPUProcess/media/RemoteAudioDestinationManager > GPUProcess/media/RemoteAudioSessionProxy >@@ -214,7 +214,7 @@ set(WebKit_MESSAGES_IN_FILES > > WebProcess/GPU/GPUProcessConnection > >- WebProcess/GPU/graphics/RemoteRenderingBackend >+ WebProcess/GPU/graphics/RemoteRenderingBackendProxy > > WebProcess/GPU/media/MediaPlayerPrivateRemote > WebProcess/GPU/media/RemoteAudioDestinationProxy >diff --git a/Source/WebKit/DerivedSources-input.xcfilelist b/Source/WebKit/DerivedSources-input.xcfilelist >index 6845ce8bd40f671c324b9b2524d9c74dedf011a0..668d9db7cd19fc02e8fa35c561c98218c0ce0a65 100644 >--- a/Source/WebKit/DerivedSources-input.xcfilelist >+++ b/Source/WebKit/DerivedSources-input.xcfilelist >@@ -20,7 +20,7 @@ $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR)/models.py > $(JAVASCRIPTCORE_PRIVATE_HEADERS_DIR)/xxd.pl > $(PROJECT_DIR)/GPUProcess/GPUConnectionToWebProcess.messages.in > $(PROJECT_DIR)/GPUProcess/GPUProcess.messages.in >-$(PROJECT_DIR)/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in >+$(PROJECT_DIR)/GPUProcess/graphics/RemoteRenderingBackend.messages.in > $(PROJECT_DIR)/GPUProcess/mac/com.apple.WebKit.GPUProcess.sb.in > $(PROJECT_DIR)/GPUProcess/media/RemoteAudioDestinationManager.messages.in > $(PROJECT_DIR)/GPUProcess/media/RemoteAudioSessionProxy.messages.in >@@ -123,7 +123,7 @@ $(PROJECT_DIR)/WebProcess/Cache/WebCacheStorageConnection.messages.in > $(PROJECT_DIR)/WebProcess/Databases/IndexedDB/WebIDBConnectionToServer.messages.in > $(PROJECT_DIR)/WebProcess/FullScreen/WebFullScreenManager.messages.in > $(PROJECT_DIR)/WebProcess/GPU/GPUProcessConnection.messages.in >-$(PROJECT_DIR)/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in >+$(PROJECT_DIR)/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in > $(PROJECT_DIR)/WebProcess/GPU/media/MediaPlayerPrivateRemote.messages.in > $(PROJECT_DIR)/WebProcess/GPU/media/RemoteAudioDestinationProxy.messages.in > $(PROJECT_DIR)/WebProcess/GPU/media/RemoteAudioSession.messages.in >diff --git a/Source/WebKit/DerivedSources.make b/Source/WebKit/DerivedSources.make >index edd5878389190f3eec66ce9e3b177796e1cf7b76..203e8bc6cdd056b2433faf72263d12674a56efd1 100644 >--- a/Source/WebKit/DerivedSources.make >+++ b/Source/WebKit/DerivedSources.make >@@ -166,7 +166,7 @@ MESSAGE_RECEIVERS = \ > UIProcess/Media/AudioSessionRoutingArbitratorProxy \ > WebProcess/Databases/IndexedDB/WebIDBConnectionToServer \ > WebProcess/GPU/GPUProcessConnection \ >- WebProcess/GPU/graphics/RemoteRenderingBackend \ >+ WebProcess/GPU/graphics/RemoteRenderingBackendProxy \ > WebProcess/GPU/webrtc/LibWebRTCCodecs \ > WebProcess/GPU/webrtc/SampleBufferDisplayLayer \ > WebProcess/GPU/media/MediaPlayerPrivateRemote \ >@@ -217,7 +217,7 @@ MESSAGE_RECEIVERS = \ > PluginProcess/PluginControllerProxy \ > PluginProcess/PluginProcess \ > GPUProcess/GPUConnectionToWebProcess \ >- GPUProcess/graphics/RemoteRenderingBackendProxy \ >+ GPUProcess/graphics/RemoteRenderingBackend \ > GPUProcess/webrtc/LibWebRTCCodecsProxy \ > GPUProcess/webrtc/RemoteSampleBufferDisplayLayerManager \ > GPUProcess/webrtc/RemoteAudioMediaStreamTrackRendererManager \ >diff --git a/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp b/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp >index 125c641ed58b367189aa5f296b5a33672a5ca6cd..0e2e8832b1e20f1e0f319d5d9f25d72ce1bf73ad 100644 >--- a/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp >+++ b/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.cpp >@@ -47,6 +47,7 @@ > #include "RemoteMediaRecorderMessages.h" > #include "RemoteMediaResourceManager.h" > #include "RemoteMediaResourceManagerMessages.h" >+#include "RemoteRenderingBackend.h" > #include "RemoteSampleBufferDisplayLayerManager.h" > #include "RemoteSampleBufferDisplayLayerManagerMessages.h" > #include "RemoteSampleBufferDisplayLayerMessages.h" >@@ -277,15 +278,15 @@ RemoteAudioSessionProxy& GPUConnectionToWebProcess::audioSessionProxy() > > void GPUConnectionToWebProcess::createRenderingBackend(RenderingBackendIdentifier renderingBackendIdentifier) > { >- auto addResult = m_remoteRenderingBackendProxyMap.ensure(renderingBackendIdentifier, [&]() { >- return RemoteRenderingBackendProxy::create(*this, renderingBackendIdentifier); >+ auto addResult = m_remoteRenderingBackendMap.ensure(renderingBackendIdentifier, [&]() { >+ return RemoteRenderingBackend::create(*this, renderingBackendIdentifier); > }); > ASSERT_UNUSED(addResult, addResult.isNewEntry); > } > > void GPUConnectionToWebProcess::releaseRenderingBackend(RenderingBackendIdentifier renderingBackendIdentifier) > { >- bool found = m_remoteRenderingBackendProxyMap.remove(renderingBackendIdentifier); >+ bool found = m_remoteRenderingBackendMap.remove(renderingBackendIdentifier); > ASSERT_UNUSED(found, found); > } > >diff --git a/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h b/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h >index 6bffe2b766854432c69ada001b89ebcc82bc89ab..2678dbc4e5d365fad28e8b4827863762a3c4578d 100644 >--- a/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h >+++ b/Source/WebKit/GPUProcess/GPUConnectionToWebProcess.h >@@ -31,7 +31,6 @@ > #include "GPUConnectionToWebProcessMessages.h" > #include "MessageReceiverMap.h" > #include "RemoteAudioSessionIdentifier.h" >-#include "RemoteRenderingBackendProxy.h" > #include "RenderingBackendIdentifier.h" > #include <WebCore/LibWebRTCEnumTraits.h> > #include <WebCore/NowPlayingManager.h> >@@ -54,6 +53,7 @@ class RemoteMediaPlayerManagerProxy; > class RemoteMediaRecorderManager; > class RemoteMediaResourceManager; > class RemoteMediaSessionHelperProxy; >+class RemoteRenderingBackend; > class RemoteSampleBufferDisplayLayerManager; > class UserMediaCaptureManagerProxy; > struct RemoteAudioSessionConfiguration; >@@ -178,8 +178,8 @@ private: > bool m_allowsDisplayCapture { false }; > #endif > >- using RemoteRenderingBackendProxyMap = HashMap<RenderingBackendIdentifier, std::unique_ptr<RemoteRenderingBackendProxy>>; >- RemoteRenderingBackendProxyMap m_remoteRenderingBackendProxyMap; >+ using RemoteRenderingBackendMap = HashMap<RenderingBackendIdentifier, std::unique_ptr<RemoteRenderingBackend>>; >+ RemoteRenderingBackendMap m_remoteRenderingBackendMap; > > #if ENABLE(ENCRYPTED_MEDIA) > std::unique_ptr<RemoteCDMFactoryProxy> m_cdmFactoryProxy; >diff --git a/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBuffer.h b/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBuffer.h >new file mode 100644 >index 0000000000000000000000000000000000000000..ba2728fe7141ed33f21a0c4ec4ce444643d5abbc >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBuffer.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "PlatformImageBufferShareableBackend.h" >+#include "RemoteImageBuffer.h" >+ >+namespace WebKit { >+ >+using UnacceleratedRemoteImageBuffer = RemoteImageBuffer<UnacceleratedImageBufferShareableBackend>; >+using AcceleratedRemoteImageBuffer = RemoteImageBuffer<AcceleratedImageBufferShareableBackend>; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h b/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h >deleted file mode 100644 >index 9aff088e37ca76a7f864ae7e42bbb7004f1f1523..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h >+++ /dev/null >@@ -1,40 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "PlatformImageBufferShareableBackend.h" >-#include "RemoteImageBufferProxy.h" >- >-namespace WebKit { >- >-using UnacceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<UnacceleratedImageBufferShareableBackend>; >-using AcceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<AcceleratedImageBufferShareableBackend>; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h b/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h >new file mode 100644 >index 0000000000000000000000000000000000000000..df5b87a2807b7f40ac4ff0f57fbf4ce1201e2c80 >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/RemoteImageBuffer.h >@@ -0,0 +1,124 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "GPUConnectionToWebProcess.h" >+#include "RemoteImageBufferMessageHandlerProxy.h" >+#include <WebCore/ConcreteImageBuffer.h> >+#include <WebCore/DisplayListReplayer.h> >+ >+namespace WebKit { >+ >+template<typename BackendType> >+class RemoteImageBuffer : public WebCore::ConcreteImageBuffer<BackendType>, public RemoteImageBufferMessageHandler, public WebCore::DisplayList::Replayer::Delegate { >+ using BaseConcreteImageBuffer = WebCore::ConcreteImageBuffer<BackendType>; >+ using BaseConcreteImageBuffer::context; >+ using BaseConcreteImageBuffer::m_backend; >+ >+public: >+ static auto create(const WebCore::FloatSize& size, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackend& remoteRenderingBackend, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ { >+ return BaseConcreteImageBuffer::template create<RemoteImageBuffer>(size, resolutionScale, colorSpace, nullptr, remoteRenderingBackend, remoteResourceIdentifier); >+ } >+ >+ RemoteImageBuffer(std::unique_ptr<BackendType>&& backend, RemoteRenderingBackend& remoteRenderingBackend, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ : BaseConcreteImageBuffer(WTFMove(backend)) >+ , RemoteImageBufferMessageHandler(remoteRenderingBackend, remoteResourceIdentifier) >+ { >+ createBackend(m_backend->logicalSize(), m_backend->backendSize(), m_backend->resolutionScale(), m_backend->colorSpace(), m_backend->createImageBufferBackendHandle()); >+ } >+ >+ ~RemoteImageBuffer() >+ { >+ // Unwind the context's state stack before destruction, since calls to restore may not have >+ // been flushed yet, or the web process may have terminated. >+ while (context().stackSize()) >+ context().restore(); >+ } >+ >+private: >+ using BaseConcreteImageBuffer::flushDrawingContext; >+ using BaseConcreteImageBuffer::putImageData; >+ >+ void flushDrawingContext(const WebCore::DisplayList::DisplayList& displayList) override >+ { >+ if (displayList.itemCount()) { >+ WebCore::DisplayList::Replayer replayer(BaseConcreteImageBuffer::context(), displayList, this); >+ replayer.replay(); >+ } >+ } >+ >+ void flushDrawingContextAndCommit(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier) override >+ { >+ flushDrawingContext(displayList); >+ m_backend->flushContext(); >+ commitFlushContext(flushIdentifier); >+ } >+ >+ RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override >+ { >+ return BaseConcreteImageBuffer::getImageData(outputFormat, srcRect); >+ } >+ >+ bool apply(WebCore::DisplayList::Item& item, WebCore::GraphicsContext& context) override >+ { >+ if (item.type() == WebCore::DisplayList::ItemType::PutImageData) { >+ auto& putImageDataItem = static_cast<WebCore::DisplayList::PutImageData&>(item); >+ putImageData(putImageDataItem.inputFormat(), putImageDataItem.imageData(), putImageDataItem.srcRect(), putImageDataItem.destPoint(), putImageDataItem.destFormat()); >+ return true; >+ } >+ >+ if (item.type() == WebCore::DisplayList::ItemType::PaintFrameForMedia) { >+ apply(static_cast<WebCore::DisplayList::PaintFrameForMedia&>(item), context); >+ return true; >+ } >+ >+ return false; >+ } >+ >+ void apply(WebCore::DisplayList::PaintFrameForMedia& item, WebCore::GraphicsContext& context) >+ { >+ auto process = backend().gpuConnectionToWebProcess(); >+ if (!process) >+ return; >+ >+ auto playerProxy = process->remoteMediaPlayerManagerProxy().getProxy(item.identifier()); >+ if (!playerProxy) >+ return; >+ >+ auto player = playerProxy->mediaPlayer(); >+ if (!player) >+ return; >+ >+ context.paintFrameForMedia(*player, item.destination()); >+ } >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..1697dc818a2b2bdb593c64b314dfb7005ac9dc99 >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp >@@ -0,0 +1,55 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RemoteImageBufferMessageHandler.h" >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "RemoteRenderingBackend.h" >+#include "RemoteRenderingBackendProxyMessages.h" >+ >+namespace WebKit { >+using namespace WebCore; >+ >+RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler(RemoteRenderingBackend& remoteRenderingBackend, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ : m_remoteRenderingBackend(remoteRenderingBackend) >+ , m_remoteResourceIdentifier(remoteResourceIdentifier) >+{ >+} >+ >+void RemoteImageBufferMessageHandler::createBackend(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace colorSpace, ImageBufferBackendHandle handle) >+{ >+ m_remoteRenderingBackend.send(Messages::RemoteRenderingBackendProxy::CreateImageBufferBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle), m_remoteResourceIdentifier), m_remoteRenderingBackend.renderingBackendIdentifier()); >+} >+ >+void RemoteImageBufferMessageHandler::commitFlushContext(ImageBufferFlushIdentifier flushIdentifier) >+{ >+ m_remoteRenderingBackend.send(Messages::RemoteRenderingBackendProxy::CommitImageBufferFlushContext(flushIdentifier, m_remoteResourceIdentifier), m_remoteRenderingBackend.renderingBackendIdentifier()); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.h b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.h >new file mode 100644 >index 0000000000000000000000000000000000000000..c8cbf150ea3e2294169e19e534f1c6ab83066347 >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandler.h >@@ -0,0 +1,71 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "ImageBufferBackendHandle.h" >+#include "ImageBufferFlushIdentifier.h" >+#include <WebCore/ColorSpace.h> >+#include <WebCore/DisplayList.h> >+#include <WebCore/FloatSize.h> >+#include <WebCore/RemoteResourceIdentifier.h> >+ >+namespace WebCore { >+enum class AlphaPremultiplication : uint8_t; >+class ImageData; >+} >+ >+namespace WebKit { >+ >+class RemoteRenderingBackend; >+ >+class RemoteImageBufferMessageHandler { >+public: >+ virtual ~RemoteImageBufferMessageHandler() = default; >+ >+ // Messages to be received. See RemoteRenderingBackend.messages.in. >+ virtual void flushDrawingContext(const WebCore::DisplayList::DisplayList&) = 0; >+ virtual void flushDrawingContextAndCommit(const WebCore::DisplayList::DisplayList&, ImageBufferFlushIdentifier) = 0; >+ virtual RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const = 0; >+ >+protected: >+ RemoteImageBufferMessageHandler(RemoteRenderingBackend&, WebCore::RemoteResourceIdentifier); >+ >+ // Messages to be sent. See RemoteRenderingBackend.messages.in. >+ void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle); >+ void commitFlushContext(ImageBufferFlushIdentifier); >+ >+ RemoteRenderingBackend& backend() { return m_remoteRenderingBackend; } >+ >+private: >+ RemoteRenderingBackend& m_remoteRenderingBackend; >+ WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp >deleted file mode 100644 >index 4f9d152b67442da672eae5a8a85da81c26ab6828..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp >+++ /dev/null >@@ -1,55 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RemoteImageBufferMessageHandlerProxy.h" >- >-#if ENABLE(GPU_PROCESS) >- >-#include "RemoteRenderingBackendMessages.h" >-#include "RemoteRenderingBackendProxy.h" >- >-namespace WebKit { >-using namespace WebCore; >- >-RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy(RemoteRenderingBackendProxy& remoteRenderingBackendProxy, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- : m_remoteRenderingBackendProxy(remoteRenderingBackendProxy) >- , m_remoteResourceIdentifier(remoteResourceIdentifier) >-{ >-} >- >-void RemoteImageBufferMessageHandlerProxy::createBackend(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace colorSpace, ImageBufferBackendHandle handle) >-{ >- m_remoteRenderingBackendProxy.send(Messages::RemoteRenderingBackend::CreateImageBufferBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle), m_remoteResourceIdentifier), m_remoteRenderingBackendProxy.renderingBackendIdentifier()); >-} >- >-void RemoteImageBufferMessageHandlerProxy::commitFlushContext(ImageBufferFlushIdentifier flushIdentifier) >-{ >- m_remoteRenderingBackendProxy.send(Messages::RemoteRenderingBackend::CommitImageBufferFlushContext(flushIdentifier, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy.renderingBackendIdentifier()); >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h >deleted file mode 100644 >index 6b3db4d68b7946577c94eae424ad67f530c9f0f6..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h >+++ /dev/null >@@ -1,71 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "ImageBufferBackendHandle.h" >-#include "ImageBufferFlushIdentifier.h" >-#include <WebCore/ColorSpace.h> >-#include <WebCore/DisplayList.h> >-#include <WebCore/FloatSize.h> >-#include <WebCore/RemoteResourceIdentifier.h> >- >-namespace WebCore { >-enum class AlphaPremultiplication : uint8_t; >-class ImageData; >-} >- >-namespace WebKit { >- >-class RemoteRenderingBackendProxy; >- >-class RemoteImageBufferMessageHandlerProxy { >-public: >- virtual ~RemoteImageBufferMessageHandlerProxy() = default; >- >- // Messages to be received. See RemoteRenderingBackendProxy.messages.in. >- virtual void flushDrawingContext(const WebCore::DisplayList::DisplayList&) = 0; >- virtual void flushDrawingContextAndCommit(const WebCore::DisplayList::DisplayList&, ImageBufferFlushIdentifier) = 0; >- virtual RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const = 0; >- >-protected: >- RemoteImageBufferMessageHandlerProxy(RemoteRenderingBackendProxy&, WebCore::RemoteResourceIdentifier); >- >- // Messages to be sent. See RemoteRenderingBackend.messages.in. >- void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle); >- void commitFlushContext(ImageBufferFlushIdentifier); >- >- RemoteRenderingBackendProxy& backend() { return m_remoteRenderingBackendProxy; } >- >-private: >- RemoteRenderingBackendProxy& m_remoteRenderingBackendProxy; >- WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h b/Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h >deleted file mode 100644 >index b157abbc0d5097e6d98fb566c6c30001602bcae5..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h >+++ /dev/null >@@ -1,124 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "GPUConnectionToWebProcess.h" >-#include "RemoteImageBufferMessageHandlerProxy.h" >-#include <WebCore/ConcreteImageBuffer.h> >-#include <WebCore/DisplayListReplayer.h> >- >-namespace WebKit { >- >-template<typename BackendType> >-class RemoteImageBufferProxy : public WebCore::ConcreteImageBuffer<BackendType>, public RemoteImageBufferMessageHandlerProxy, public WebCore::DisplayList::Replayer::Delegate { >- using BaseConcreteImageBuffer = WebCore::ConcreteImageBuffer<BackendType>; >- using BaseConcreteImageBuffer::context; >- using BaseConcreteImageBuffer::m_backend; >- >-public: >- static auto create(const WebCore::FloatSize& size, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- { >- return BaseConcreteImageBuffer::template create<RemoteImageBufferProxy>(size, resolutionScale, colorSpace, nullptr, remoteRenderingBackendProxy, remoteResourceIdentifier); >- } >- >- RemoteImageBufferProxy(std::unique_ptr<BackendType>&& backend, RemoteRenderingBackendProxy& remoteRenderingBackendProxy, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- : BaseConcreteImageBuffer(WTFMove(backend)) >- , RemoteImageBufferMessageHandlerProxy(remoteRenderingBackendProxy, remoteResourceIdentifier) >- { >- createBackend(m_backend->logicalSize(), m_backend->backendSize(), m_backend->resolutionScale(), m_backend->colorSpace(), m_backend->createImageBufferBackendHandle()); >- } >- >- ~RemoteImageBufferProxy() >- { >- // Unwind the context's state stack before destruction, since calls to restore may not have >- // been flushed yet, or the web process may have terminated. >- while (context().stackSize()) >- context().restore(); >- } >- >-private: >- using BaseConcreteImageBuffer::flushDrawingContext; >- using BaseConcreteImageBuffer::putImageData; >- >- void flushDrawingContext(const WebCore::DisplayList::DisplayList& displayList) override >- { >- if (displayList.itemCount()) { >- WebCore::DisplayList::Replayer replayer(BaseConcreteImageBuffer::context(), displayList, this); >- replayer.replay(); >- } >- } >- >- void flushDrawingContextAndCommit(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier) override >- { >- flushDrawingContext(displayList); >- m_backend->flushContext(); >- commitFlushContext(flushIdentifier); >- } >- >- RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override >- { >- return BaseConcreteImageBuffer::getImageData(outputFormat, srcRect); >- } >- >- bool apply(WebCore::DisplayList::Item& item, WebCore::GraphicsContext& context) override >- { >- if (item.type() == WebCore::DisplayList::ItemType::PutImageData) { >- auto& putImageDataItem = static_cast<WebCore::DisplayList::PutImageData&>(item); >- putImageData(putImageDataItem.inputFormat(), putImageDataItem.imageData(), putImageDataItem.srcRect(), putImageDataItem.destPoint(), putImageDataItem.destFormat()); >- return true; >- } >- >- if (item.type() == WebCore::DisplayList::ItemType::PaintFrameForMedia) { >- apply(static_cast<WebCore::DisplayList::PaintFrameForMedia&>(item), context); >- return true; >- } >- >- return false; >- } >- >- void apply(WebCore::DisplayList::PaintFrameForMedia& item, WebCore::GraphicsContext& context) >- { >- auto process = backend().gpuConnectionToWebProcess(); >- if (!process) >- return; >- >- auto playerProxy = process->remoteMediaPlayerManagerProxy().getProxy(item.identifier()); >- if (!playerProxy) >- return; >- >- auto player = playerProxy->mediaPlayer(); >- if (!player) >- return; >- >- context.paintFrameForMedia(*player, item.destination()); >- } >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..770f45cc813754f594d465eb0cba3b195cb0d81e >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.cpp >@@ -0,0 +1,131 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RemoteRenderingBackend.h" >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "GPUConnectionToWebProcess.h" >+#include "PlatformRemoteImageBuffer.h" >+#include "RemoteRenderingBackendMessages.h" >+ >+namespace WebKit { >+using namespace WebCore; >+ >+std::unique_ptr<RemoteRenderingBackend> RemoteRenderingBackend::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier renderingBackendIdentifier) >+{ >+ return std::unique_ptr<RemoteRenderingBackend>(new RemoteRenderingBackend(gpuConnectionToWebProcess, renderingBackendIdentifier)); >+} >+ >+RemoteRenderingBackend::RemoteRenderingBackend(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier renderingBackendIdentifier) >+ : m_gpuConnectionToWebProcess(makeWeakPtr(gpuConnectionToWebProcess)) >+ , m_renderingBackendIdentifier(renderingBackendIdentifier) >+{ >+ if (auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get()) >+ gpuConnectionToWebProcess->messageReceiverMap().addMessageReceiver(Messages::RemoteRenderingBackend::messageReceiverName(), renderingBackendIdentifier.toUInt64(), *this); >+} >+ >+RemoteRenderingBackend::~RemoteRenderingBackend() >+{ >+ if (auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get()) >+ gpuConnectionToWebProcess->messageReceiverMap().removeMessageReceiver(Messages::RemoteRenderingBackend::messageReceiverName(), m_renderingBackendIdentifier.toUInt64()); >+} >+ >+IPC::Connection* RemoteRenderingBackend::messageSenderConnection() const >+{ >+ if (auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get()) >+ return &gpuConnectionToWebProcess->connection(); >+ return nullptr; >+} >+ >+uint64_t RemoteRenderingBackend::messageSenderDestinationID() const >+{ >+ return m_renderingBackendIdentifier.toUInt64(); >+} >+ >+void RemoteRenderingBackend::createImageBuffer(const FloatSize& logicalSize, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get(); >+ if (!gpuConnectionToWebProcess) >+ return; >+ >+ if (m_imageBufferMessageHandlerMap.contains(remoteResourceIdentifier)) { >+ ASSERT_NOT_REACHED(); >+ return; >+ } >+ >+ if (renderingMode == RenderingMode::RemoteAccelerated) { >+ if (auto imageBuffer = AcceleratedRemoteImageBuffer::create(logicalSize, resolutionScale, colorSpace, *this, remoteResourceIdentifier)) { >+ m_imageBufferMessageHandlerMap.add(remoteResourceIdentifier, WTFMove(imageBuffer)); >+ return; >+ } >+ } >+ >+ if (renderingMode == RenderingMode::RemoteAccelerated || renderingMode == RenderingMode::RemoteUnaccelerated) { >+ if (auto imageBuffer = UnacceleratedRemoteImageBuffer::create(logicalSize, resolutionScale, colorSpace, *this, remoteResourceIdentifier)) { >+ m_imageBufferMessageHandlerMap.add(remoteResourceIdentifier, WTFMove(imageBuffer)); >+ return; >+ } >+ } >+ >+ ASSERT_NOT_REACHED(); >+} >+ >+void RemoteRenderingBackend::releaseRemoteResource(RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ // CreateImageBuffer message should have been received before this one. >+ bool found = m_imageBufferMessageHandlerMap.remove(remoteResourceIdentifier); >+ ASSERT_UNUSED(found, found); >+} >+ >+void RemoteRenderingBackend::getImageData(WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, RemoteResourceIdentifier remoteResourceIdentifier, CompletionHandler<void(IPC::ImageDataReference&&)>&& completionHandler) >+{ >+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) { >+ auto imageData = imageBuffer->getImageData(outputFormat, srcRect); >+ completionHandler(IPC::ImageDataReference(WTFMove(imageData))); >+ } >+} >+ >+void RemoteRenderingBackend::flushImageBufferDrawingContext(const WebCore::DisplayList::DisplayList& displayList, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >+ imageBuffer->flushDrawingContext(displayList); >+} >+ >+void RemoteRenderingBackend::flushImageBufferDrawingContextAndCommit(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >+ imageBuffer->flushDrawingContextAndCommit(displayList, flushIdentifier); >+} >+ >+GPUConnectionToWebProcess* RemoteRenderingBackend::gpuConnectionToWebProcess() const >+{ >+ return m_gpuConnectionToWebProcess.get(); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h >new file mode 100644 >index 0000000000000000000000000000000000000000..64d11adb5a24a4903384e3e616a8ab91eabe80d6 >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.h >@@ -0,0 +1,91 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "Connection.h" >+#include "ImageBufferFlushIdentifier.h" >+#include "ImageDataReference.h" >+#include "MessageReceiver.h" >+#include "MessageSender.h" >+#include "RemoteImageBufferMessageHandler.h" >+#include "RenderingBackendIdentifier.h" >+#include <WebCore/ColorSpace.h> >+#include <WebCore/DisplayListItems.h> >+#include <WebCore/FloatSize.h> >+#include <WebCore/RemoteResourceIdentifier.h> >+#include <WebCore/RenderingMode.h> >+#include <wtf/HashMap.h> >+#include <wtf/WeakPtr.h> >+ >+namespace WebCore { >+namespace DisplayList { >+class DisplayList; >+} >+} >+ >+namespace WebKit { >+ >+class GPUConnectionToWebProcess; >+ >+class RemoteRenderingBackend >+ : public IPC::MessageSender >+ , private IPC::MessageReceiver { >+public: >+ static std::unique_ptr<RemoteRenderingBackend> create(GPUConnectionToWebProcess&, RenderingBackendIdentifier); >+ virtual ~RemoteRenderingBackend(); >+ >+ RenderingBackendIdentifier renderingBackendIdentifier() const { return m_renderingBackendIdentifier; } >+ GPUConnectionToWebProcess* gpuConnectionToWebProcess() const; >+ >+private: >+ RemoteRenderingBackend(GPUConnectionToWebProcess&, RenderingBackendIdentifier); >+ >+ // IPC::MessageSender. >+ IPC::Connection* messageSenderConnection() const override; >+ uint64_t messageSenderDestinationID() const override; >+ >+ // IPC::MessageReceiver >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >+ void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; >+ >+ // Messages to be received. >+ void createImageBuffer(const WebCore::FloatSize& logicalSize, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace, WebCore::RemoteResourceIdentifier); >+ void releaseRemoteResource(WebCore::RemoteResourceIdentifier); >+ void flushImageBufferDrawingContext(const WebCore::DisplayList::DisplayList&, WebCore::RemoteResourceIdentifier); >+ void flushImageBufferDrawingContextAndCommit(const WebCore::DisplayList::DisplayList&, ImageBufferFlushIdentifier, WebCore::RemoteResourceIdentifier); >+ void getImageData(WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, WebCore::RemoteResourceIdentifier, CompletionHandler<void(IPC::ImageDataReference&&)>&&); >+ >+ using ImageBufferMessageHandlerMap = HashMap<WebCore::RemoteResourceIdentifier, std::unique_ptr<RemoteImageBufferMessageHandler>>; >+ ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap; >+ WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess; >+ RenderingBackendIdentifier m_renderingBackendIdentifier; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..b41abc32843a3d7f207a799d3ef66bcb689d1aa8 >--- /dev/null >+++ b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackend.messages.in >@@ -0,0 +1,33 @@ >+# Copyright (C) 2020 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND >+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR >+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+#if ENABLE(GPU_PROCESS) >+ >+messages -> RemoteRenderingBackend NotRefCounted { >+ void CreateImageBuffer(WebCore::FloatSize logicalSize, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ void FlushImageBufferDrawingContext(WebCore::DisplayList::DisplayList displayList, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ void FlushImageBufferDrawingContextAndCommit(WebCore::DisplayList::DisplayList displayList, WebKit::ImageBufferFlushIdentifier flushIdentifier, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ GetImageData(enum:uint8_t WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) -> (IPC::ImageDataReference imageData) Synchronous >+ void ReleaseRemoteResource(WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+} >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp >deleted file mode 100644 >index 2a2e18a1830f8a84dca17c718ae0a040ad6d507f..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp >+++ /dev/null >@@ -1,131 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RemoteRenderingBackendProxy.h" >- >-#if ENABLE(GPU_PROCESS) >- >-#include "GPUConnectionToWebProcess.h" >-#include "PlatformRemoteImageBufferProxy.h" >-#include "RemoteRenderingBackendProxyMessages.h" >- >-namespace WebKit { >-using namespace WebCore; >- >-std::unique_ptr<RemoteRenderingBackendProxy> RemoteRenderingBackendProxy::create(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier renderingBackendIdentifier) >-{ >- return std::unique_ptr<RemoteRenderingBackendProxy>(new RemoteRenderingBackendProxy(gpuConnectionToWebProcess, renderingBackendIdentifier)); >-} >- >-RemoteRenderingBackendProxy::RemoteRenderingBackendProxy(GPUConnectionToWebProcess& gpuConnectionToWebProcess, RenderingBackendIdentifier renderingBackendIdentifier) >- : m_gpuConnectionToWebProcess(makeWeakPtr(gpuConnectionToWebProcess)) >- , m_renderingBackendIdentifier(renderingBackendIdentifier) >-{ >- if (auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get()) >- gpuConnectionToWebProcess->messageReceiverMap().addMessageReceiver(Messages::RemoteRenderingBackendProxy::messageReceiverName(), renderingBackendIdentifier.toUInt64(), *this); >-} >- >-RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy() >-{ >- if (auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get()) >- gpuConnectionToWebProcess->messageReceiverMap().removeMessageReceiver(Messages::RemoteRenderingBackendProxy::messageReceiverName(), m_renderingBackendIdentifier.toUInt64()); >-} >- >-IPC::Connection* RemoteRenderingBackendProxy::messageSenderConnection() const >-{ >- if (auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get()) >- return &gpuConnectionToWebProcess->connection(); >- return nullptr; >-} >- >-uint64_t RemoteRenderingBackendProxy::messageSenderDestinationID() const >-{ >- return m_renderingBackendIdentifier.toUInt64(); >-} >- >-void RemoteRenderingBackendProxy::createImageBuffer(const FloatSize& logicalSize, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- auto* gpuConnectionToWebProcess = m_gpuConnectionToWebProcess.get(); >- if (!gpuConnectionToWebProcess) >- return; >- >- if (m_imageBufferMessageHandlerMap.contains(remoteResourceIdentifier)) { >- ASSERT_NOT_REACHED(); >- return; >- } >- >- if (renderingMode == RenderingMode::RemoteAccelerated) { >- if (auto imageBuffer = AcceleratedRemoteImageBufferProxy::create(logicalSize, resolutionScale, colorSpace, *this, remoteResourceIdentifier)) { >- m_imageBufferMessageHandlerMap.add(remoteResourceIdentifier, WTFMove(imageBuffer)); >- return; >- } >- } >- >- if (renderingMode == RenderingMode::RemoteAccelerated || renderingMode == RenderingMode::RemoteUnaccelerated) { >- if (auto imageBuffer = UnacceleratedRemoteImageBufferProxy::create(logicalSize, resolutionScale, colorSpace, *this, remoteResourceIdentifier)) { >- m_imageBufferMessageHandlerMap.add(remoteResourceIdentifier, WTFMove(imageBuffer)); >- return; >- } >- } >- >- ASSERT_NOT_REACHED(); >-} >- >-void RemoteRenderingBackendProxy::releaseRemoteResource(RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- // CreateImageBuffer message should have been received before this one. >- bool found = m_imageBufferMessageHandlerMap.remove(remoteResourceIdentifier); >- ASSERT_UNUSED(found, found); >-} >- >-void RemoteRenderingBackendProxy::getImageData(WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, RemoteResourceIdentifier remoteResourceIdentifier, CompletionHandler<void(IPC::ImageDataReference&&)>&& completionHandler) >-{ >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) { >- auto imageData = imageBuffer->getImageData(outputFormat, srcRect); >- completionHandler(IPC::ImageDataReference(WTFMove(imageData))); >- } >-} >- >-void RemoteRenderingBackendProxy::flushImageBufferDrawingContext(const WebCore::DisplayList::DisplayList& displayList, RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >- imageBuffer->flushDrawingContext(displayList); >-} >- >-void RemoteRenderingBackendProxy::flushImageBufferDrawingContextAndCommit(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier, RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >- imageBuffer->flushDrawingContextAndCommit(displayList, flushIdentifier); >-} >- >-GPUConnectionToWebProcess* RemoteRenderingBackendProxy::gpuConnectionToWebProcess() const >-{ >- return m_gpuConnectionToWebProcess.get(); >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h >deleted file mode 100644 >index c610357e415862cf2e09318c6631d3819b0ed48f..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h >+++ /dev/null >@@ -1,91 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "Connection.h" >-#include "ImageBufferFlushIdentifier.h" >-#include "ImageDataReference.h" >-#include "MessageReceiver.h" >-#include "MessageSender.h" >-#include "RemoteImageBufferMessageHandlerProxy.h" >-#include "RenderingBackendIdentifier.h" >-#include <WebCore/ColorSpace.h> >-#include <WebCore/DisplayListItems.h> >-#include <WebCore/FloatSize.h> >-#include <WebCore/RemoteResourceIdentifier.h> >-#include <WebCore/RenderingMode.h> >-#include <wtf/HashMap.h> >-#include <wtf/WeakPtr.h> >- >-namespace WebCore { >-namespace DisplayList { >-class DisplayList; >-} >-} >- >-namespace WebKit { >- >-class GPUConnectionToWebProcess; >- >-class RemoteRenderingBackendProxy >- : public IPC::MessageSender >- , private IPC::MessageReceiver { >-public: >- static std::unique_ptr<RemoteRenderingBackendProxy> create(GPUConnectionToWebProcess&, RenderingBackendIdentifier); >- virtual ~RemoteRenderingBackendProxy(); >- >- RenderingBackendIdentifier renderingBackendIdentifier() const { return m_renderingBackendIdentifier; } >- GPUConnectionToWebProcess* gpuConnectionToWebProcess() const; >- >-private: >- RemoteRenderingBackendProxy(GPUConnectionToWebProcess&, RenderingBackendIdentifier); >- >- // IPC::MessageSender. >- IPC::Connection* messageSenderConnection() const override; >- uint64_t messageSenderDestinationID() const override; >- >- // IPC::MessageReceiver >- void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >- void didReceiveSyncMessage(IPC::Connection&, IPC::Decoder&, std::unique_ptr<IPC::Encoder>&) override; >- >- // Messages to be received. >- void createImageBuffer(const WebCore::FloatSize& logicalSize, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace, WebCore::RemoteResourceIdentifier); >- void releaseRemoteResource(WebCore::RemoteResourceIdentifier); >- void flushImageBufferDrawingContext(const WebCore::DisplayList::DisplayList&, WebCore::RemoteResourceIdentifier); >- void flushImageBufferDrawingContextAndCommit(const WebCore::DisplayList::DisplayList&, ImageBufferFlushIdentifier, WebCore::RemoteResourceIdentifier); >- void getImageData(WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, WebCore::RemoteResourceIdentifier, CompletionHandler<void(IPC::ImageDataReference&&)>&&); >- >- using ImageBufferMessageHandlerMap = HashMap<WebCore::RemoteResourceIdentifier, std::unique_ptr<RemoteImageBufferMessageHandlerProxy>>; >- ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap; >- WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess; >- RenderingBackendIdentifier m_renderingBackendIdentifier; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in b/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in >deleted file mode 100644 >index 26cf1361fdab0eb0d3faf77e5f7d2d1c56f940b7..0000000000000000000000000000000000000000 >--- a/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in >+++ /dev/null >@@ -1,33 +0,0 @@ >-# Copyright (C) 2020 Apple Inc. All rights reserved. >-# >-# Redistribution and use in source and binary forms, with or without >-# modification, are permitted provided that the following conditions >-# are met: >-# 1. Redistributions of source code must retain the above copyright >-# notice, this list of conditions and the following disclaimer. >-# 2. Redistributions in binary form must reproduce the above copyright >-# notice, this list of conditions and the following disclaimer in the >-# documentation and/or other materials provided with the distribution. >-# >-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND >-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >-# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR >-# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- >-#if ENABLE(GPU_PROCESS) >- >-messages -> RemoteRenderingBackendProxy NotRefCounted { >- void CreateImageBuffer(WebCore::FloatSize logicalSize, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- void FlushImageBufferDrawingContext(WebCore::DisplayList::DisplayList displayList, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- void FlushImageBufferDrawingContextAndCommit(WebCore::DisplayList::DisplayList displayList, WebKit::ImageBufferFlushIdentifier flushIdentifier, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- GetImageData(enum:uint8_t WebCore::AlphaPremultiplication outputFormat, WebCore::IntRect srcRect, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) -> (IPC::ImageDataReference imageData) Synchronous >- void ReleaseRemoteResource(WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >-} >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp b/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp >index 9f7e8bfff6d1ba4514909d9af5dc7e90e9018762..49ef48dbfe6d5529220c70f3a11975f9feb86bdd 100644 >--- a/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp >+++ b/Source/WebKit/GPUProcess/media/RemoteCDMInstanceSessionProxy.cpp >@@ -32,6 +32,7 @@ > #include "RemoteCDMFactoryProxy.h" > #include "RemoteCDMInstanceSessionMessages.h" > #include "SharedBufferCopy.h" >+#include "WebCoreArgumentCoders.h" > > namespace WebKit { > >diff --git a/Source/WebKit/Sources.txt b/Source/WebKit/Sources.txt >index daf5fb7313bdd98068dedd39cbac4dfbe9377ca8..953962db5ba0298c3bca8cbe39e9eae11b6188ad 100644 >--- a/Source/WebKit/Sources.txt >+++ b/Source/WebKit/Sources.txt >@@ -24,8 +24,8 @@ > GPUProcess/GPUProcess.cpp > GPUProcess/GPUConnectionToWebProcess.cpp > GPUProcess/GPUProcessCreationParameters.cpp >-GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp >-GPUProcess/graphics/RemoteRenderingBackendProxy.cpp >+GPUProcess/graphics/RemoteImageBufferMessageHandler.cpp >+GPUProcess/graphics/RemoteRenderingBackend.cpp > GPUProcess/media/RemoteAudioSessionProxy.cpp > GPUProcess/media/RemoteAudioSessionProxyManager.cpp > GPUProcess/media/RemoteAudioTrackProxy.cpp >@@ -552,8 +552,8 @@ WebProcess/MediaStream/UserMediaPermissionRequestManager.cpp > > WebProcess/GPU/GPUProcessConnection.cpp > WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp >-WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp >-WebProcess/GPU/graphics/RemoteRenderingBackend.cpp >+WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp >+WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp > WebProcess/GPU/media/AudioTrackPrivateRemote.cpp > WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp > WebProcess/GPU/media/RemoteAudioDestinationProxy.cpp >diff --git a/Source/WebKit/WebKit.xcodeproj/project.pbxproj b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >index 0eda15a35fdba5c72242c13858f738c4ac6f8a0e..45ccc75ec10813111d274f16d42f9122a4f8a3ed 100644 >--- a/Source/WebKit/WebKit.xcodeproj/project.pbxproj >+++ b/Source/WebKit/WebKit.xcodeproj/project.pbxproj >@@ -3887,15 +3887,15 @@ > 53CFBBC62224D1B000266546 /* TextCheckerCompletion.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TextCheckerCompletion.cpp; sourceTree = "<group>"; }; > 53CFBBC72224D1B000266546 /* TextCheckerCompletion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextCheckerCompletion.h; sourceTree = "<group>"; }; > 53F3CAA5206C443E0086490E /* NetworkActivityTracker.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = NetworkActivityTracker.cpp; sourceTree = "<group>"; }; >- 5506409D2407160900AAE045 /* RemoteRenderingBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteRenderingBackend.cpp; sourceTree = "<group>"; }; >- 5506409E2407160900AAE045 /* RemoteRenderingBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRenderingBackend.h; sourceTree = "<group>"; }; >+ 5506409D2407160900AAE045 /* RemoteRenderingBackendProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteRenderingBackendProxy.cpp; sourceTree = "<group>"; }; >+ 5506409E2407160900AAE045 /* RemoteRenderingBackendProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRenderingBackendProxy.h; sourceTree = "<group>"; }; > 5506409F2407196A00AAE045 /* RenderingBackendIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RenderingBackendIdentifier.h; sourceTree = "<group>"; }; >- 550640A0240719E100AAE045 /* RemoteRenderingBackend.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteRenderingBackend.messages.in; sourceTree = "<group>"; }; >- 550640A224071A6100AAE045 /* RemoteRenderingBackendProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteRenderingBackendProxy.cpp; sourceTree = "<group>"; }; >- 550640A324071A6100AAE045 /* RemoteRenderingBackendProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRenderingBackendProxy.h; sourceTree = "<group>"; }; >- 550640A424071C2100AAE045 /* RemoteRenderingBackendProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteRenderingBackendProxy.messages.in; sourceTree = "<group>"; }; >- 55AD09422408A02E00DE4D2F /* RemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferProxy.h; sourceTree = "<group>"; }; >- 55AD09432408A0E600DE4D2F /* PlatformRemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBufferProxy.h; sourceTree = "<group>"; }; >+ 550640A0240719E100AAE045 /* RemoteRenderingBackendProxy.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteRenderingBackendProxy.messages.in; sourceTree = "<group>"; }; >+ 550640A224071A6100AAE045 /* RemoteRenderingBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteRenderingBackend.cpp; sourceTree = "<group>"; }; >+ 550640A324071A6100AAE045 /* RemoteRenderingBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteRenderingBackend.h; sourceTree = "<group>"; }; >+ 550640A424071C2100AAE045 /* RemoteRenderingBackend.messages.in */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = RemoteRenderingBackend.messages.in; sourceTree = "<group>"; }; >+ 55AD09422408A02E00DE4D2F /* RemoteImageBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBuffer.h; sourceTree = "<group>"; }; >+ 55AD09432408A0E600DE4D2F /* PlatformRemoteImageBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBuffer.h; sourceTree = "<group>"; }; > 55AD09442408ABB300DE4D2F /* ImageBufferFlushIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBufferFlushIdentifier.h; sourceTree = "<group>"; }; > 570AB8F220AE3BD700B8BE87 /* SecKeyProxyStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = SecKeyProxyStore.h; sourceTree = "<group>"; }; > 570AB90020B2517400B8BE87 /* AuthenticationChallengeProxyCocoa.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AuthenticationChallengeProxyCocoa.mm; sourceTree = "<group>"; }; >@@ -4181,18 +4181,18 @@ > 71A676A422C62318007D6295 /* WKTouchActionGestureRecognizer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKTouchActionGestureRecognizer.h; path = ios/WKTouchActionGestureRecognizer.h; sourceTree = "<group>"; }; > 71A676A522C62318007D6295 /* WKTouchActionGestureRecognizer.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKTouchActionGestureRecognizer.mm; path = ios/WKTouchActionGestureRecognizer.mm; sourceTree = "<group>"; }; > 71FB810A2260627A00323677 /* WebsiteSimulatedMouseEventsDispatchPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebsiteSimulatedMouseEventsDispatchPolicy.h; sourceTree = "<group>"; }; >- 7227800B2408BD7D007D376B /* PlatformRemoteImageBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBuffer.h; sourceTree = "<group>"; }; >- 7227800C24097A02007D376B /* RemoteImageBufferMessageHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteImageBufferMessageHandler.cpp; sourceTree = "<group>"; }; >- 7227800D24097A02007D376B /* RemoteImageBufferMessageHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferMessageHandler.h; sourceTree = "<group>"; }; >- 722780112409906E007D376B /* RemoteImageBufferMessageHandlerProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteImageBufferMessageHandlerProxy.cpp; sourceTree = "<group>"; }; >- 722780122409906E007D376B /* RemoteImageBufferMessageHandlerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferMessageHandlerProxy.h; sourceTree = "<group>"; }; >+ 7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = PlatformRemoteImageBufferProxy.h; sourceTree = "<group>"; }; >+ 7227800C24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteImageBufferMessageHandlerProxy.cpp; sourceTree = "<group>"; }; >+ 7227800D24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferMessageHandlerProxy.h; sourceTree = "<group>"; }; >+ 722780112409906E007D376B /* RemoteImageBufferMessageHandler.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = RemoteImageBufferMessageHandler.cpp; sourceTree = "<group>"; }; >+ 722780122409906E007D376B /* RemoteImageBufferMessageHandler.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferMessageHandler.h; sourceTree = "<group>"; }; > 727A7F342407857D004D2931 /* ImageBufferShareableIOSurfaceBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferShareableIOSurfaceBackend.cpp; sourceTree = "<group>"; }; > 727A7F352407857F004D2931 /* ImageBufferShareableIOSurfaceBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferShareableIOSurfaceBackend.h; sourceTree = "<group>"; }; > 727A7F36240788F0004D2931 /* ImageBufferShareableBitmapBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferShareableBitmapBackend.h; sourceTree = "<group>"; }; > 727A7F37240788F0004D2931 /* ImageBufferShareableBitmapBackend.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferShareableBitmapBackend.cpp; sourceTree = "<group>"; }; > 727A7F38240788F0004D2931 /* PlatformImageBufferShareableBackend.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PlatformImageBufferShareableBackend.h; sourceTree = "<group>"; }; > 727A7F39240788F1004D2931 /* ImageBufferBackendHandle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageBufferBackendHandle.h; sourceTree = "<group>"; }; >- 727A7F492408AEE6004D2931 /* RemoteImageBuffer.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBuffer.h; sourceTree = "<group>"; }; >+ 727A7F492408AEE6004D2931 /* RemoteImageBufferProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteImageBufferProxy.h; sourceTree = "<group>"; }; > 728E86EF1795188C0087879E /* WebColorPickerMac.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebColorPickerMac.h; sourceTree = "<group>"; }; > 728E86F01795188C0087879E /* WebColorPickerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = WebColorPickerMac.mm; sourceTree = "<group>"; }; > 75A8D2C4187CCF9F00C39C9E /* WKWebsiteDataStore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WKWebsiteDataStore.h; sourceTree = "<group>"; }; >@@ -4532,7 +4532,7 @@ > 9B1229D023FF2A5E008CA751 /* RemoteAudioDestinationIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RemoteAudioDestinationIdentifier.h; sourceTree = "<group>"; }; > 9B47908C25314D8300EC11AB /* MessageArgumentDescriptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MessageArgumentDescriptions.h; sourceTree = "<group>"; }; > 9B47908E253151CC00EC11AB /* JSIPCBinding.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = JSIPCBinding.h; sourceTree = "<group>"; }; >- 9B4790902531563200EC11AB /* MessageArgumentDescriptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MessageArgumentDescriptions.cpp; path = MessageArgumentDescriptions.cpp; sourceTree = "<group>"; }; >+ 9B4790902531563200EC11AB /* MessageArgumentDescriptions.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MessageArgumentDescriptions.cpp; sourceTree = "<group>"; }; > 9B5499AC2362A6F600DF8BA5 /* _WKTextManipulationConfiguration.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKTextManipulationConfiguration.h; sourceTree = "<group>"; }; > 9B5499AE2362A7A700DF8BA5 /* _WKTextManipulationConfiguration.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = _WKTextManipulationConfiguration.mm; sourceTree = "<group>"; }; > 9B5499B02362A7EC00DF8BA5 /* _WKTextManipulationExclusionRule.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = _WKTextManipulationExclusionRule.h; sourceTree = "<group>"; }; >@@ -8092,13 +8092,13 @@ > 727A7F37240788F0004D2931 /* ImageBufferShareableBitmapBackend.cpp */, > 727A7F36240788F0004D2931 /* ImageBufferShareableBitmapBackend.h */, > 727A7F38240788F0004D2931 /* PlatformImageBufferShareableBackend.h */, >- 7227800B2408BD7D007D376B /* PlatformRemoteImageBuffer.h */, >- 727A7F492408AEE6004D2931 /* RemoteImageBuffer.h */, >- 7227800C24097A02007D376B /* RemoteImageBufferMessageHandler.cpp */, >- 7227800D24097A02007D376B /* RemoteImageBufferMessageHandler.h */, >- 5506409D2407160900AAE045 /* RemoteRenderingBackend.cpp */, >- 5506409E2407160900AAE045 /* RemoteRenderingBackend.h */, >- 550640A0240719E100AAE045 /* RemoteRenderingBackend.messages.in */, >+ 7227800B2408BD7D007D376B /* PlatformRemoteImageBufferProxy.h */, >+ 7227800C24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.cpp */, >+ 7227800D24097A02007D376B /* RemoteImageBufferMessageHandlerProxy.h */, >+ 727A7F492408AEE6004D2931 /* RemoteImageBufferProxy.h */, >+ 5506409D2407160900AAE045 /* RemoteRenderingBackendProxy.cpp */, >+ 5506409E2407160900AAE045 /* RemoteRenderingBackendProxy.h */, >+ 550640A0240719E100AAE045 /* RemoteRenderingBackendProxy.messages.in */, > 5506409F2407196A00AAE045 /* RenderingBackendIdentifier.h */, > ); > path = graphics; >@@ -8107,13 +8107,13 @@ > 550640A124071A2900AAE045 /* graphics */ = { > isa = PBXGroup; > children = ( >- 55AD09432408A0E600DE4D2F /* PlatformRemoteImageBufferProxy.h */, >- 722780112409906E007D376B /* RemoteImageBufferMessageHandlerProxy.cpp */, >- 722780122409906E007D376B /* RemoteImageBufferMessageHandlerProxy.h */, >- 55AD09422408A02E00DE4D2F /* RemoteImageBufferProxy.h */, >- 550640A224071A6100AAE045 /* RemoteRenderingBackendProxy.cpp */, >- 550640A324071A6100AAE045 /* RemoteRenderingBackendProxy.h */, >- 550640A424071C2100AAE045 /* RemoteRenderingBackendProxy.messages.in */, >+ 55AD09432408A0E600DE4D2F /* PlatformRemoteImageBuffer.h */, >+ 55AD09422408A02E00DE4D2F /* RemoteImageBuffer.h */, >+ 722780112409906E007D376B /* RemoteImageBufferMessageHandler.cpp */, >+ 722780122409906E007D376B /* RemoteImageBufferMessageHandler.h */, >+ 550640A224071A6100AAE045 /* RemoteRenderingBackend.cpp */, >+ 550640A324071A6100AAE045 /* RemoteRenderingBackend.h */, >+ 550640A424071C2100AAE045 /* RemoteRenderingBackend.messages.in */, > ); > path = graphics; > sourceTree = "<group>"; >diff --git a/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h b/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h >deleted file mode 100644 >index ba2728fe7141ed33f21a0c4ec4ce444643d5abbc..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h >+++ /dev/null >@@ -1,40 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "PlatformImageBufferShareableBackend.h" >-#include "RemoteImageBuffer.h" >- >-namespace WebKit { >- >-using UnacceleratedRemoteImageBuffer = RemoteImageBuffer<UnacceleratedImageBufferShareableBackend>; >-using AcceleratedRemoteImageBuffer = RemoteImageBuffer<AcceleratedImageBufferShareableBackend>; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h b/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..9aff088e37ca76a7f864ae7e42bbb7004f1f1523 >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h >@@ -0,0 +1,40 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "PlatformImageBufferShareableBackend.h" >+#include "RemoteImageBufferProxy.h" >+ >+namespace WebKit { >+ >+using UnacceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<UnacceleratedImageBufferShareableBackend>; >+using AcceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<AcceleratedImageBufferShareableBackend>; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h >deleted file mode 100644 >index e8491664514596287ef2c78f9076e1d4382191f2..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h >+++ /dev/null >@@ -1,122 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "RemoteImageBufferMessageHandler.h" >-#include <WebCore/DisplayListImageBuffer.h> >-#include <WebCore/DisplayListItems.h> >-#include <WebCore/DisplayListRecorder.h> >- >-namespace WebKit { >- >-class RemoteRenderingBackend; >- >-template<typename BackendType> >-class RemoteImageBuffer : public WebCore::DisplayList::ImageBuffer<BackendType>, public RemoteImageBufferMessageHandler { >- using BaseDisplayListImageBuffer = WebCore::DisplayList::ImageBuffer<BackendType>; >- using BaseDisplayListImageBuffer::m_backend; >- using BaseDisplayListImageBuffer::m_drawingContext; >- >-public: >- static std::unique_ptr<RemoteImageBuffer> create(const WebCore::FloatSize& size, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackend& remoteRenderingBackend) >- { >- if (BackendType::calculateBackendSize(size, resolutionScale).isEmpty()) >- return nullptr; >- >- return std::unique_ptr<RemoteImageBuffer>(new RemoteImageBuffer(size, renderingMode, resolutionScale, colorSpace, remoteRenderingBackend)); >- } >- >- ~RemoteImageBuffer() >- { >- flushDrawingContext(); >- } >- >-protected: >- RemoteImageBuffer(const WebCore::FloatSize& size, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackend& remoteRenderingBackend) >- : BaseDisplayListImageBuffer(size) >- , RemoteImageBufferMessageHandler(size, renderingMode, resolutionScale, colorSpace, remoteRenderingBackend) >- { >- } >- >- void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, ImageBufferBackendHandle handle) override >- { >- ASSERT(!m_backend); >- m_backend = BackendType::create(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); >- } >- >- bool isBackendCreated() const override { return m_backend.get(); } >- >- BackendType* ensureBackendCreated() const override >- { >- if (!m_backend) >- const_cast<RemoteImageBuffer&>(*this).RemoteImageBufferMessageHandler::waitForCreateImageBufferBackend(); >- return m_backend.get(); >- } >- >- RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override >- { >- auto& displayList = const_cast<RemoteImageBuffer*>(this)->m_drawingContext.displayList(); >- const_cast<RemoteImageBuffer*>(this)->RemoteImageBufferMessageHandler::flushDrawingContext(displayList); >- auto result = const_cast<RemoteImageBuffer*>(this)->RemoteImageBufferMessageHandler::getImageData(outputFormat, srcRect); >- // getImageData is synchronous, which means we've already received the CommitImageBufferFlushContext message. >- return result; >- } >- >- void putImageData(WebCore::AlphaPremultiplication inputFormat, const WebCore::ImageData& imageData, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint = { }, WebCore::AlphaPremultiplication destFormat = WebCore::AlphaPremultiplication::Premultiplied) override >- { >- // The math inside ImageData::create() doesn't agree with the math inside ImageBufferBackend::putImageData() about how m_resolutionScale interacts with the data in the ImageBuffer. >- // This means that putImageData() is only called when m_resolutionScale == 1. >- ASSERT(m_backend->resolutionScale() == 1); >- m_drawingContext.recorder().putImageData(inputFormat, imageData, srcRect, destPoint, destFormat); >- } >- >- void flushContext() override >- { >- flushDrawingContext(); >- m_backend->flushContext(); >- } >- >- void flushDrawingContext() override >- { >- auto& displayList = m_drawingContext.displayList(); >- if (displayList.itemCount()) >- RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit(displayList); >- } >- >- void willAppendItem(const WebCore::DisplayList::Item&) override >- { >- constexpr size_t DisplayListBatchSize = 512; >- auto& displayList = m_drawingContext.displayList(); >- if (displayList.itemCount() >= DisplayListBatchSize) >- RemoteImageBufferMessageHandler::flushDrawingContext(displayList); >- } >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp >deleted file mode 100644 >index 4e9b762d8e0cf5fff87f1c42845af004a8da1dab..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp >+++ /dev/null >@@ -1,99 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RemoteImageBufferMessageHandler.h" >- >-#if ENABLE(GPU_PROCESS) >- >-#include "ImageDataReference.h" >-#include "RemoteRenderingBackend.h" >-#include "RemoteRenderingBackendProxyMessages.h" >-#include <WebCore/DisplayListItems.h> >- >-namespace WebKit { >-using namespace WebCore; >- >-RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace, RemoteRenderingBackend& remoteRenderingBackend) >- : m_remoteRenderingBackend(makeWeakPtr(remoteRenderingBackend)) >-{ >- // Create the RemoteImageBufferProxy. >- m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::CreateImageBuffer(size, renderingMode, resolutionScale, colorSpace, m_remoteResourceIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier()); >-} >- >-RemoteImageBufferMessageHandler::~RemoteImageBufferMessageHandler() >-{ >- // Release the RemoteImageBufferProxy. >- if (!m_remoteRenderingBackend) >- return; >- m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::ReleaseRemoteResource(m_remoteResourceIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier()); >-} >- >-RefPtr<ImageData> RemoteImageBufferMessageHandler::getImageData(AlphaPremultiplication outputFormat, const IntRect& srcRect) const >-{ >- IPC::ImageDataReference imageDataReference; >- m_remoteRenderingBackend->sendSync(Messages::RemoteRenderingBackendProxy::GetImageData(outputFormat, srcRect, m_remoteResourceIdentifier), Messages::RemoteRenderingBackendProxy::GetImageData::Reply(imageDataReference), m_remoteRenderingBackend->renderingBackendIdentifier(), 1_s); >- return imageDataReference.buffer(); >-} >- >-void RemoteImageBufferMessageHandler::waitForCreateImageBufferBackend() >-{ >- if (m_remoteRenderingBackend && !isBackendCreated()) >- m_remoteRenderingBackend->waitForCreateImageBufferBackend(); >-} >- >-void RemoteImageBufferMessageHandler::waitForCommitImageBufferFlushContext() >-{ >- if (m_remoteRenderingBackend && isPendingFlush()) >- m_remoteRenderingBackend->waitForCommitImageBufferFlushContext(); >-} >- >-void RemoteImageBufferMessageHandler::flushDrawingContext(WebCore::DisplayList::DisplayList& displayList) >-{ >- if (!m_remoteRenderingBackend) >- return; >- >- m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::FlushImageBufferDrawingContext(displayList, m_remoteResourceIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier()); >- displayList.clear(); >-} >- >-void RemoteImageBufferMessageHandler::flushDrawingContextAndWaitCommit(WebCore::DisplayList::DisplayList& displayList) >-{ >- if (!m_remoteRenderingBackend) >- return; >- m_sentFlushIdentifier = ImageBufferFlushIdentifier::generate(); >- m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::FlushImageBufferDrawingContextAndCommit(displayList, m_sentFlushIdentifier, m_remoteResourceIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier()); >- displayList.clear(); >- waitForCommitImageBufferFlushContext(); >-} >- >-void RemoteImageBufferMessageHandler::commitFlushContext(ImageBufferFlushIdentifier flushIdentifier) >-{ >- m_receivedFlushIdentifier = flushIdentifier; >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h >deleted file mode 100644 >index 6cfc85895a518aa4f78e9542b90c8a134bda86b8..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h >+++ /dev/null >@@ -1,83 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "ImageBufferBackendHandle.h" >-#include "ImageBufferFlushIdentifier.h" >-#include <WebCore/ColorSpace.h> >-#include <WebCore/DisplayList.h> >-#include <WebCore/FloatSize.h> >-#include <WebCore/RemoteResourceIdentifier.h> >-#include <WebCore/RenderingMode.h> >- >-namespace WebCore { >-class ImageData; >-enum class AlphaPremultiplication : uint8_t; >-} >- >-namespace WebKit { >- >-class RemoteRenderingBackend; >- >-class RemoteImageBufferMessageHandler { >-public: >- virtual ~RemoteImageBufferMessageHandler(); >- >- WebCore::RemoteResourceIdentifier remoteResourceIdentifier() const { return m_remoteResourceIdentifier; } >- >- // Messages to be received. See RemoteRenderingBackend.messages.in. >- virtual void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle) = 0; >- >- void commitFlushContext(ImageBufferFlushIdentifier); >- >-protected: >- RemoteImageBufferMessageHandler(const WebCore::FloatSize&, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace, RemoteRenderingBackend&); >- >- virtual bool isBackendCreated() const = 0; >- bool isPendingFlush() const { return m_sentFlushIdentifier != m_receivedFlushIdentifier; } >- >- RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const; >- >- void waitForCreateImageBufferBackend(); >- void waitForCommitImageBufferFlushContext(); >- >- // Messages to be sent. See RemoteRenderingBackendProxy.messages.in. >- void flushDrawingContext(WebCore::DisplayList::DisplayList&); >- void flushDrawingContextAndWaitCommit(WebCore::DisplayList::DisplayList&); >- >-private: >- WeakPtr<RemoteRenderingBackend> m_remoteRenderingBackend; >- WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier { WebCore::RemoteResourceIdentifier::generate() }; >- >- ImageBufferFlushIdentifier m_sentFlushIdentifier; >- ImageBufferFlushIdentifier m_receivedFlushIdentifier; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..e60aad8e3079363137680d54a44f900b2a325c0d >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.cpp >@@ -0,0 +1,99 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RemoteImageBufferMessageHandlerProxy.h" >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "ImageDataReference.h" >+#include "RemoteRenderingBackendMessages.h" >+#include "RemoteRenderingBackendProxy.h" >+#include <WebCore/DisplayListItems.h> >+ >+namespace WebKit { >+using namespace WebCore; >+ >+RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >+ : m_remoteRenderingBackendProxy(makeWeakPtr(remoteRenderingBackendProxy)) >+{ >+ // Create the RemoteImageBufferProxy. >+ m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::CreateImageBuffer(size, renderingMode, resolutionScale, colorSpace, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >+} >+ >+RemoteImageBufferMessageHandlerProxy::~RemoteImageBufferMessageHandlerProxy() >+{ >+ // Release the RemoteImageBufferProxy. >+ if (!m_remoteRenderingBackendProxy) >+ return; >+ m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::ReleaseRemoteResource(m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >+} >+ >+RefPtr<ImageData> RemoteImageBufferMessageHandlerProxy::getImageData(AlphaPremultiplication outputFormat, const IntRect& srcRect) const >+{ >+ IPC::ImageDataReference imageDataReference; >+ m_remoteRenderingBackendProxy->sendSync(Messages::RemoteRenderingBackend::GetImageData(outputFormat, srcRect, m_remoteResourceIdentifier), Messages::RemoteRenderingBackend::GetImageData::Reply(imageDataReference), m_remoteRenderingBackendProxy->renderingBackendIdentifier(), 1_s); >+ return imageDataReference.buffer(); >+} >+ >+void RemoteImageBufferMessageHandlerProxy::waitForCreateImageBufferBackend() >+{ >+ if (m_remoteRenderingBackendProxy && !isBackendCreated()) >+ m_remoteRenderingBackendProxy->waitForCreateImageBufferBackend(); >+} >+ >+void RemoteImageBufferMessageHandlerProxy::waitForCommitImageBufferFlushContext() >+{ >+ if (m_remoteRenderingBackendProxy && isPendingFlush()) >+ m_remoteRenderingBackendProxy->waitForCommitImageBufferFlushContext(); >+} >+ >+void RemoteImageBufferMessageHandlerProxy::flushDrawingContext(WebCore::DisplayList::DisplayList& displayList) >+{ >+ if (!m_remoteRenderingBackendProxy) >+ return; >+ >+ m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::FlushImageBufferDrawingContext(displayList, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >+ displayList.clear(); >+} >+ >+void RemoteImageBufferMessageHandlerProxy::flushDrawingContextAndWaitCommit(WebCore::DisplayList::DisplayList& displayList) >+{ >+ if (!m_remoteRenderingBackendProxy) >+ return; >+ m_sentFlushIdentifier = ImageBufferFlushIdentifier::generate(); >+ m_remoteRenderingBackendProxy->send(Messages::RemoteRenderingBackend::FlushImageBufferDrawingContextAndCommit(displayList, m_sentFlushIdentifier, m_remoteResourceIdentifier), m_remoteRenderingBackendProxy->renderingBackendIdentifier()); >+ displayList.clear(); >+ waitForCommitImageBufferFlushContext(); >+} >+ >+void RemoteImageBufferMessageHandlerProxy::commitFlushContext(ImageBufferFlushIdentifier flushIdentifier) >+{ >+ m_receivedFlushIdentifier = flushIdentifier; >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e7a0aceb673fe30c7e074696bbeb5467c6353faf >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandlerProxy.h >@@ -0,0 +1,83 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "ImageBufferBackendHandle.h" >+#include "ImageBufferFlushIdentifier.h" >+#include <WebCore/ColorSpace.h> >+#include <WebCore/DisplayList.h> >+#include <WebCore/FloatSize.h> >+#include <WebCore/RemoteResourceIdentifier.h> >+#include <WebCore/RenderingMode.h> >+ >+namespace WebCore { >+class ImageData; >+enum class AlphaPremultiplication : uint8_t; >+} >+ >+namespace WebKit { >+ >+class RemoteRenderingBackendProxy; >+ >+class RemoteImageBufferMessageHandlerProxy { >+public: >+ virtual ~RemoteImageBufferMessageHandlerProxy(); >+ >+ WebCore::RemoteResourceIdentifier remoteResourceIdentifier() const { return m_remoteResourceIdentifier; } >+ >+ // Messages to be received. See RemoteRenderingBackend.messages.in. >+ virtual void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle) = 0; >+ >+ void commitFlushContext(ImageBufferFlushIdentifier); >+ >+protected: >+ RemoteImageBufferMessageHandlerProxy(const WebCore::FloatSize&, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace, RemoteRenderingBackendProxy&); >+ >+ virtual bool isBackendCreated() const = 0; >+ bool isPendingFlush() const { return m_sentFlushIdentifier != m_receivedFlushIdentifier; } >+ >+ RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const; >+ >+ void waitForCreateImageBufferBackend(); >+ void waitForCommitImageBufferFlushContext(); >+ >+ // Messages to be sent. See RemoteRenderingBackendProxy.messages.in. >+ void flushDrawingContext(WebCore::DisplayList::DisplayList&); >+ void flushDrawingContextAndWaitCommit(WebCore::DisplayList::DisplayList&); >+ >+private: >+ WeakPtr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy; >+ WebCore::RemoteResourceIdentifier m_remoteResourceIdentifier { WebCore::RemoteResourceIdentifier::generate() }; >+ >+ ImageBufferFlushIdentifier m_sentFlushIdentifier; >+ ImageBufferFlushIdentifier m_receivedFlushIdentifier; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..1f662e009186c6b6f495b58db32f0358992d343d >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferProxy.h >@@ -0,0 +1,122 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "RemoteImageBufferMessageHandlerProxy.h" >+#include <WebCore/DisplayListImageBuffer.h> >+#include <WebCore/DisplayListItems.h> >+#include <WebCore/DisplayListRecorder.h> >+ >+namespace WebKit { >+ >+class RemoteRenderingBackend; >+ >+template<typename BackendType> >+class RemoteImageBufferProxy : public WebCore::DisplayList::ImageBuffer<BackendType>, public RemoteImageBufferMessageHandlerProxy { >+ using BaseDisplayListImageBuffer = WebCore::DisplayList::ImageBuffer<BackendType>; >+ using BaseDisplayListImageBuffer::m_backend; >+ using BaseDisplayListImageBuffer::m_drawingContext; >+ >+public: >+ static std::unique_ptr<RemoteImageBufferProxy> create(const WebCore::FloatSize& size, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >+ { >+ if (BackendType::calculateBackendSize(size, resolutionScale).isEmpty()) >+ return nullptr; >+ >+ return std::unique_ptr<RemoteImageBufferProxy>(new RemoteImageBufferProxy(size, renderingMode, resolutionScale, colorSpace, remoteRenderingBackendProxy)); >+ } >+ >+ ~RemoteImageBufferProxy() >+ { >+ flushDrawingContext(); >+ } >+ >+protected: >+ RemoteImageBufferProxy(const WebCore::FloatSize& size, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy) >+ : BaseDisplayListImageBuffer(size) >+ , RemoteImageBufferMessageHandlerProxy(size, renderingMode, resolutionScale, colorSpace, remoteRenderingBackendProxy) >+ { >+ } >+ >+ void createBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, ImageBufferBackendHandle handle) override >+ { >+ ASSERT(!m_backend); >+ m_backend = BackendType::create(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); >+ } >+ >+ bool isBackendCreated() const override { return m_backend.get(); } >+ >+ BackendType* ensureBackendCreated() const override >+ { >+ if (!m_backend) >+ const_cast<RemoteImageBufferProxy&>(*this).RemoteImageBufferMessageHandlerProxy::waitForCreateImageBufferBackend(); >+ return m_backend.get(); >+ } >+ >+ RefPtr<WebCore::ImageData> getImageData(WebCore::AlphaPremultiplication outputFormat, const WebCore::IntRect& srcRect) const override >+ { >+ auto& displayList = const_cast<RemoteImageBufferProxy*>(this)->m_drawingContext.displayList(); >+ const_cast<RemoteImageBufferProxy*>(this)->RemoteImageBufferMessageHandlerProxy::flushDrawingContext(displayList); >+ auto result = const_cast<RemoteImageBufferProxy*>(this)->RemoteImageBufferMessageHandlerProxy::getImageData(outputFormat, srcRect); >+ // getImageData is synchronous, which means we've already received the CommitImageBufferFlushContext message. >+ return result; >+ } >+ >+ void putImageData(WebCore::AlphaPremultiplication inputFormat, const WebCore::ImageData& imageData, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint = { }, WebCore::AlphaPremultiplication destFormat = WebCore::AlphaPremultiplication::Premultiplied) override >+ { >+ // The math inside ImageData::create() doesn't agree with the math inside ImageBufferBackend::putImageData() about how m_resolutionScale interacts with the data in the ImageBuffer. >+ // This means that putImageData() is only called when m_resolutionScale == 1. >+ ASSERT(m_backend->resolutionScale() == 1); >+ m_drawingContext.recorder().putImageData(inputFormat, imageData, srcRect, destPoint, destFormat); >+ } >+ >+ void flushContext() override >+ { >+ flushDrawingContext(); >+ m_backend->flushContext(); >+ } >+ >+ void flushDrawingContext() override >+ { >+ auto& displayList = m_drawingContext.displayList(); >+ if (displayList.itemCount()) >+ RemoteImageBufferMessageHandlerProxy::flushDrawingContextAndWaitCommit(displayList); >+ } >+ >+ void willAppendItem(const WebCore::DisplayList::Item&) override >+ { >+ constexpr size_t DisplayListBatchSize = 512; >+ auto& displayList = m_drawingContext.displayList(); >+ if (displayList.itemCount() >= DisplayListBatchSize) >+ RemoteImageBufferMessageHandlerProxy::flushDrawingContext(displayList); >+ } >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp >deleted file mode 100644 >index dbbe9b83036fbe6a0d403acfd8b9e7e9e670d518..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp >+++ /dev/null >@@ -1,127 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >- * THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#include "config.h" >-#include "RemoteRenderingBackend.h" >- >-#if ENABLE(GPU_PROCESS) >- >-#include "GPUConnectionToWebProcess.h" >-#include "GPUProcessConnection.h" >-#include "PlatformRemoteImageBuffer.h" >-#include "RemoteRenderingBackendMessages.h" >-#include "RemoteRenderingBackendProxyMessages.h" >-#include "WebProcess.h" >- >-namespace WebKit { >- >-using namespace WebCore; >- >-std::unique_ptr<RemoteRenderingBackend> RemoteRenderingBackend::create() >-{ >- return std::unique_ptr<RemoteRenderingBackend>(new RemoteRenderingBackend()); >-} >- >-RemoteRenderingBackend::RemoteRenderingBackend() >-{ >- // Register itself as a MessageReceiver in the GPUProcessConnection. >- IPC::MessageReceiverMap& messageReceiverMap = WebProcess::singleton().ensureGPUProcessConnection().messageReceiverMap(); >- messageReceiverMap.addMessageReceiver(Messages::RemoteRenderingBackend::messageReceiverName(), m_renderingBackendIdentifier.toUInt64(), *this); >- >- // Create the RemoteRenderingBackendProxy. >- send(Messages::GPUConnectionToWebProcess::CreateRenderingBackend(m_renderingBackendIdentifier), 0); >-} >- >-RemoteRenderingBackend::~RemoteRenderingBackend() >-{ >- // Un-register itself as a MessageReceiver. >- IPC::MessageReceiverMap& messageReceiverMap = WebProcess::singleton().ensureGPUProcessConnection().messageReceiverMap(); >- messageReceiverMap.removeMessageReceiver(*this); >- >- // Release the RemoteRenderingBackendProxy. >- send(Messages::GPUConnectionToWebProcess::ReleaseRenderingBackend(m_renderingBackendIdentifier), 0); >-} >- >-IPC::Connection* RemoteRenderingBackend::messageSenderConnection() const >-{ >- return &WebProcess::singleton().ensureGPUProcessConnection().connection(); >-} >- >-uint64_t RemoteRenderingBackend::messageSenderDestinationID() const >-{ >- return m_renderingBackendIdentifier.toUInt64(); >-} >- >-bool RemoteRenderingBackend::waitForCreateImageBufferBackend() >-{ >- Ref<IPC::Connection> connection = WebProcess::singleton().ensureGPUProcessConnection().connection(); >- return connection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackend::CreateImageBufferBackend>(m_renderingBackendIdentifier, 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); >-} >- >-bool RemoteRenderingBackend::waitForCommitImageBufferFlushContext() >-{ >- Ref<IPC::Connection> connection = WebProcess::singleton().ensureGPUProcessConnection().connection(); >- return connection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackend::CommitImageBufferFlushContext>(m_renderingBackendIdentifier, 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); >-} >- >-std::unique_ptr<ImageBuffer> RemoteRenderingBackend::createImageBuffer(const FloatSize& size, ShouldAccelerate shouldAccelerate, float resolutionScale, ColorSpace colorSpace) >-{ >- if (shouldAccelerate == ShouldAccelerate::Yes) { >- if (auto imageBuffer = AcceleratedRemoteImageBuffer::create(size, RenderingMode::RemoteAccelerated, resolutionScale, colorSpace, *this)) { >- m_imageBufferMessageHandlerMap.add(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); >- return imageBuffer; >- } >- } >- >- if (auto imageBuffer = UnacceleratedRemoteImageBuffer::create(size, RenderingMode::RemoteUnaccelerated, resolutionScale, colorSpace, *this)) { >- m_imageBufferMessageHandlerMap.add(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); >- return imageBuffer; >- } >- >- return nullptr; >-} >- >-void RemoteRenderingBackend::releaseRemoteResource(RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- // CreateImageBuffer message should have been received before this one. >- bool found = m_imageBufferMessageHandlerMap.remove(remoteResourceIdentifier); >- ASSERT_UNUSED(found, found); >-} >- >-void RemoteRenderingBackend::createImageBufferBackend(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace colorSpace, ImageBufferBackendHandle handle, RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >- imageBuffer->createBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); >-} >- >-void RemoteRenderingBackend::commitImageBufferFlushContext(ImageBufferFlushIdentifier flushIdentifier, RemoteResourceIdentifier remoteResourceIdentifier) >-{ >- if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >- imageBuffer->commitFlushContext(flushIdentifier); >-} >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h >deleted file mode 100644 >index 28a643a48af558ace4cf81d74124f7518e816b00..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h >+++ /dev/null >@@ -1,84 +0,0 @@ >-/* >- * Copyright (C) 2020 Apple Inc. All rights reserved. >- * >- * Redistribution and use in source and binary forms, with or without >- * modification, are permitted provided that the following conditions >- * are met: >- * 1. Redistributions of source code must retain the above copyright >- * notice, this list of conditions and the following disclaimer. >- * 2. Redistributions in binary form must reproduce the above copyright >- * notice, this list of conditions and the following disclaimer in the >- * documentation and/or other materials provided with the distribution. >- * >- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- */ >- >-#pragma once >- >-#if ENABLE(GPU_PROCESS) >- >-#include "ImageBufferBackendHandle.h" >-#include "ImageBufferFlushIdentifier.h" >-#include "MessageReceiver.h" >-#include "MessageSender.h" >-#include "RemoteImageBufferMessageHandler.h" >-#include "RenderingBackendIdentifier.h" >-#include <WebCore/ColorSpace.h> >-#include <WebCore/DisplayList.h> >-#include <WebCore/FloatSize.h> >-#include <WebCore/RemoteResourceIdentifier.h> >-#include <WebCore/RenderingMode.h> >-#include <wtf/HashMap.h> >-#include <wtf/WeakPtr.h> >- >-namespace WebKit { >- >-class RemoteRenderingBackend >- : public IPC::MessageSender >- , private IPC::MessageReceiver >- , public CanMakeWeakPtr<RemoteRenderingBackend> { >-public: >- static std::unique_ptr<RemoteRenderingBackend> create(); >- >- ~RemoteRenderingBackend(); >- >- RenderingBackendIdentifier renderingBackendIdentifier() const { return m_renderingBackendIdentifier; } >- >- // IPC::MessageSender. >- IPC::Connection* messageSenderConnection() const override; >- uint64_t messageSenderDestinationID() const override; >- >- // IPC::MessageReceiver >- void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >- >- std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::ShouldAccelerate, float resolutionScale, WebCore::ColorSpace); >- void releaseRemoteResource(WebCore::RemoteResourceIdentifier); >- >- bool waitForCreateImageBufferBackend(); >- bool waitForCommitImageBufferFlushContext(); >- >-private: >- RemoteRenderingBackend(); >- >- // Messages to be received. >- void createImageBufferBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle, WebCore::RemoteResourceIdentifier); >- void commitImageBufferFlushContext(ImageBufferFlushIdentifier, WebCore::RemoteResourceIdentifier); >- >- using ImageBufferMessageHandlerMap = HashMap<WebCore::RemoteResourceIdentifier, RemoteImageBufferMessageHandler*>; >- ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap; >- RenderingBackendIdentifier m_renderingBackendIdentifier { RenderingBackendIdentifier::generate() }; >-}; >- >-} // namespace WebKit >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in >deleted file mode 100644 >index 2c0f7e8a1203f268652a00fc1f7b17da599d2aa8..0000000000000000000000000000000000000000 >--- a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in >+++ /dev/null >@@ -1,30 +0,0 @@ >-# Copyright (C) 2020 Apple Inc. All rights reserved. >-# >-# Redistribution and use in source and binary forms, with or without >-# modification, are permitted provided that the following conditions >-# are met: >-# 1. Redistributions of source code must retain the above copyright >-# notice, this list of conditions and the following disclaimer. >-# 2. Redistributions in binary form must reproduce the above copyright >-# notice, this list of conditions and the following disclaimer in the >-# documentation and/or other materials provided with the distribution. >-# >-# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND >-# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >-# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >-# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR >-# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >-# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >-# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >-# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >-# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >- >-#if ENABLE(GPU_PROCESS) >- >-messages -> RemoteRenderingBackend NotRefCounted { >- void CreateImageBufferBackend(WebCore::FloatSize logicalSize, WebCore::IntSize backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, WebKit::ImageBufferBackendHandle handle, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >- void CommitImageBufferFlushContext(WebKit::ImageBufferFlushIdentifier flushIdentifier, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >-} >- >-#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp >new file mode 100644 >index 0000000000000000000000000000000000000000..111602afc7dad7aaa651ffa5266d8687034faa16 >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp >@@ -0,0 +1,127 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' >+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, >+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS >+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR >+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF >+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS >+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN >+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) >+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF >+ * THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#include "config.h" >+#include "RemoteRenderingBackendProxy.h" >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "GPUConnectionToWebProcess.h" >+#include "GPUProcessConnection.h" >+#include "PlatformRemoteImageBufferProxy.h" >+#include "RemoteRenderingBackendMessages.h" >+#include "RemoteRenderingBackendProxyMessages.h" >+#include "WebProcess.h" >+ >+namespace WebKit { >+ >+using namespace WebCore; >+ >+std::unique_ptr<RemoteRenderingBackendProxy> RemoteRenderingBackendProxy::create() >+{ >+ return std::unique_ptr<RemoteRenderingBackendProxy>(new RemoteRenderingBackendProxy()); >+} >+ >+RemoteRenderingBackendProxy::RemoteRenderingBackendProxy() >+{ >+ // Register itself as a MessageReceiver in the GPUProcessConnection. >+ IPC::MessageReceiverMap& messageReceiverMap = WebProcess::singleton().ensureGPUProcessConnection().messageReceiverMap(); >+ messageReceiverMap.addMessageReceiver(Messages::RemoteRenderingBackendProxy::messageReceiverName(), m_renderingBackendIdentifier.toUInt64(), *this); >+ >+ // Create the RemoteRenderingBackend >+ send(Messages::GPUConnectionToWebProcess::CreateRenderingBackend(m_renderingBackendIdentifier), 0); >+} >+ >+RemoteRenderingBackendProxy::~RemoteRenderingBackendProxy() >+{ >+ // Un-register itself as a MessageReceiver. >+ IPC::MessageReceiverMap& messageReceiverMap = WebProcess::singleton().ensureGPUProcessConnection().messageReceiverMap(); >+ messageReceiverMap.removeMessageReceiver(*this); >+ >+ // Release the RemoteRenderingBackend. >+ send(Messages::GPUConnectionToWebProcess::ReleaseRenderingBackend(m_renderingBackendIdentifier), 0); >+} >+ >+IPC::Connection* RemoteRenderingBackendProxy::messageSenderConnection() const >+{ >+ return &WebProcess::singleton().ensureGPUProcessConnection().connection(); >+} >+ >+uint64_t RemoteRenderingBackendProxy::messageSenderDestinationID() const >+{ >+ return m_renderingBackendIdentifier.toUInt64(); >+} >+ >+bool RemoteRenderingBackendProxy::waitForCreateImageBufferBackend() >+{ >+ Ref<IPC::Connection> connection = WebProcess::singleton().ensureGPUProcessConnection().connection(); >+ return connection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::CreateImageBufferBackend>(m_renderingBackendIdentifier, 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); >+} >+ >+bool RemoteRenderingBackendProxy::waitForCommitImageBufferFlushContext() >+{ >+ Ref<IPC::Connection> connection = WebProcess::singleton().ensureGPUProcessConnection().connection(); >+ return connection->waitForAndDispatchImmediately<Messages::RemoteRenderingBackendProxy::CommitImageBufferFlushContext>(m_renderingBackendIdentifier, 1_s, IPC::WaitForOption::InterruptWaitingIfSyncMessageArrives); >+} >+ >+std::unique_ptr<ImageBuffer> RemoteRenderingBackendProxy::createImageBuffer(const FloatSize& size, ShouldAccelerate shouldAccelerate, float resolutionScale, ColorSpace colorSpace) >+{ >+ if (shouldAccelerate == ShouldAccelerate::Yes) { >+ if (auto imageBuffer = AcceleratedRemoteImageBufferProxy::create(size, RenderingMode::RemoteAccelerated, resolutionScale, colorSpace, *this)) { >+ m_imageBufferMessageHandlerMap.add(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); >+ return imageBuffer; >+ } >+ } >+ >+ if (auto imageBuffer = UnacceleratedRemoteImageBufferProxy::create(size, RenderingMode::RemoteUnaccelerated, resolutionScale, colorSpace, *this)) { >+ m_imageBufferMessageHandlerMap.add(imageBuffer->remoteResourceIdentifier(), imageBuffer.get()); >+ return imageBuffer; >+ } >+ >+ return nullptr; >+} >+ >+void RemoteRenderingBackendProxy::releaseRemoteResource(RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ // CreateImageBuffer message should have been received before this one. >+ bool found = m_imageBufferMessageHandlerMap.remove(remoteResourceIdentifier); >+ ASSERT_UNUSED(found, found); >+} >+ >+void RemoteRenderingBackendProxy::createImageBufferBackend(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace colorSpace, ImageBufferBackendHandle handle, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >+ imageBuffer->createBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle)); >+} >+ >+void RemoteRenderingBackendProxy::commitImageBufferFlushContext(ImageBufferFlushIdentifier flushIdentifier, RemoteResourceIdentifier remoteResourceIdentifier) >+{ >+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(remoteResourceIdentifier)) >+ imageBuffer->commitFlushContext(flushIdentifier); >+} >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h >new file mode 100644 >index 0000000000000000000000000000000000000000..e7b7e1cfe5f22f76d8e2d5ad2a4f2e6eb5c5fb3f >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.h >@@ -0,0 +1,84 @@ >+/* >+ * Copyright (C) 2020 Apple Inc. All rights reserved. >+ * >+ * Redistribution and use in source and binary forms, with or without >+ * modification, are permitted provided that the following conditions >+ * are met: >+ * 1. Redistributions of source code must retain the above copyright >+ * notice, this list of conditions and the following disclaimer. >+ * 2. Redistributions in binary form must reproduce the above copyright >+ * notice, this list of conditions and the following disclaimer in the >+ * documentation and/or other materials provided with the distribution. >+ * >+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY >+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE >+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR >+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR >+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, >+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, >+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR >+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY >+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT >+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ */ >+ >+#pragma once >+ >+#if ENABLE(GPU_PROCESS) >+ >+#include "ImageBufferBackendHandle.h" >+#include "ImageBufferFlushIdentifier.h" >+#include "MessageReceiver.h" >+#include "MessageSender.h" >+#include "RemoteImageBufferMessageHandlerProxy.h" >+#include "RenderingBackendIdentifier.h" >+#include <WebCore/ColorSpace.h> >+#include <WebCore/DisplayList.h> >+#include <WebCore/FloatSize.h> >+#include <WebCore/RemoteResourceIdentifier.h> >+#include <WebCore/RenderingMode.h> >+#include <wtf/HashMap.h> >+#include <wtf/WeakPtr.h> >+ >+namespace WebKit { >+ >+class RemoteRenderingBackendProxy >+ : public IPC::MessageSender >+ , private IPC::MessageReceiver >+ , public CanMakeWeakPtr<RemoteRenderingBackendProxy> { >+public: >+ static std::unique_ptr<RemoteRenderingBackendProxy> create(); >+ >+ ~RemoteRenderingBackendProxy(); >+ >+ RenderingBackendIdentifier renderingBackendIdentifier() const { return m_renderingBackendIdentifier; } >+ >+ // IPC::MessageSender. >+ IPC::Connection* messageSenderConnection() const override; >+ uint64_t messageSenderDestinationID() const override; >+ >+ // IPC::MessageReceiver >+ void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override; >+ >+ std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::ShouldAccelerate, float resolutionScale, WebCore::ColorSpace); >+ void releaseRemoteResource(WebCore::RemoteResourceIdentifier); >+ >+ bool waitForCreateImageBufferBackend(); >+ bool waitForCommitImageBufferFlushContext(); >+ >+private: >+ RemoteRenderingBackendProxy(); >+ >+ // Messages to be received. >+ void createImageBufferBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle, WebCore::RemoteResourceIdentifier); >+ void commitImageBufferFlushContext(ImageBufferFlushIdentifier, WebCore::RemoteResourceIdentifier); >+ >+ using ImageBufferMessageHandlerMap = HashMap<WebCore::RemoteResourceIdentifier, RemoteImageBufferMessageHandlerProxy*>; >+ ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap; >+ RenderingBackendIdentifier m_renderingBackendIdentifier { RenderingBackendIdentifier::generate() }; >+}; >+ >+} // namespace WebKit >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in >new file mode 100644 >index 0000000000000000000000000000000000000000..43f77ccb72260415afc3899d1a8da730bbf1aae0 >--- /dev/null >+++ b/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.messages.in >@@ -0,0 +1,30 @@ >+# Copyright (C) 2020 Apple Inc. All rights reserved. >+# >+# Redistribution and use in source and binary forms, with or without >+# modification, are permitted provided that the following conditions >+# are met: >+# 1. Redistributions of source code must retain the above copyright >+# notice, this list of conditions and the following disclaimer. >+# 2. Redistributions in binary form must reproduce the above copyright >+# notice, this list of conditions and the following disclaimer in the >+# documentation and/or other materials provided with the distribution. >+# >+# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND >+# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED >+# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE >+# DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR >+# ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL >+# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR >+# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER >+# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, >+# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE >+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. >+ >+#if ENABLE(GPU_PROCESS) >+ >+messages -> RemoteRenderingBackendProxy NotRefCounted { >+ void CreateImageBufferBackend(WebCore::FloatSize logicalSize, WebCore::IntSize backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, WebKit::ImageBufferBackendHandle handle, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+ void CommitImageBufferFlushContext(WebKit::ImageBufferFlushIdentifier flushIdentifier, WebCore::RemoteResourceIdentifier remoteResourceIdentifier) >+} >+ >+#endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >index 76c0d1fc8aa090dde462cb21e24a234f100acfe1..9531b7de3da9599cf8a54023a13be24ce1cff1c7 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp >@@ -39,7 +39,7 @@ > #include "NetworkConnectionToWebProcessMessages.h" > #include "NetworkProcessConnection.h" > #include "PageBanner.h" >-#include "RemoteRenderingBackend.h" >+#include "RemoteRenderingBackendProxy.h" > #include "UserData.h" > #include "WebColorChooser.h" > #include "WebCoreArgumentCoders.h" >@@ -894,11 +894,11 @@ RefPtr<DisplayRefreshMonitor> WebChromeClient::createDisplayRefreshMonitor(Platf > > #if ENABLE(GPU_PROCESS) > >-RemoteRenderingBackend& WebChromeClient::ensureRemoteRenderingBackend() const >+RemoteRenderingBackendProxy& WebChromeClient::ensureRemoteRenderingBackendProxy() const > { >- if (!m_remoteRenderingBackend) >- m_remoteRenderingBackend = RemoteRenderingBackend::create(); >- return *m_remoteRenderingBackend; >+ if (!m_remoteRenderingBackendProxy) >+ m_remoteRenderingBackendProxy = RemoteRenderingBackendProxy::create(); >+ return *m_remoteRenderingBackendProxy; > } > > std::unique_ptr<ImageBuffer> WebChromeClient::createImageBuffer(const FloatSize& size, ShouldAccelerate shouldAccelerate, ShouldUseDisplayList shouldUseDisplayList, RenderingPurpose purpose, float resolutionScale, ColorSpace colorSpace) const >@@ -906,7 +906,7 @@ std::unique_ptr<ImageBuffer> WebChromeClient::createImageBuffer(const FloatSize& > if (!m_page.shouldUseRemoteRenderingFor(purpose)) > return nullptr; > >- return ensureRemoteRenderingBackend().createImageBuffer(size, shouldAccelerate, resolutionScale, colorSpace); >+ return ensureRemoteRenderingBackendProxy().createImageBuffer(size, shouldAccelerate, resolutionScale, colorSpace); > } > > #endif // ENABLE(GPU_PROCESS) >diff --git a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >index 46f0e9ae5bfa54a137e3bb42563e2bac1725f6c8..5fb88fa9a14d30596c3e5b13da33d9a3c1454441 100644 >--- a/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >+++ b/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h >@@ -37,7 +37,7 @@ enum class StorageAccessWasGranted : bool; > > namespace WebKit { > >-class RemoteRenderingBackend; >+class RemoteRenderingBackendProxy; > class WebFrame; > class WebPage; > >@@ -242,7 +242,7 @@ private: > RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) const final; > > #if ENABLE(GPU_PROCESS) >- RemoteRenderingBackend& ensureRemoteRenderingBackend() const; >+ RemoteRenderingBackendProxy& ensureRemoteRenderingBackendProxy() const; > std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::ShouldAccelerate, WebCore::ShouldUseDisplayList, WebCore::RenderingPurpose, float resolutionScale, WebCore::ColorSpace) const final; > #endif > >@@ -405,7 +405,7 @@ private: > mutable bool m_cachedMainFrameHasHorizontalScrollbar { false }; > mutable bool m_cachedMainFrameHasVerticalScrollbar { false }; > #if ENABLE(GPU_PROCESS) >- mutable std::unique_ptr<RemoteRenderingBackend> m_remoteRenderingBackend; >+ mutable std::unique_ptr<RemoteRenderingBackendProxy> m_remoteRenderingBackendProxy; > #endif > WebPage& m_page; > };
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 217809
:
411535
|
411540
|
411541
|
411544
|
411605
|
411612
|
411614