Title: [289379] trunk/Source/WebKit
Revision
289379
Author
simon.fra...@apple.com
Date
2022-02-08 08:57:43 -0800 (Tue, 08 Feb 2022)

Log Message

Rename ImageBufferShareableIOSurfaceBackend to ImageBufferRemoteIOSurfaceBackend
https://bugs.webkit.org/show_bug.cgi?id=236267

Reviewed by Tim Horton.

Most of the functions on ImageBufferShareableIOSurfaceBackend are stubs that RELEASE_ASSERT;
it's "remote" role is more important that it's "shareable" role, so rename it.

* SourcesCocoa.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h:
* WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp: Renamed from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp.
(WebKit::ImageBufferRemoteIOSurfaceBackend::calculateSafeBackendSize):
(WebKit::ImageBufferRemoteIOSurfaceBackend::calculateMemoryCost):
(WebKit::ImageBufferRemoteIOSurfaceBackend::calculateExternalMemoryCost):
(WebKit::ImageBufferRemoteIOSurfaceBackend::create):
(WebKit::ImageBufferRemoteIOSurfaceBackend::createImageBufferBackendHandle const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::context const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::backendSize const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::bytesPerRow const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::copyNativeImage const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::copyImage const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::draw):
(WebKit::ImageBufferRemoteIOSurfaceBackend::drawPattern):
(WebKit::ImageBufferRemoteIOSurfaceBackend::toDataURL const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::toData const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::getPixelBuffer const):
(WebKit::ImageBufferRemoteIOSurfaceBackend::putPixelBuffer):
* WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h.

Modified Paths

Added Paths

Removed Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (289378 => 289379)


--- trunk/Source/WebKit/ChangeLog	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/ChangeLog	2022-02-08 16:57:43 UTC (rev 289379)
@@ -1,3 +1,35 @@
+2022-02-08  Simon Fraser  <simon.fra...@apple.com>
+
+        Rename ImageBufferShareableIOSurfaceBackend to ImageBufferRemoteIOSurfaceBackend
+        https://bugs.webkit.org/show_bug.cgi?id=236267
+
+        Reviewed by Tim Horton.
+
+        Most of the functions on ImageBufferShareableIOSurfaceBackend are stubs that RELEASE_ASSERT;
+        it's "remote" role is more important that it's "shareable" role, so rename it.
+
+        * SourcesCocoa.txt:
+        * WebKit.xcodeproj/project.pbxproj:
+        * WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h:
+        * WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp: Renamed from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp.
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::calculateSafeBackendSize):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::calculateMemoryCost):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::calculateExternalMemoryCost):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::create):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::createImageBufferBackendHandle const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::context const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::backendSize const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::bytesPerRow const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::copyNativeImage const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::copyImage const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::draw):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::drawPattern):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::toDataURL const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::toData const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::getPixelBuffer const):
+        (WebKit::ImageBufferRemoteIOSurfaceBackend::putPixelBuffer):
+        * WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h: Renamed from Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h.
+
 2022-02-08  Kimmo Kinnunen  <kkinnu...@apple.com>
 
         GPUP WebGL RELEASE_LOGs errorneously for unhandled messages

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (289378 => 289379)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2022-02-08 16:57:43 UTC (rev 289379)
@@ -125,7 +125,7 @@
                 if (m_frontBuffer.imageBuffer->canMapBackingStore())
                     handle = static_cast<AcceleratedImageBufferShareableMappedBackend&>(*backend).createImageBufferBackendHandle();
                 else
-                    handle = static_cast<AcceleratedImageBufferShareableBackend&>(*backend).createImageBufferBackendHandle();
+                    handle = static_cast<AcceleratedImageBufferRemoteBackend&>(*backend).createImageBufferBackendHandle();
             }
             break;
         case Type::Bitmap:

Modified: trunk/Source/WebKit/SourcesCocoa.txt (289378 => 289379)


--- trunk/Source/WebKit/SourcesCocoa.txt	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/SourcesCocoa.txt	2022-02-08 16:57:43 UTC (rev 289379)
@@ -620,7 +620,7 @@
 
 WebProcess/EntryPoint/Cocoa/XPCService/WebContentServiceEntryPoint.mm
 
-WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp
+WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp
 WebProcess/GPU/graphics/cocoa/ImageBufferShareableMappedIOSurfaceBackend.cpp
 WebProcess/GPU/graphics/cocoa/RemoteGraphicsContextGLProxyCocoa.mm
 WebProcess/GPU/media/RemoteAudioSourceProvider.cpp

Modified: trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj (289378 => 289379)


--- trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/WebKit.xcodeproj/project.pbxproj	2022-02-08 16:57:43 UTC (rev 289379)
@@ -3494,8 +3494,8 @@
 		2D1B5D5C185869C8006C6596 /* ViewGestureControllerMessages.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewGestureControllerMessages.h; path = DerivedSources/WebKit/ViewGestureControllerMessages.h; sourceTree = BUILT_PRODUCTS_DIR; };
 		2D1E8221216FFF5000A15265 /* WKWebEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WKWebEvent.h; path = ios/WKWebEvent.h; sourceTree = "<group>"; };
 		2D1E8222216FFF5100A15265 /* WKWebEvent.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = WKWebEvent.mm; path = ios/WKWebEvent.mm; sourceTree = "<group>"; };
-		2D25F32825758E9000231A8B /* ImageBufferShareableIOSurfaceBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBufferShareableIOSurfaceBackend.h; sourceTree = "<group>"; };
-		2D25F32925758E9100231A8B /* ImageBufferShareableIOSurfaceBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferShareableIOSurfaceBackend.cpp; sourceTree = "<group>"; };
+		2D25F32825758E9000231A8B /* ImageBufferRemoteIOSurfaceBackend.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ImageBufferRemoteIOSurfaceBackend.h; sourceTree = "<group>"; };
+		2D25F32925758E9100231A8B /* ImageBufferRemoteIOSurfaceBackend.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = ImageBufferRemoteIOSurfaceBackend.cpp; sourceTree = "<group>"; };
 		2D279E0E2694C226004B3EEB /* WKHoverPlatter.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKHoverPlatter.h; path = ios/WKHoverPlatter.h; sourceTree = "<group>"; };
 		2D279E0F2694C227004B3EEB /* WKHoverPlatter.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; name = WKHoverPlatter.mm; path = ios/WKHoverPlatter.mm; sourceTree = "<group>"; };
 		2D279E102694C2D1004B3EEB /* WKHoverPlatterParameters.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = WKHoverPlatterParameters.h; path = ios/WKHoverPlatterParameters.h; sourceTree = "<group>"; };
@@ -10262,8 +10262,8 @@
 		727A7F3324078527004D2931 /* cocoa */ = {
 			isa = PBXGroup;
 			children = (
-				2D25F32925758E9100231A8B /* ImageBufferShareableIOSurfaceBackend.cpp */,
-				2D25F32825758E9000231A8B /* ImageBufferShareableIOSurfaceBackend.h */,
+				2D25F32925758E9100231A8B /* ImageBufferRemoteIOSurfaceBackend.cpp */,
+				2D25F32825758E9000231A8B /* ImageBufferRemoteIOSurfaceBackend.h */,
 				727A7F342407857D004D2931 /* ImageBufferShareableMappedIOSurfaceBackend.cpp */,
 				727A7F352407857F004D2931 /* ImageBufferShareableMappedIOSurfaceBackend.h */,
 				7B16191227198AA900C40EAC /* RemoteGraphicsContextGLProxyCocoa.mm */,

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h (289378 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformImageBufferShareableBackend.h	2022-02-08 16:57:43 UTC (rev 289379)
@@ -30,7 +30,7 @@
 #include "ImageBufferShareableBitmapBackend.h"
 
 #if HAVE(IOSURFACE)
-#include "ImageBufferShareableIOSurfaceBackend.h"
+#include "ImageBufferRemoteIOSurfaceBackend.h"
 #include "ImageBufferShareableMappedIOSurfaceBackend.h"
 #endif
 
@@ -39,10 +39,10 @@
 using UnacceleratedImageBufferShareableBackend = ImageBufferShareableBitmapBackend;
 
 #if HAVE(IOSURFACE)
-using AcceleratedImageBufferShareableBackend = ImageBufferShareableIOSurfaceBackend;
+using AcceleratedImageBufferRemoteBackend = ImageBufferRemoteIOSurfaceBackend;
 using AcceleratedImageBufferShareableMappedBackend = ImageBufferShareableMappedIOSurfaceBackend;
 #else
-using AcceleratedImageBufferShareableBackend = UnacceleratedImageBufferShareableBackend;
+using AcceleratedImageBufferRemoteBackend = UnacceleratedImageBufferShareableBackend;
 using AcceleratedImageBufferShareableMappedBackend = UnacceleratedImageBufferShareableBackend;
 #endif
 

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h (289378 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/PlatformRemoteImageBufferProxy.h	2022-02-08 16:57:43 UTC (rev 289379)
@@ -33,7 +33,7 @@
 namespace WebKit {
 
 using UnacceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<UnacceleratedImageBufferShareableBackend>;
-using AcceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<AcceleratedImageBufferShareableBackend>;
+using AcceleratedRemoteImageBufferProxy = RemoteImageBufferProxy<AcceleratedImageBufferRemoteBackend>;
 using AcceleratedRemoteImageBufferMappedProxy = RemoteImageBufferProxy<AcceleratedImageBufferShareableMappedBackend>;
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp (289378 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/RemoteRenderingBackendProxy.cpp	2022-02-08 16:57:43 UTC (rev 289379)
@@ -274,7 +274,7 @@
     else if (imageBuffer->canMapBackingStore())
         imageBuffer->setBackend(AcceleratedImageBufferShareableMappedBackend::create(imageBuffer->parameters(), WTFMove(handle)));
     else
-        imageBuffer->setBackend(AcceleratedImageBufferShareableBackend::create(imageBuffer->parameters(), WTFMove(handle)));
+        imageBuffer->setBackend(AcceleratedImageBufferRemoteBackend::create(imageBuffer->parameters(), WTFMove(handle)));
 }
 
 void RemoteRenderingBackendProxy::didFlush(GraphicsContextFlushIdentifier flushIdentifier, RenderingResourceIdentifier renderingResourceIdentifier)

Copied: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp (from rev 289378, trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp) (0 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.cpp	2022-02-08 16:57:43 UTC (rev 289379)
@@ -0,0 +1,136 @@
+/*
+ * Copyright (C) 2020-2021 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 "ImageBufferRemoteIOSurfaceBackend.h"
+
+#if HAVE(IOSURFACE)
+
+#include <WebCore/GraphicsContextCG.h>
+#include <WebCore/ImageBufferIOSurfaceBackend.h>
+#include <WebCore/PixelBuffer.h>
+#include <wtf/IsoMallocInlines.h>
+#include <wtf/StdLibExtras.h>
+
+namespace WebKit {
+using namespace WebCore;
+
+WTF_MAKE_ISO_ALLOCATED_IMPL(ImageBufferRemoteIOSurfaceBackend);
+
+IntSize ImageBufferRemoteIOSurfaceBackend::calculateSafeBackendSize(const Parameters& parameters)
+{
+    return ImageBufferIOSurfaceBackend::calculateSafeBackendSize(parameters);
+}
+
+size_t ImageBufferRemoteIOSurfaceBackend::calculateMemoryCost(const Parameters& parameters)
+{
+    return ImageBufferIOSurfaceBackend::calculateMemoryCost(parameters);
+}
+
+size_t ImageBufferRemoteIOSurfaceBackend::calculateExternalMemoryCost(const Parameters& parameters)
+{
+    return ImageBufferIOSurfaceBackend::calculateExternalMemoryCost(parameters);
+}
+
+std::unique_ptr<ImageBufferRemoteIOSurfaceBackend> ImageBufferRemoteIOSurfaceBackend::create(const Parameters& parameters, ImageBufferBackendHandle handle)
+{
+    if (!std::holds_alternative<MachSendRight>(handle)) {
+        RELEASE_ASSERT_NOT_REACHED();
+        return nullptr;
+    }
+
+    return makeUnique<ImageBufferRemoteIOSurfaceBackend>(parameters, WTFMove(handle));
+}
+
+ImageBufferBackendHandle ImageBufferRemoteIOSurfaceBackend::createImageBufferBackendHandle() const
+{
+    return std::get<MachSendRight>(m_handle).copySendRight();
+}
+
+GraphicsContext& ImageBufferRemoteIOSurfaceBackend::context() const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+    return *(GraphicsContext*)nullptr;
+}
+
+IntSize ImageBufferRemoteIOSurfaceBackend::backendSize() const
+{
+    return calculateBackendSize(m_parameters);
+}
+
+unsigned ImageBufferRemoteIOSurfaceBackend::bytesPerRow() const
+{
+    IntSize backendSize = calculateBackendSize(m_parameters);
+    return ImageBufferIOSurfaceBackend::calculateBytesPerRow(backendSize);
+}
+
+RefPtr<NativeImage> ImageBufferRemoteIOSurfaceBackend::copyNativeImage(BackingStoreCopy) const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+    return { };
+}
+
+RefPtr<Image> ImageBufferRemoteIOSurfaceBackend::copyImage(BackingStoreCopy, PreserveResolution) const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+    return { };
+}
+
+void ImageBufferRemoteIOSurfaceBackend::draw(GraphicsContext&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+void ImageBufferRemoteIOSurfaceBackend::drawPattern(GraphicsContext&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions&)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+String ImageBufferRemoteIOSurfaceBackend::toDataURL(const String&, std::optional<double>, PreserveResolution) const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+    return { };
+}
+
+Vector<uint8_t> ImageBufferRemoteIOSurfaceBackend::toData(const String&, std::optional<double>) const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+    return { };
+}
+
+std::optional<PixelBuffer> ImageBufferRemoteIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat&, const IntRect&) const
+{
+    RELEASE_ASSERT_NOT_REACHED();
+    return { };
+}
+
+void ImageBufferRemoteIOSurfaceBackend::putPixelBuffer(const PixelBuffer&, const IntRect&, const IntPoint&, AlphaPremultiplication)
+{
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace WebKit
+
+#endif // HAVE(IOSURFACE)

Copied: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h (from rev 289378, trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h) (0 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h	                        (rev 0)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferRemoteIOSurfaceBackend.h	2022-02-08 16:57:43 UTC (rev 289379)
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2020-2021 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 HAVE(IOSURFACE)
+
+#include "ImageBufferBackendHandle.h"
+#include <WebCore/GraphicsContext.h>
+#include <WebCore/ImageBufferBackend.h>
+#include <wtf/IsoMalloc.h>
+
+namespace WebKit {
+
+class ImageBufferRemoteIOSurfaceBackend final : public WebCore::ImageBufferBackend {
+    WTF_MAKE_ISO_ALLOCATED(ImageBufferRemoteIOSurfaceBackend);
+    WTF_MAKE_NONCOPYABLE(ImageBufferRemoteIOSurfaceBackend);
+public:
+    static WebCore::IntSize calculateSafeBackendSize(const Parameters&);
+    static size_t calculateMemoryCost(const Parameters&);
+    static size_t calculateExternalMemoryCost(const Parameters&);
+
+    static std::unique_ptr<ImageBufferRemoteIOSurfaceBackend> create(const Parameters&, ImageBufferBackendHandle);
+
+    ImageBufferRemoteIOSurfaceBackend(const Parameters& parameters, ImageBufferBackendHandle&& handle)
+        : ImageBufferBackend(parameters)
+        , m_handle(WTFMove(handle))
+    {
+    }
+
+    ImageBufferBackendHandle createImageBufferBackendHandle() const;
+
+    static constexpr bool isOriginAtBottomLeftCorner = true;
+    static constexpr bool canMapBackingStore = false;
+    static constexpr WebCore::RenderingMode renderingMode = WebCore::RenderingMode::Accelerated;
+
+    WebCore::GraphicsContext& context() const final;
+
+private:
+    WebCore::IntSize backendSize() const final;
+    RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy) const final;
+    RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy, WebCore::PreserveResolution) const final;
+    void draw(WebCore::GraphicsContext&, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&) final;
+    void drawPattern(WebCore::GraphicsContext&, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::AffineTransform& patternTransform, const WebCore::FloatPoint& phase, const WebCore::FloatSize& spacing, const WebCore::ImagePaintingOptions&) final;
+    String toDataURL(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution) const final;
+    Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality) const final;
+    std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
+    void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
+
+    bool originAtBottomLeftCorner() const final { return isOriginAtBottomLeftCorner; }
+
+    unsigned bytesPerRow() const final;
+
+    ImageBufferBackendHandle m_handle;
+};
+
+} // namespace WebKit
+
+#endif // HAVE(IOSURFACE)

Deleted: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp (289378 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp	2022-02-08 16:57:43 UTC (rev 289379)
@@ -1,136 +0,0 @@
-/*
- * Copyright (C) 2020-2021 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 "ImageBufferShareableIOSurfaceBackend.h"
-
-#if HAVE(IOSURFACE)
-
-#include <WebCore/GraphicsContextCG.h>
-#include <WebCore/ImageBufferIOSurfaceBackend.h>
-#include <WebCore/PixelBuffer.h>
-#include <wtf/IsoMallocInlines.h>
-#include <wtf/StdLibExtras.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-WTF_MAKE_ISO_ALLOCATED_IMPL(ImageBufferShareableIOSurfaceBackend);
-
-IntSize ImageBufferShareableIOSurfaceBackend::calculateSafeBackendSize(const Parameters& parameters)
-{
-    return ImageBufferIOSurfaceBackend::calculateSafeBackendSize(parameters);
-}
-
-size_t ImageBufferShareableIOSurfaceBackend::calculateMemoryCost(const Parameters& parameters)
-{
-    return ImageBufferIOSurfaceBackend::calculateMemoryCost(parameters);
-}
-
-size_t ImageBufferShareableIOSurfaceBackend::calculateExternalMemoryCost(const Parameters& parameters)
-{
-    return ImageBufferIOSurfaceBackend::calculateExternalMemoryCost(parameters);
-}
-
-std::unique_ptr<ImageBufferShareableIOSurfaceBackend> ImageBufferShareableIOSurfaceBackend::create(const Parameters& parameters, ImageBufferBackendHandle handle)
-{
-    if (!std::holds_alternative<MachSendRight>(handle)) {
-        RELEASE_ASSERT_NOT_REACHED();
-        return nullptr;
-    }
-
-    return makeUnique<ImageBufferShareableIOSurfaceBackend>(parameters, WTFMove(handle));
-}
-
-ImageBufferBackendHandle ImageBufferShareableIOSurfaceBackend::createImageBufferBackendHandle() const
-{
-    return std::get<MachSendRight>(m_handle).copySendRight();
-}
-
-GraphicsContext& ImageBufferShareableIOSurfaceBackend::context() const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-    return *(GraphicsContext*)nullptr;
-}
-
-IntSize ImageBufferShareableIOSurfaceBackend::backendSize() const
-{
-    return calculateBackendSize(m_parameters);
-}
-
-unsigned ImageBufferShareableIOSurfaceBackend::bytesPerRow() const
-{
-    IntSize backendSize = calculateBackendSize(m_parameters);
-    return ImageBufferIOSurfaceBackend::calculateBytesPerRow(backendSize);
-}
-
-RefPtr<NativeImage> ImageBufferShareableIOSurfaceBackend::copyNativeImage(BackingStoreCopy) const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-    return { };
-}
-
-RefPtr<Image> ImageBufferShareableIOSurfaceBackend::copyImage(BackingStoreCopy, PreserveResolution) const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-    return { };
-}
-
-void ImageBufferShareableIOSurfaceBackend::draw(GraphicsContext&, const FloatRect&, const FloatRect&, const ImagePaintingOptions&)
-{
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-void ImageBufferShareableIOSurfaceBackend::drawPattern(GraphicsContext&, const FloatRect&, const FloatRect&, const AffineTransform&, const FloatPoint&, const FloatSize&, const ImagePaintingOptions&)
-{
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-String ImageBufferShareableIOSurfaceBackend::toDataURL(const String&, std::optional<double>, PreserveResolution) const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-    return { };
-}
-
-Vector<uint8_t> ImageBufferShareableIOSurfaceBackend::toData(const String&, std::optional<double>) const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-    return { };
-}
-
-std::optional<PixelBuffer> ImageBufferShareableIOSurfaceBackend::getPixelBuffer(const PixelBufferFormat&, const IntRect&) const
-{
-    RELEASE_ASSERT_NOT_REACHED();
-    return { };
-}
-
-void ImageBufferShareableIOSurfaceBackend::putPixelBuffer(const PixelBuffer&, const IntRect&, const IntPoint&, AlphaPremultiplication)
-{
-    RELEASE_ASSERT_NOT_REACHED();
-}
-
-} // namespace WebKit
-
-#endif // HAVE(IOSURFACE)

Deleted: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h (289378 => 289379)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h	2022-02-08 16:55:48 UTC (rev 289378)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h	2022-02-08 16:57:43 UTC (rev 289379)
@@ -1,81 +0,0 @@
-/*
- * Copyright (C) 2020-2021 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 HAVE(IOSURFACE)
-
-#include "ImageBufferBackendHandle.h"
-#include <WebCore/GraphicsContext.h>
-#include <WebCore/ImageBufferBackend.h>
-#include <wtf/IsoMalloc.h>
-
-namespace WebKit {
-
-class ImageBufferShareableIOSurfaceBackend final : public WebCore::ImageBufferBackend {
-    WTF_MAKE_ISO_ALLOCATED(ImageBufferShareableIOSurfaceBackend);
-    WTF_MAKE_NONCOPYABLE(ImageBufferShareableIOSurfaceBackend);
-public:
-    static WebCore::IntSize calculateSafeBackendSize(const Parameters&);
-    static size_t calculateMemoryCost(const Parameters&);
-    static size_t calculateExternalMemoryCost(const Parameters&);
-
-    static std::unique_ptr<ImageBufferShareableIOSurfaceBackend> create(const Parameters&, ImageBufferBackendHandle);
-
-    ImageBufferShareableIOSurfaceBackend(const Parameters& parameters, ImageBufferBackendHandle&& handle)
-        : ImageBufferBackend(parameters)
-        , m_handle(WTFMove(handle))
-    {
-    }
-
-    ImageBufferBackendHandle createImageBufferBackendHandle() const;
-
-    static constexpr bool isOriginAtBottomLeftCorner = true;
-    static constexpr bool canMapBackingStore = false;
-    static constexpr WebCore::RenderingMode renderingMode = WebCore::RenderingMode::Accelerated;
-
-    WebCore::GraphicsContext& context() const final;
-
-private:
-    WebCore::IntSize backendSize() const final;
-    RefPtr<WebCore::NativeImage> copyNativeImage(WebCore::BackingStoreCopy) const final;
-    RefPtr<WebCore::Image> copyImage(WebCore::BackingStoreCopy, WebCore::PreserveResolution) const final;
-    void draw(WebCore::GraphicsContext&, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::ImagePaintingOptions&) final;
-    void drawPattern(WebCore::GraphicsContext&, const WebCore::FloatRect& destRect, const WebCore::FloatRect& srcRect, const WebCore::AffineTransform& patternTransform, const WebCore::FloatPoint& phase, const WebCore::FloatSize& spacing, const WebCore::ImagePaintingOptions&) final;
-    String toDataURL(const String& mimeType, std::optional<double> quality, WebCore::PreserveResolution) const final;
-    Vector<uint8_t> toData(const String& mimeType, std::optional<double> quality) const final;
-    std::optional<WebCore::PixelBuffer> getPixelBuffer(const WebCore::PixelBufferFormat& outputFormat, const WebCore::IntRect&) const final;
-    void putPixelBuffer(const WebCore::PixelBuffer&, const WebCore::IntRect& srcRect, const WebCore::IntPoint& destPoint, WebCore::AlphaPremultiplication destFormat) final;
-
-    bool originAtBottomLeftCorner() const final { return isOriginAtBottomLeftCorner; }
-
-    unsigned bytesPerRow() const final;
-
-    ImageBufferBackendHandle m_handle;
-};
-
-} // namespace WebKit
-
-#endif // HAVE(IOSURFACE)
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to