Diff
Modified: trunk/Source/WebCore/ChangeLog (257729 => 257730)
--- trunk/Source/WebCore/ChangeLog 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebCore/ChangeLog 2020-03-02 21:12:40 UTC (rev 257730)
@@ -1,3 +1,29 @@
+2020-03-02 Said Abou-Hallawa <[email protected]>
+
+ Implement the remote ImageBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=207221
+
+ Reviewed by Jon Lee.
+
+ * WebCore.xcodeproj/project.pbxproj:
+ * platform/graphics/ConcreteImageBuffer.h:
+ (WebCore::ConcreteImageBuffer::create):
+ ConcreteImageBuffer::create returns the derived class which it creates.
+
+ * platform/graphics/displaylists/DisplayList.h:
+ This using statement gives compilation error when referencing DisplayList
+ from WebKit.
+
+ * platform/graphics/displaylists/DisplayListDrawingContext.h:
+ RemoteImageBuffer inherits DisplayList::ImageBuffer so these methods
+ need to be exported.
+
+ * platform/graphics/displaylists/DisplayListImageBuffer.h:
+ (WebCore::DisplayList::ImageBuffer::ImageBuffer):
+ Make it possible for RemoteImageBuffer to be created with no backend. It
+ will be created later when RemoteImageBufferProxy shares its backend with
+ RemoteImageBuffer.
+
2020-03-02 Rob Buis <[email protected]>
Fix behavior of pings regarding Origin header
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (257729 => 257730)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2020-03-02 21:12:40 UTC (rev 257730)
@@ -1747,6 +1747,9 @@
556C7C4B22123997009B06CA /* RenderingUpdateScheduler.h in Headers */ = {isa = PBXBuildFile; fileRef = 556C7C4722123942009B06CA /* RenderingUpdateScheduler.h */; settings = {ATTRIBUTES = (Private, ); }; };
5576A5651D88A70800CCC04C /* ImageFrame.h in Headers */ = {isa = PBXBuildFile; fileRef = 5576A5631D88A70800CCC04C /* ImageFrame.h */; settings = {ATTRIBUTES = (Private, ); }; };
55A336F91D821E3C0022C4C7 /* ImageBackingStore.h in Headers */ = {isa = PBXBuildFile; fileRef = 55A336F81D821E3C0022C4C7 /* ImageBackingStore.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 55AD093E2408963500DE4D2F /* DisplayListImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EA09F723FCCB3D008504A5 /* DisplayListImageBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 55AD09402408964000DE4D2F /* DisplayListDrawingContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 72EA09F923FCCC6A008504A5 /* DisplayListDrawingContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 55AD09412408964A00DE4D2F /* ConcreteImageBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3A723E17328008D741C /* ConcreteImageBuffer.h */; settings = {ATTRIBUTES = (Private, ); }; };
55AF14E61EAAC59B0026EEAA /* UTIRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = 55AF14E41EAAC59B0026EEAA /* UTIRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
55DCC52822407B2000C26E32 /* SVGPrimitiveList.h in Headers */ = {isa = PBXBuildFile; fileRef = 55DCC5252240749E00C26E32 /* SVGPrimitiveList.h */; settings = {ATTRIBUTES = (Private, ); }; };
55DCC52922407B2A00C26E32 /* SVGList.h in Headers */ = {isa = PBXBuildFile; fileRef = 55DCC523224073FE00C26E32 /* SVGList.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -29372,6 +29375,7 @@
F442C35923E3ADD200499582 /* CompositionHighlight.h in Headers */,
2DD5A7271EBEE47D009BA597 /* CompositionUnderline.h in Headers */,
7116E2CC1FED75DC00C06FDE /* ComputedEffectTiming.h in Headers */,
+ 55AD09412408964A00DE4D2F /* ConcreteImageBuffer.h in Headers */,
FD31608F12B026F700C1A359 /* Cone.h in Headers */,
65C97AF308EA908800ACD273 /* config.h in Headers */,
2DAF343D1EA7E0F100382CD3 /* ConstantPropertyMap.h in Headers */,
@@ -29717,6 +29721,8 @@
112FB352239C23C40087054A /* DisplayInlineRect.h in Headers */,
6FB47E632277425A00C7BCB0 /* DisplayLineBox.h in Headers */,
0FE5FBD31C3DD51E0007A2CA /* DisplayList.h in Headers */,
+ 55AD09402408964000DE4D2F /* DisplayListDrawingContext.h in Headers */,
+ 55AD093E2408963500DE4D2F /* DisplayListImageBuffer.h in Headers */,
0FE5FBD51C3DD51E0007A2CA /* DisplayListItems.h in Headers */,
0FE5FBD71C3DD51E0007A2CA /* DisplayListRecorder.h in Headers */,
0FE5FBD91C3DD51E0007A2CA /* DisplayListReplayer.h in Headers */,
Modified: trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h (257729 => 257730)
--- trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebCore/platform/graphics/ConcreteImageBuffer.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -34,7 +34,7 @@
class ConcreteImageBuffer : public ImageBuffer {
public:
template<typename ImageBufferType = ConcreteImageBuffer, typename... Arguments>
- static std::unique_ptr<ImageBuffer> create(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const HostWindow* hostWindow, Arguments&&... arguments)
+ static std::unique_ptr<ImageBufferType> create(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const HostWindow* hostWindow, Arguments&&... arguments)
{
auto backend = BackendType::create(size, resolutionScale, colorSpace, hostWindow);
if (!backend)
@@ -43,7 +43,7 @@
}
template<typename ImageBufferType = ConcreteImageBuffer, typename... Arguments>
- static std::unique_ptr<ImageBuffer> create(const FloatSize& size, const GraphicsContext& context, Arguments&&... arguments)
+ static std::unique_ptr<ImageBufferType> create(const FloatSize& size, const GraphicsContext& context, Arguments&&... arguments)
{
auto backend = BackendType::create(size, context);
if (!backend)
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h (257729 => 257730)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayList.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -177,7 +177,7 @@
return m_list[index].get();
}
- void clear();
+ WEBCORE_EXPORT void clear();
void removeItemsFromIndex(size_t);
size_t itemCount() const { return m_list.size(); }
@@ -251,6 +251,3 @@
WTF::TextStream& operator<<(WTF::TextStream&, const DisplayList::DisplayList&);
} // WebCore
-
-using WebCore::DisplayList::DisplayList;
-
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h (257729 => 257730)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -33,7 +33,7 @@
class DrawingContext {
public:
- DrawingContext(const FloatSize& logicalSize);
+ WEBCORE_EXPORT DrawingContext(const FloatSize& logicalSize);
GraphicsContext& context() const { return const_cast<DrawingContext&>(*this).m_context; }
DisplayList& displayList() { return m_displayList; }
@@ -40,8 +40,8 @@
const DisplayList& displayList() const { return m_displayList; }
const DisplayList* replayedDisplayList() const { return m_replayedDisplayList.get(); }
- void setTracksDisplayListReplay(bool);
- void replayDisplayList(GraphicsContext&);
+ WEBCORE_EXPORT void setTracksDisplayListReplay(bool);
+ WEBCORE_EXPORT void replayDisplayList(GraphicsContext&);
protected:
GraphicsContext m_context;
Modified: trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h (257729 => 257730)
--- trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebCore/platform/graphics/displaylists/DisplayListImageBuffer.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -52,6 +52,11 @@
{
}
+ ImageBuffer(const FloatSize& size)
+ : m_drawingContext(size)
+ {
+ }
+
~ImageBuffer()
{
flushDrawingContext();
Modified: trunk/Source/WebKit/ChangeLog (257729 => 257730)
--- trunk/Source/WebKit/ChangeLog 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/ChangeLog 2020-03-02 21:12:40 UTC (rev 257730)
@@ -1,3 +1,90 @@
+2020-03-02 Said Abou-Hallawa <[email protected]>
+
+ Implement the remote ImageBuffer
+ https://bugs.webkit.org/show_bug.cgi?id=207221
+
+ Reviewed by Jon Lee.
+
+ RemoteImageBuffer and RemoteImageBufferProxy represent a single remote
+ ImageBuffer. The back end should be created by RemoteImageBufferProxy in
+ GPUProcess and shared with the RemoteImageBuffer in the WebProcess.
+ Flushing the DrawingContext will be done in GPUProcess. But creating the
+ native image out of the back end will be in GPUProcess.
+
+ RemoteRenderingBackend and RemoteRenderingBackendProxy are central points
+ for receiving and sending all the messages of the RemoteImageBuffer and
+ RemoteImageBufferProxy.
+
+ * GPUProcess/graphics/PlatformRemoteImageBufferProxy.h: Added.
+ Defines the platform types of RemoteImageBufferProxy.
+
+ * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp: Added.
+ (WebKit::RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy):
+ (WebKit::RemoteImageBufferMessageHandlerProxy::createBackend):
+ (WebKit::RemoteImageBufferMessageHandlerProxy::commitFlushContext):
+ * GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h: Added.
+ Manages sending and receiving the messages of RemoteImageBufferProxy
+
+ * GPUProcess/graphics/RemoteImageBufferProxy.h: Added.
+ (WebKit::RemoteImageBufferProxy::create):
+ (WebKit::RemoteImageBufferProxy::RemoteImageBufferProxy):
+ It is responsible for creating a shared back end and replaying back drawing
+ commands.
+
+ * GPUProcess/graphics/RemoteRenderingBackendProxy.cpp:
+ (WebKit::RemoteRenderingBackendProxy::createImageBuffer):
+ (WebKit::RemoteRenderingBackendProxy::releaseImageBuffer):
+ (WebKit::RemoteRenderingBackendProxy::flushImageBufferDrawingContext):
+ * GPUProcess/graphics/RemoteRenderingBackendProxy.h:
+ (WebKit::RemoteRenderingBackendProxy::renderingBackendIdentifier const):
+ * GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in:
+ Handle or dispatch messages received from RemoteRenderingBackend.
+
+ * Scripts/webkit/messages.py:
+ * Sources.txt:
+ * WebKit.xcodeproj/project.pbxproj:
+ * WebProcess/GPU/graphics/ImageBufferFlushIdentifier.h: Added.
+
+ * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp:
+ (WebKit::ImageBufferShareableBitmapBackend::create):
+ * WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h:
+ Although hostWindow isn't used, this is what ConcreteImageBuffer::create
+ expects from the creator of the backend.
+
+ * WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h: Added.
+ Defines the platform types of RemoteImageBuffer.
+
+ * WebProcess/GPU/graphics/RemoteImageBuffer.h: Added.
+ (WebKit::RemoteImageBuffer::create):
+ (WebKit::RemoteImageBuffer::RemoteImageBuffer):
+ It is responsible for creating RemoteImageBufferProxy and performing the
+ drawing commands in the GPUProcess.
+
+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp: Added.
+ (WebKit::RemoteImageBufferMessageHandler::RemoteImageBufferMessageHandler):
+ (WebKit::RemoteImageBufferMessageHandler::~RemoteImageBufferMessageHandler):
+ (WebKit::RemoteImageBufferMessageHandler::flushDrawingContext):
+ (WebKit::RemoteImageBufferMessageHandler::commitFlushContext):
+ * WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h: Added.
+ (WebKit::RemoteImageBufferMessageHandler::imageBufferIdentifier const):
+ Manages sending and receiving the messages of RemoteImageBuffer.
+
+ * WebProcess/GPU/graphics/RemoteRenderingBackend.cpp:
+ (WebKit::RemoteRenderingBackend::createImageBuffer):
+ (WebKit::RemoteRenderingBackend::releaseImageBuffer):
+ (WebKit::RemoteRenderingBackend::createImageBufferBackend):
+ (WebKit::RemoteRenderingBackend::commitImageBufferFlushContext):
+ * WebProcess/GPU/graphics/RemoteRenderingBackend.h:
+ (WebKit::RemoteRenderingBackend::renderingBackendIdentifier const):
+ * WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in:
+ Handle or dispatch messages received from RemoteRenderingBackendProxy.
+
+ * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp:
+ (WebKit::ImageBufferShareableIOSurfaceBackend::create):
+ * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h:
+ Although hostWindow isn't used, this is what ConcreteImageBuffer::create
+ expects from the creator of the backend.
+
2020-03-02 John Wilander <[email protected]>
ResourceLoadStatistics: Enable cookie blocking and the Storage Access API in ephemeral sessions
Copied: trunk/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h (from rev 257729, trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h) (0 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/PlatformRemoteImageBufferProxy.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -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)
Added: trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp (0 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -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 "RemoteImageBufferMessageHandlerProxy.h"
+
+#if ENABLE(GPU_PROCESS)
+
+#include "RemoteRenderingBackendMessages.h"
+#include "RemoteRenderingBackendProxy.h"
+
+namespace WebKit {
+using namespace WebCore;
+
+RemoteImageBufferMessageHandlerProxy::RemoteImageBufferMessageHandlerProxy(RemoteRenderingBackendProxy& remoteRenderingBackendProxy, ImageBufferIdentifier imageBufferIdentifier)
+ : m_remoteRenderingBackendProxy(remoteRenderingBackendProxy)
+ , m_imageBufferIdentifier(imageBufferIdentifier)
+{
+}
+
+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_imageBufferIdentifier), m_remoteRenderingBackendProxy.renderingBackendIdentifier());
+}
+
+void RemoteImageBufferMessageHandlerProxy::commitFlushContext(ImageBufferFlushIdentifier flushIdentifier)
+{
+ m_remoteRenderingBackendProxy.send(Messages::RemoteRenderingBackend::CommitImageBufferFlushContext(flushIdentifier, m_imageBufferIdentifier), m_remoteRenderingBackendProxy.renderingBackendIdentifier());
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
Copied: trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h (from rev 257729, trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h) (0 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -0,0 +1,61 @@
+/*
+ * 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 "ImageBufferIdentifier.h"
+#include <WebCore/ColorSpace.h>
+#include <WebCore/DisplayList.h>
+#include <WebCore/FloatSize.h>
+
+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&, ImageBufferFlushIdentifier) = 0;
+
+protected:
+ RemoteImageBufferMessageHandlerProxy(RemoteRenderingBackendProxy&, ImageBufferIdentifier);
+
+ // 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);
+
+private:
+ RemoteRenderingBackendProxy& m_remoteRenderingBackendProxy;
+ ImageBufferIdentifier m_imageBufferIdentifier;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
Added: trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h (0 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h (rev 0)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteImageBufferProxy.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -0,0 +1,70 @@
+/*
+ * 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 "RemoteImageBufferMessageHandlerProxy.h"
+#include <WebCore/ConcreteImageBuffer.h>
+#include <WebCore/DisplayListReplayer.h>
+
+namespace WebKit {
+
+template<typename BackendType>
+class RemoteImageBufferProxy : public WebCore::ConcreteImageBuffer<BackendType>, public RemoteImageBufferMessageHandlerProxy {
+ using BaseConcreteImageBuffer = WebCore::ConcreteImageBuffer<BackendType>;
+ using BaseConcreteImageBuffer::m_backend;
+
+public:
+ static auto create(const WebCore::FloatSize& size, float resolutionScale, ColorSpace colorSpace, RemoteRenderingBackendProxy& remoteRenderingBackendProxy, ImageBufferIdentifier imageBufferIdentifier)
+ {
+ return BaseConcreteImageBuffer::template create<RemoteImageBufferProxy>(size, resolutionScale, colorSpace, nullptr, remoteRenderingBackendProxy, imageBufferIdentifier);
+ }
+
+ RemoteImageBufferProxy(std::unique_ptr<BackendType>&& backend, RemoteRenderingBackendProxy& remoteRenderingBackendProxy, ImageBufferIdentifier imageBufferIdentifier)
+ : BaseConcreteImageBuffer(WTFMove(backend))
+ , RemoteImageBufferMessageHandlerProxy(remoteRenderingBackendProxy, imageBufferIdentifier)
+ {
+ createBackend(m_backend->logicalSize(), m_backend->backendSize(), m_backend->resolutionScale(), m_backend->colorSpace(), m_backend->createImageBufferBackendHandle());
+ }
+
+private:
+ using BaseConcreteImageBuffer::flushDrawingContext;
+
+ void flushDrawingContext(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier) override
+ {
+ if (displayList.itemCount()) {
+ WebCore::DisplayList::Replayer replayer(BaseConcreteImageBuffer::context(), displayList);
+ replayer.replay();
+ }
+ m_backend->flushContext();
+ commitFlushContext(flushIdentifier);
+ }
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp (257729 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -28,6 +28,7 @@
#if ENABLE(GPU_PROCESS)
+#include "PlatformRemoteImageBufferProxy.h"
#include "RemoteRenderingBackendProxyMessages.h"
namespace WebKit {
@@ -70,34 +71,41 @@
if (!gpuConnectionToWebProcess)
return;
- if (m_imageBufferMap.contains(imageBufferIdentifier)) {
+ if (m_imageBufferMessageHandlerMap.contains(imageBufferIdentifier)) {
ASSERT_NOT_REACHED();
return;
}
- std::unique_ptr<ImageBuffer> imageBuffer;
+ if (renderingMode == RenderingMode::RemoteAccelerated) {
+ if (auto imageBuffer = AcceleratedRemoteImageBufferProxy::create(logicalSize, resolutionScale, colorSpace, *this, imageBufferIdentifier)) {
+ m_imageBufferMessageHandlerMap.add(imageBufferIdentifier, WTFMove(imageBuffer));
+ return;
+ }
+ }
- switch (renderingMode) {
- case RenderingMode::RemoteAccelerated:
- case RenderingMode::RemoteUnaccelerated:
- // FIXME: create the remote ImageBuffer proxy.
- default:
- ASSERT_NOT_REACHED();
+ if (renderingMode == RenderingMode::RemoteAccelerated || renderingMode == RenderingMode::RemoteUnaccelerated) {
+ if (auto imageBuffer = UnacceleratedRemoteImageBufferProxy::create(logicalSize, resolutionScale, colorSpace, *this, imageBufferIdentifier)) {
+ m_imageBufferMessageHandlerMap.add(imageBufferIdentifier, WTFMove(imageBuffer));
+ return;
+ }
}
- if (!imageBuffer)
- return;
-
- m_imageBufferMap.add(imageBufferIdentifier, WTFMove(imageBuffer));
+ ASSERT_NOT_REACHED();
}
void RemoteRenderingBackendProxy::releaseImageBuffer(ImageBufferIdentifier imageBufferIdentifier)
{
// CreateImageBuffer message should have been received before this one.
- bool found = m_imageBufferMap.remove(imageBufferIdentifier);
+ bool found = m_imageBufferMessageHandlerMap.remove(imageBufferIdentifier);
ASSERT_UNUSED(found, found);
}
+void RemoteRenderingBackendProxy::flushImageBufferDrawingContext(const WebCore::DisplayList::DisplayList& displayList, ImageBufferFlushIdentifier flushIdentifier, ImageBufferIdentifier imageBufferIdentifier)
+{
+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(imageBufferIdentifier))
+ imageBuffer->flushDrawingContext(displayList, flushIdentifier);
+}
+
} // namespace WebKit
#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h (257729 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -28,13 +28,15 @@
#if ENABLE(GPU_PROCESS)
#include "Connection.h"
+#include "ImageBufferFlushIdentifier.h"
#include "ImageBufferIdentifier.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/ImageBuffer.h>
#include <WebCore/RenderingMode.h>
#include <wtf/HashMap.h>
#include <wtf/WeakPtr.h>
@@ -44,12 +46,14 @@
class GPUConnectionToWebProcess;
class RemoteRenderingBackendProxy
- : private IPC::MessageSender
+ : public IPC::MessageSender
, private IPC::MessageReceiver {
public:
static std::unique_ptr<RemoteRenderingBackendProxy> create(GPUConnectionToWebProcess&, RenderingBackendIdentifier);
virtual ~RemoteRenderingBackendProxy();
+ RenderingBackendIdentifier renderingBackendIdentifier() const { return m_renderingBackendIdentifier; }
+
private:
RemoteRenderingBackendProxy(GPUConnectionToWebProcess&, RenderingBackendIdentifier);
@@ -60,11 +64,13 @@
// IPC::MessageReceiver
void didReceiveMessage(IPC::Connection&, IPC::Decoder&) override;
+ // Messages to be received.
void createImageBuffer(const WebCore::FloatSize& logicalSize, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace, ImageBufferIdentifier);
void releaseImageBuffer(ImageBufferIdentifier);
+ void flushImageBufferDrawingContext(const WebCore::DisplayList::DisplayList&, ImageBufferFlushIdentifier, ImageBufferIdentifier);
- using ImageBufferMap = HashMap<ImageBufferIdentifier, std::unique_ptr<WebCore::ImageBuffer>>;
- ImageBufferMap m_imageBufferMap;
+ using ImageBufferMessageHandlerMap = HashMap<ImageBufferIdentifier, std::unique_ptr<RemoteImageBufferMessageHandlerProxy>>;
+ ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap;
WeakPtr<GPUConnectionToWebProcess> m_gpuConnectionToWebProcess;
RenderingBackendIdentifier m_renderingBackendIdentifier;
};
Modified: trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in (257729 => 257730)
--- trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/GPUProcess/graphics/RemoteRenderingBackendProxy.messages.in 2020-03-02 21:12:40 UTC (rev 257730)
@@ -25,6 +25,7 @@
messages -> RemoteRenderingBackendProxy NotRefCounted {
void CreateImageBuffer(WebCore::FloatSize logicalSize, WebCore::RenderingMode renderingMode, float resolutionScale, WebCore::ColorSpace colorSpace, WebKit::ImageBufferIdentifier imageBufferIdentifier)
void ReleaseImageBuffer(WebKit::ImageBufferIdentifier imageBufferIdentifier)
+ void FlushImageBufferDrawingContext(WebCore::DisplayList::DisplayList displayList, WebKit::ImageBufferFlushIdentifier flushIdentifier, WebKit::ImageBufferIdentifier imageBufferIdentifier)
}
#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/Scripts/webkit/messages.py (257729 => 257730)
--- trunk/Source/WebKit/Scripts/webkit/messages.py 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/Scripts/webkit/messages.py 2020-03-02 21:12:40 UTC (rev 257730)
@@ -225,6 +225,8 @@
'WebKit::ActivityStateChangeID',
'WebKit::AudioMediaStreamTrackRendererIdentifier',
'WebKit::ContentWorldIdentifier',
+ 'WebKit::ImageBufferBackendHandle',
+ 'WebKit::ImageBufferFlushIdentifier',
'WebKit::ImageBufferIdentifier',
'WebKit::LayerHostingContextID',
'WebKit::LibWebRTCResolverIdentifier',
Modified: trunk/Source/WebKit/Sources.txt (257729 => 257730)
--- trunk/Source/WebKit/Sources.txt 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/Sources.txt 2020-03-02 21:12:40 UTC (rev 257730)
@@ -24,6 +24,7 @@
GPUProcess/GPUProcess.cpp
GPUProcess/GPUConnectionToWebProcess.cpp
GPUProcess/GPUProcessCreationParameters.cpp
+GPUProcess/graphics/RemoteImageBufferMessageHandlerProxy.cpp
GPUProcess/graphics/RemoteRenderingBackendProxy.cpp
GPUProcess/media/RemoteAudioTrackProxy.cpp
GPUProcess/media/RemoteMediaPlayerManagerProxy.cpp
@@ -535,6 +536,7 @@
WebProcess/GPU/GPUProcessConnection.cpp
WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp
+WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp
WebProcess/GPU/graphics/RemoteRenderingBackend.cpp
WebProcess/GPU/media/AudioTrackPrivateRemote.cpp
WebProcess/GPU/media/MediaPlayerPrivateRemote.cpp
Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (257729 => 257730)
--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj 2020-03-02 21:12:40 UTC (rev 257730)
@@ -3818,6 +3818,9 @@
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>"; };
550640A524071CC000AAE045 /* ImageBufferIdentifier.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBufferIdentifier.h; 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>"; };
+ 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>"; };
570AB90320B2541C00B8BE87 /* SecKeyProxyStore.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = SecKeyProxyStore.mm; sourceTree = "<group>"; };
@@ -4081,6 +4084,11 @@
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>"; };
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>"; };
@@ -4087,6 +4095,7 @@
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>"; };
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>"; };
@@ -7745,10 +7754,15 @@
children = (
727A7F3324078527004D2931 /* cocoa */,
727A7F39240788F1004D2931 /* ImageBufferBackendHandle.h */,
+ 55AD09442408ABB300DE4D2F /* ImageBufferFlushIdentifier.h */,
550640A524071CC000AAE045 /* ImageBufferIdentifier.h */,
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 */,
@@ -7760,6 +7774,10 @@
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 */,
Added: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferFlushIdentifier.h (0 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferFlushIdentifier.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferFlushIdentifier.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -0,0 +1,39 @@
+/*
+ * 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 <wtf/ObjectIdentifier.h>
+
+namespace WebKit {
+
+enum ImageBufferFlushIdentifierType { };
+using ImageBufferFlushIdentifier = ObjectIdentifier<ImageBufferFlushIdentifierType>;
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -42,7 +42,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(ImageBufferShareableBitmapBackend);
-std::unique_ptr<ImageBufferShareableBitmapBackend> ImageBufferShareableBitmapBackend::create(const FloatSize& size, float resolutionScale, ColorSpace colorSpace)
+std::unique_ptr<ImageBufferShareableBitmapBackend> ImageBufferShareableBitmapBackend::create(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const HostWindow*)
{
IntSize backendSize = calculateBackendSize(size, resolutionScale);
if (backendSize.isEmpty())
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/ImageBufferShareableBitmapBackend.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -39,7 +39,7 @@
WTF_MAKE_ISO_ALLOCATED(ImageBufferShareableBitmapBackend);
WTF_MAKE_NONCOPYABLE(ImageBufferShareableBitmapBackend);
public:
- static std::unique_ptr<ImageBufferShareableBitmapBackend> create(const WebCore::FloatSize& logicalSize, const float resolutionScale, WebCore::ColorSpace);
+ static std::unique_ptr<ImageBufferShareableBitmapBackend> create(const WebCore::FloatSize& logicalSize, const float resolutionScale, WebCore::ColorSpace, const WebCore::HostWindow*);
static std::unique_ptr<ImageBufferShareableBitmapBackend> create(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& internalSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle);
ImageBufferShareableBitmapBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& physicalSize, float resolutionScale, WebCore::ColorSpace, RefPtr<ShareableBitmap>&&, std::unique_ptr<WebCore::GraphicsContext>&&);
Copied: trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h (from rev 257729, trunk/Source/WebCore/platform/graphics/displaylists/DisplayListDrawingContext.h) (0 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBuffer.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -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)
Added: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h (0 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBuffer.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -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 "RemoteImageBufferMessageHandler.h"
+#include <WebCore/DisplayListImageBuffer.h>
+#include <WebCore/DisplayListItems.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));
+ }
+
+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));
+ }
+
+ void flushContext() override
+ {
+ flushDrawingContext();
+ m_backend->flushContext();
+ }
+
+ void flushDrawingContext() override
+ {
+ auto& displayList = m_drawingContext.displayList();
+ if (displayList.itemCount()) {
+ RemoteImageBufferMessageHandler::flushDrawingContext(displayList);
+ displayList.clear();
+ }
+ }
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
Added: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp (0 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -0,0 +1,68 @@
+/*
+ * 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(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_imageBufferIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier());
+}
+
+RemoteImageBufferMessageHandler::~RemoteImageBufferMessageHandler()
+{
+ // Release the RemoteImageBufferProxy.
+ if (!m_remoteRenderingBackend)
+ return;
+ m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::ReleaseImageBuffer(m_imageBufferIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier());
+}
+
+void RemoteImageBufferMessageHandler::flushDrawingContext(const WebCore::DisplayList::DisplayList& displayList)
+{
+ if (!m_remoteRenderingBackend)
+ return;
+ m_sentFlushIdentifier = ImageBufferFlushIdentifier::generate();
+ m_remoteRenderingBackend->send(Messages::RemoteRenderingBackendProxy::FlushImageBufferDrawingContext(displayList, m_sentFlushIdentifier, m_imageBufferIdentifier), m_remoteRenderingBackend->renderingBackendIdentifier());
+}
+
+void RemoteImageBufferMessageHandler::commitFlushContext(ImageBufferFlushIdentifier flushIdentifier)
+{
+ m_receivedFlushIdentifier = flushIdentifier;
+}
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
+
Copied: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h (from rev 257729, trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h) (0 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteImageBufferMessageHandler.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -0,0 +1,68 @@
+/*
+ * 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 "ImageBufferFlushIdentifier.h"
+#include "ImageBufferIdentifier.h"
+#include <WebCore/ColorSpace.h>
+#include <WebCore/DisplayList.h>
+#include <WebCore/FloatSize.h>
+#include <WebCore/RenderingMode.h>
+
+namespace WebKit {
+
+class RemoteRenderingBackend;
+
+class RemoteImageBufferMessageHandler {
+public:
+ virtual ~RemoteImageBufferMessageHandler();
+
+ ImageBufferIdentifier imageBufferIdentifier() const { return m_imageBufferIdentifier; }
+
+ // 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&);
+
+ // Messages to be sent. See RemoteRenderingBackendProxy.messages.in.
+ void flushDrawingContext(const WebCore::DisplayList::DisplayList&);
+
+private:
+ WeakPtr<RemoteRenderingBackend> m_remoteRenderingBackend;
+ ImageBufferIdentifier m_imageBufferIdentifier { ImageBufferIdentifier::generate() };
+
+ ImageBufferFlushIdentifier m_sentFlushIdentifier;
+ ImageBufferFlushIdentifier m_receivedFlushIdentifier;
+};
+
+} // namespace WebKit
+
+#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -29,6 +29,7 @@
#if ENABLE(GPU_PROCESS)
#include "GPUProcessConnection.h"
+#include "PlatformRemoteImageBuffer.h"
#include "RemoteRenderingBackendMessages.h"
#include "RemoteRenderingBackendProxyMessages.h"
@@ -71,16 +72,20 @@
return m_renderingBackendIdentifier.toUInt64();
}
-std::unique_ptr<ImageBuffer> RemoteRenderingBackend::createImageBuffer(const FloatSize&, RenderingMode renderingMode, float, ColorSpace)
+std::unique_ptr<ImageBuffer> RemoteRenderingBackend::createImageBuffer(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace)
{
- switch (renderingMode) {
- case RenderingMode::RemoteAccelerated:
- case RenderingMode::RemoteUnaccelerated:
- // FIXME: Create the remote ImageBuffer
- return nullptr;
+ if (renderingMode == RenderingMode::RemoteAccelerated) {
+ if (auto imageBuffer = AcceleratedRemoteImageBuffer::create(size, renderingMode, resolutionScale, colorSpace, *this)) {
+ m_imageBufferMessageHandlerMap.add(imageBuffer->imageBufferIdentifier(), imageBuffer.get());
+ return imageBuffer;
+ }
+ }
- default:
- ASSERT_NOT_REACHED();
+ if (renderingMode == RenderingMode::RemoteAccelerated || renderingMode == RenderingMode::RemoteUnaccelerated) {
+ if (auto imageBuffer = UnacceleratedRemoteImageBuffer::create(size, renderingMode, resolutionScale, colorSpace, *this)) {
+ m_imageBufferMessageHandlerMap.add(imageBuffer->imageBufferIdentifier(), imageBuffer.get());
+ return imageBuffer;
+ }
}
return nullptr;
@@ -89,12 +94,22 @@
void RemoteRenderingBackend::releaseImageBuffer(ImageBufferIdentifier imageBufferIdentifier)
{
// CreateImageBuffer message should have been received before this one.
- bool found = m_imageBufferMap.remove(imageBufferIdentifier);
+ bool found = m_imageBufferMessageHandlerMap.remove(imageBufferIdentifier);
ASSERT_UNUSED(found, found);
+}
- send(Messages::RemoteRenderingBackendProxy::ReleaseImageBuffer(imageBufferIdentifier), m_renderingBackendIdentifier);
+void RemoteRenderingBackend::createImageBufferBackend(const FloatSize& logicalSize, const IntSize& backendSize, float resolutionScale, ColorSpace colorSpace, ImageBufferBackendHandle handle, ImageBufferIdentifier imageBufferIdentifier)
+{
+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(imageBufferIdentifier))
+ imageBuffer->createBackend(logicalSize, backendSize, resolutionScale, colorSpace, WTFMove(handle));
}
+void RemoteRenderingBackend::commitImageBufferFlushContext(ImageBufferFlushIdentifier flushIdentifier, ImageBufferIdentifier imageBufferIdentifier)
+{
+ if (auto imageBuffer = m_imageBufferMessageHandlerMap.get(imageBufferIdentifier))
+ imageBuffer->commitFlushContext(flushIdentifier);
+}
+
} // namespace WebKit
#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -27,38 +27,52 @@
#if ENABLE(GPU_PROCESS)
+#include "ImageBufferBackendHandle.h"
+#include "ImageBufferFlushIdentifier.h"
#include "ImageBufferIdentifier.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/ImageBuffer.h>
#include <WebCore/RenderingMode.h>
#include <wtf/HashMap.h>
+#include <wtf/WeakPtr.h>
namespace WebKit {
class RemoteRenderingBackend
- : private IPC::MessageSender
- , private IPC::MessageReceiver {
+ : 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::RenderingMode, float resolutionScale, WebCore::ColorSpace);
void releaseImageBuffer(ImageBufferIdentifier);
private:
RemoteRenderingBackend();
-
- using ImageBufferMap = HashMap<ImageBufferIdentifier, WebCore::ImageBuffer*>;
- ImageBufferMap m_imageBufferMap;
+
+ // Messages to be received.
+ void createImageBufferBackend(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& backendSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle, ImageBufferIdentifier);
+ void commitImageBufferFlushContext(ImageBufferFlushIdentifier, ImageBufferIdentifier);
+
+ using ImageBufferMessageHandlerMap = HashMap<ImageBufferIdentifier, RemoteImageBufferMessageHandler*>;
+ ImageBufferMessageHandlerMap m_imageBufferMessageHandlerMap;
RenderingBackendIdentifier m_renderingBackendIdentifier { RenderingBackendIdentifier::generate() };
};
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackend.messages.in 2020-03-02 21:12:40 UTC (rev 257730)
@@ -23,7 +23,8 @@
#if ENABLE(GPU_PROCESS)
messages -> RemoteRenderingBackend NotRefCounted {
-
+ void CreateImageBufferBackend(WebCore::FloatSize logicalSize, WebCore::IntSize backendSize, float resolutionScale, WebCore::ColorSpace colorSpace, WebKit::ImageBufferBackendHandle handle, WebKit::ImageBufferIdentifier imageBufferIdentifier)
+ void CommitImageBufferFlushContext(WebKit::ImageBufferFlushIdentifier flushIdentifier, WebKit::ImageBufferIdentifier imageBufferIdentifier)
}
#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -37,7 +37,7 @@
WTF_MAKE_ISO_ALLOCATED_IMPL(ImageBufferShareableIOSurfaceBackend);
-std::unique_ptr<ImageBufferShareableIOSurfaceBackend> ImageBufferShareableIOSurfaceBackend::create(const FloatSize& size, float resolutionScale, ColorSpace colorSpace)
+std::unique_ptr<ImageBufferShareableIOSurfaceBackend> ImageBufferShareableIOSurfaceBackend::create(const FloatSize& size, float resolutionScale, ColorSpace colorSpace, const HostWindow*)
{
IntSize backendSize = calculateBackendSize(size, resolutionScale);
if (backendSize.isEmpty())
Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -40,7 +40,7 @@
WTF_MAKE_ISO_ALLOCATED(ImageBufferShareableIOSurfaceBackend);
WTF_MAKE_NONCOPYABLE(ImageBufferShareableIOSurfaceBackend);
public:
- static std::unique_ptr<ImageBufferShareableIOSurfaceBackend> create(const WebCore::FloatSize& logicalSize, const float resolutionScale, WebCore::ColorSpace);
+ static std::unique_ptr<ImageBufferShareableIOSurfaceBackend> create(const WebCore::FloatSize& logicalSize, const float resolutionScale, WebCore::ColorSpace, const WebCore::HostWindow*);
static std::unique_ptr<ImageBufferShareableIOSurfaceBackend> create(const WebCore::FloatSize& logicalSize, const WebCore::IntSize& internalSize, float resolutionScale, WebCore::ColorSpace, ImageBufferBackendHandle);
using WebCore::ImageBufferIOSurfaceBackend::ImageBufferIOSurfaceBackend;
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp 2020-03-02 21:12:40 UTC (rev 257730)
@@ -891,14 +891,11 @@
#if ENABLE(GPU_PROCESS)
-std::unique_ptr<ImageBuffer> WebChromeClient::createImageBuffer(const FloatSize& size, RenderingMode renderingMode, float resolutionScale, ColorSpace colorSpace) const
+RemoteRenderingBackend& WebChromeClient::ensureRemoteRenderingBackend() const
{
- if (renderingMode != RenderingMode::RemoteAccelerated && renderingMode != RenderingMode::RemoteUnaccelerated)
- return nullptr;
-
if (!m_remoteRenderingBackend)
m_remoteRenderingBackend = RemoteRenderingBackend::create();
- return m_remoteRenderingBackend->createImageBuffer(size, renderingMode, resolutionScale, colorSpace);
+ return *m_remoteRenderingBackend;
}
std::unique_ptr<ImageBuffer> WebChromeClient::createImageBuffer(const FloatSize& size, ShouldAccelerate shouldAccelerate, ShouldUseDisplayList shouldUseDisplayList, RenderingPurpose purpose, float resolutionScale, ColorSpace colorSpace) const
@@ -910,7 +907,7 @@
mode = shouldAccelerate == ShouldAccelerate::Yes ? RenderingMode::DisplayListAccelerated : RenderingMode::DisplayListUnaccelerated;
else
mode = shouldAccelerate == ShouldAccelerate::Yes ? RenderingMode::Accelerated : RenderingMode::Unaccelerated;
- return createImageBuffer(size, mode, resolutionScale, colorSpace);
+ return ensureRemoteRenderingBackend().createImageBuffer(size, mode, resolutionScale, colorSpace);
}
#endif // ENABLE(GPU_PROCESS)
Modified: trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h (257729 => 257730)
--- trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2020-03-02 21:07:55 UTC (rev 257729)
+++ trunk/Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.h 2020-03-02 21:12:40 UTC (rev 257730)
@@ -234,8 +234,8 @@
#endif
#if ENABLE(GPU_PROCESS)
+ RemoteRenderingBackend& ensureRemoteRenderingBackend() const;
std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::ShouldAccelerate, WebCore::ShouldUseDisplayList, WebCore::RenderingPurpose, float resolutionScale, WebCore::ColorSpace) const final;
- std::unique_ptr<WebCore::ImageBuffer> createImageBuffer(const WebCore::FloatSize&, WebCore::RenderingMode, float resolutionScale, WebCore::ColorSpace) const final;
#endif
CompositingTriggerFlags allowedCompositingTriggers() const final