Title: [261133] trunk
Revision
261133
Author
[email protected]
Date
2020-05-04 18:00:39 -0700 (Mon, 04 May 2020)

Log Message

Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code
https://bugs.webkit.org/show_bug.cgi?id=211389

Reviewed by Alexey Proskuryakov.

Source/WebCore:

* page/cocoa/MemoryReleaseCocoa.mm:
(WebCore::platformReleaseMemory): Remove HAVE(IOSURFACE) since it's always true
on Cocoa platforms.
* platform/graphics/RemoteVideoSample.cpp:
(WebCore::RemoteVideoSample::surface const): Ditto.
* platform/graphics/RemoteVideoSample.h: Ditto.
* platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
(WebCore::GraphicsContextGLOpenGL::allocateIOSurfaceBackingStore): Ditto.
(WebCore::GraphicsContextGLOpenGL::updateFramebufferTextureBackingStoreFromLayer): Ditto.
* platform/graphics/cocoa/IOSurface.mm: Ditto.
* platform/graphics/cocoa/IOSurfacePoolCocoa.mm: Ditto.
* platform/graphics/cocoa/WebGLLayer.h: Ditto.
* platform/graphics/cocoa/WebGLLayer.mm:
(-[WebGLLayer display]): Ditto.
* platform/graphics/cv/ImageTransferSessionVT.h: Ditto.
* platform/graphics/cv/ImageTransferSessionVT.mm: Ditto.
* platform/graphics/cv/VideoTextureCopierCV.cpp:
(WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction): Ditto.
(WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): Ditto.
* platform/graphics/cv/VideoTextureCopierCV.h: Ditto.
* rendering/RenderThemeIOS.h: Ditto.

Source/WebCore/PAL:

* pal/spi/cocoa/QuartzCoreSPI.h: Remove HAVE(IOSURFACE).

Source/WebKit:

* GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
(WebKit::LibWebRTCCodecsProxy::encodeFrame): Remove HAVE(IOSURFACE) since
this is Cocoa-specific code.
* Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::ensureBackingStore): Ditto.
(WebKit::RemoteLayerBackingStore::clearBackingStore): Ditto.
(WebKit::RemoteLayerBackingStore::encode const): Ditto.
(WebKit::RemoteLayerBackingStore::decode): Ditto.
(WebKit::RemoteLayerBackingStore::bytesPerPixel const): Ditto.
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Ditto.
(WebKit::RemoteLayerBackingStore::display): Ditto.
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): Ditto.
(WebKit::RemoteLayerBackingStore::setBufferVolatility): Ditto.
(WebKit::RemoteLayerBackingStore::Buffer::discard): Ditto.
(WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Ditto.
* UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _takeViewSnapshot]): Ditto.
(-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): Ditto.
* UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: Ditto.
* UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): Ditto.
* UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::recursivelyMapIOSurfaceBackingStore): Ditto.
(WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore): Ditto.
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: Ditto.
* WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: Ditto.
* WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
(WebKit::MediaRecorderPrivate::sampleBufferUpdated): Ditto.
* WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
(WebKit::LibWebRTCProvider::createDecoderFactory): Ditto.
* WebProcess/cocoa/UserMediaCaptureManager.cpp:
(WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Ditto.
(WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): Ditto.

Tools:

* DumpRenderTree/ios/PixelDumpSupportIOS.mm:
(createBitmapContextFromWebView): Remove BEGIN/END_BLOCK_OBJC_EXCEPTIONS
since they are not needed/appropriate in test code. Remove HAVE(IOSURFACE)
since this is Cocoa-specific.
* WebKitTestRunner/ios/PlatformWebViewIOS.mm:
(WTR::PlatformWebView::windowSnapshotImage): Ditto.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (261132 => 261133)


--- trunk/Source/WebCore/ChangeLog	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/ChangeLog	2020-05-05 01:00:39 UTC (rev 261133)
@@ -1,3 +1,32 @@
+2020-05-04  Darin Adler  <[email protected]>
+
+        Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code
+        https://bugs.webkit.org/show_bug.cgi?id=211389
+
+        Reviewed by Alexey Proskuryakov.
+
+        * page/cocoa/MemoryReleaseCocoa.mm:
+        (WebCore::platformReleaseMemory): Remove HAVE(IOSURFACE) since it's always true
+        on Cocoa platforms.
+        * platform/graphics/RemoteVideoSample.cpp:
+        (WebCore::RemoteVideoSample::surface const): Ditto.
+        * platform/graphics/RemoteVideoSample.h: Ditto.
+        * platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm:
+        (WebCore::GraphicsContextGLOpenGL::allocateIOSurfaceBackingStore): Ditto.
+        (WebCore::GraphicsContextGLOpenGL::updateFramebufferTextureBackingStoreFromLayer): Ditto.
+        * platform/graphics/cocoa/IOSurface.mm: Ditto.
+        * platform/graphics/cocoa/IOSurfacePoolCocoa.mm: Ditto.
+        * platform/graphics/cocoa/WebGLLayer.h: Ditto.
+        * platform/graphics/cocoa/WebGLLayer.mm:
+        (-[WebGLLayer display]): Ditto.
+        * platform/graphics/cv/ImageTransferSessionVT.h: Ditto.
+        * platform/graphics/cv/ImageTransferSessionVT.mm: Ditto.
+        * platform/graphics/cv/VideoTextureCopierCV.cpp:
+        (WebCore::YCbCrToRGBMatrixForRangeAndTransferFunction): Ditto.
+        (WebCore::VideoTextureCopierCV::copyImageToPlatformTexture): Ditto.
+        * platform/graphics/cv/VideoTextureCopierCV.h: Ditto.
+        * rendering/RenderThemeIOS.h: Ditto.
+
 2020-05-04  Simon Fraser  <[email protected]>
 
         Overflow scrollbars don't grow when hovered

Modified: trunk/Source/WebCore/PAL/ChangeLog (261132 => 261133)


--- trunk/Source/WebCore/PAL/ChangeLog	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/PAL/ChangeLog	2020-05-05 01:00:39 UTC (rev 261133)
@@ -1,3 +1,12 @@
+2020-05-04  Darin Adler  <[email protected]>
+
+        Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code
+        https://bugs.webkit.org/show_bug.cgi?id=211389
+
+        Reviewed by Alexey Proskuryakov.
+
+        * pal/spi/cocoa/QuartzCoreSPI.h: Remove HAVE(IOSURFACE).
+
 2020-05-04  Chris Dumez  <[email protected]>
 
         Drop code path using the legacy CFNetwork cookie change notification SPI

Modified: trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h (261132 => 261133)


--- trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/PAL/pal/spi/cocoa/QuartzCoreSPI.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -167,22 +167,8 @@
 // FIXME: Declare these functions even when USE(APPLE_INTERNAL_SDK) is true once we can fix <rdar://problem/26584828> in a better way.
 #if !USE(APPLE_INTERNAL_SDK)
 void CARenderServerCaptureLayerWithTransform(mach_port_t, uint32_t clientId, uint64_t layerId, uint32_t slotId, int32_t ox, int32_t oy, const CATransform3D*);
-
-#if HAVE(IOSURFACE)
 void CARenderServerRenderLayerWithTransform(mach_port_t server_port, uint32_t client_id, uint64_t layer_id, IOSurfaceRef, int32_t ox, int32_t oy, const CATransform3D*);
 void CARenderServerRenderDisplayLayerWithTransformAndTimeOffset(mach_port_t, CFStringRef display_name, uint32_t client_id, uint64_t layer_id, IOSurfaceRef, int32_t ox, int32_t oy, const CATransform3D*, CFTimeInterval);
-#else
-typedef struct CARenderServerBuffer* CARenderServerBufferRef;
-CARenderServerBufferRef CARenderServerCreateBuffer(size_t, size_t);
-void CARenderServerDestroyBuffer(CARenderServerBufferRef);
-size_t CARenderServerGetBufferWidth(CARenderServerBufferRef);
-size_t CARenderServerGetBufferHeight(CARenderServerBufferRef);
-size_t CARenderServerGetBufferRowBytes(CARenderServerBufferRef);
-uint8_t* CARenderServerGetBufferData(CARenderServerBufferRef);
-size_t CARenderServerGetBufferDataSize(CARenderServerBufferRef);
-
-bool CARenderServerRenderLayerWithTransform(mach_port_t, uint32_t client_id, uint64_t layer_id, CARenderServerBufferRef, int32_t ox, int32_t oy, const CATransform3D*);
-#endif
 #endif // USE(APPLE_INTERNAL_SDK)
 
 typedef struct _CAMachPort *CAMachPortRef;

Modified: trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm (261132 => 261133)


--- trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/page/cocoa/MemoryReleaseCocoa.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -67,9 +67,7 @@
     tileControllerMemoryHandler().trimUnparentedTilesToTarget(0);
 #endif
 
-#if HAVE(IOSURFACE)
     IOSurfacePool::sharedPool().discardAllSurfaces();
-#endif
 
 #if CACHE_SUBIMAGES
     SubimageCacheWithTimer::clear();

Modified: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -28,6 +28,7 @@
 
 #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
 
+#include "GraphicsContextCG.h"
 #include "IOSurface.h"
 #include "Logging.h"
 #include "MediaSample.h"
@@ -36,10 +37,6 @@
 #include <Accelerate/Accelerate.h>
 #endif
 
-#if HAVE(IOSURFACE)
-#include "GraphicsContextCG.h"
-#endif
-
 #include <pal/cf/CoreMediaSoftLink.h>
 #include "CoreVideoSoftLink.h"
 
@@ -46,7 +43,6 @@
 namespace WebCore {
 using namespace PAL;
 
-#if HAVE(IOSURFACE)
 static inline std::unique_ptr<IOSurface> transferBGRAPixelBufferToIOSurface(CVPixelBufferRef pixelBuffer)
 {
 #if USE(ACCELERATE)
@@ -148,7 +144,6 @@
 
     return m_ioSurface ? m_ioSurface->surface() : nullptr;
 }
-#endif
 
 }
 

Modified: trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/RemoteVideoSample.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -27,15 +27,12 @@
 
 #if ENABLE(MEDIA_STREAM) && PLATFORM(COCOA)
 
+#include "IOSurface.h"
 #include "MediaSample.h"
 #include "RemoteVideoSample.h"
 #include <wtf/MachSendRight.h>
 #include <wtf/MediaTime.h>
 
-#if HAVE(IOSURFACE)
-#include "IOSurface.h"
-#endif
-
 typedef struct __CVBuffer* CVPixelBufferRef;
 
 namespace WebCore {
@@ -47,11 +44,9 @@
     RemoteVideoSample& operator=(RemoteVideoSample&&) = default;
     ~RemoteVideoSample() = default;
 
-#if HAVE(IOSURFACE)
     WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(MediaSample&);
     WEBCORE_EXPORT static std::unique_ptr<RemoteVideoSample> create(CVPixelBufferRef, MediaTime&& presentationTime, MediaSample::VideoRotation = MediaSample::VideoRotation::None);
     WEBCORE_EXPORT IOSurfaceRef surface() const;
-#endif
 
     const MediaTime& time() const { return m_time; }
     uint32_t videoFormat() const { return m_videoFormat; }
@@ -61,12 +56,10 @@
 
     template<class Encoder> void encode(Encoder& encoder) const
     {
-#if HAVE(IOSURFACE)
         if (m_ioSurface)
             encoder << m_ioSurface->createSendRight();
         else
             encoder << WTF::MachSendRight();
-#endif
         encoder << m_rotation;
         encoder << m_time;
         encoder << m_videoFormat;
@@ -76,12 +69,11 @@
 
     template<class Decoder> static WARN_UNUSED_RETURN bool decode(Decoder& decoder, RemoteVideoSample& sample)
     {
-#if HAVE(IOSURFACE)
         MachSendRight sendRight;
         if (!decoder.decode(sendRight))
             return false;
         sample.m_sendRight = WTFMove(sendRight);
-#endif
+
         MediaSample::VideoRotation rotation;
         if (!decoder.decode(rotation))
             return false;
@@ -111,13 +103,10 @@
     }
 
 private:
-
-#if HAVE(IOSURFACE)
     RemoteVideoSample(IOSurfaceRef, CGColorSpaceRef, MediaTime&&, MediaSample::VideoRotation, bool);
 
     std::unique_ptr<WebCore::IOSurface> m_ioSurface;
     WTF::MachSendRight m_sendRight;
-#endif
     MediaSample::VideoRotation m_rotation { MediaSample::VideoRotation::None };
     MediaTime m_time;
     uint32_t m_videoFormat { 0 };

Modified: trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cocoa/GraphicsContextGLOpenGLCocoa.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -779,21 +779,16 @@
 
 void GraphicsContextGLOpenGL::allocateIOSurfaceBackingStore(IntSize size)
 {
-#if HAVE(IOSURFACE)
     LOG(WebGL, "GraphicsContextGLOpenGL::allocateIOSurfaceBackingStore at %d x %d. (%p)", size.width(), size.height(), this);
     [m_webGLLayer allocateIOSurfaceBackingStoreWithSize:size usingAlpha:contextAttributes().alpha];
-#else
-    UNUSED_PARAM(size);
-#endif
 }
 
 void GraphicsContextGLOpenGL::updateFramebufferTextureBackingStoreFromLayer()
 {
-#if HAVE(IOSURFACE)
     LOG(WebGL, "GraphicsContextGLOpenGL::updateFramebufferTextureBackingStoreFromLayer(). (%p)", this);
     [m_webGLLayer bindFramebufferToNextAvailableSurface];
-#endif
 }
+
 #endif // USE(ANGLE)
 
 bool GraphicsContextGLOpenGL::isGLES2Compliant() const

Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -26,8 +26,6 @@
 #import "config.h"
 #import "IOSurface.h"
 
-#if HAVE(IOSURFACE)
-
 #import "GraphicsContextCG.h"
 #import "GraphicsContextGLOpenGL.h"
 #import "HostWindow.h"
@@ -499,5 +497,3 @@
 }
 
 } // namespace WebCore
-
-#endif // HAVE(IOSURFACE)

Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurfacePoolCocoa.mm (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurfacePoolCocoa.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurfacePoolCocoa.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -26,8 +26,6 @@
 #import "config.h"
 #import "IOSurfacePool.h"
 
-#if HAVE(IOSURFACE)
-
 #import <QuartzCore/QuartzCore.h>
 
 namespace WebCore {
@@ -43,5 +41,3 @@
 }
 
 }
-
-#endif // HAVE(IOSURFACE)

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -47,7 +47,7 @@
 {
     NakedPtr<WebCore::GraphicsContextGLOpenGL> _context;
     float _devicePixelRatio;
-#if HAVE(IOSURFACE) && (USE(OPENGL) || USE(ANGLE))
+#if USE(OPENGL) || USE(ANGLE)
     std::unique_ptr<WebCore::IOSurface> _contentsBuffer;
     std::unique_ptr<WebCore::IOSurface> _drawingBuffer;
     std::unique_ptr<WebCore::IOSurface> _spareBuffer;
@@ -70,7 +70,7 @@
 
 - (CGImageRef)copyImageSnapshotWithColorSpace:(CGColorSpaceRef)colorSpace;
 
-#if HAVE(IOSURFACE) && (USE(OPENGL) || USE(ANGLE))
+#if USE(OPENGL) || USE(ANGLE)
 - (void)allocateIOSurfaceBackingStoreWithSize:(WebCore::IntSize)size usingAlpha:(BOOL)usingAlpha;
 - (void)bindFramebufferToNextAvailableSurface;
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cocoa/WebGLLayer.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -157,7 +157,7 @@
     }
 #elif USE(OPENGL_ES)
     _context->presentRenderbuffer();
-#elif HAVE(IOSURFACE) && USE(ANGLE)
+#elif USE(ANGLE)
     if (!_context->makeContextCurrent()) {
         // Context is likely being torn down.
         return;
@@ -211,7 +211,7 @@
 }
 #endif
 
-#if HAVE(IOSURFACE) & (USE(OPENGL) || USE(ANGLE))
+#if USE(OPENGL) || USE(ANGLE)
 - (void)allocateIOSurfaceBackingStoreWithSize:(WebCore::IntSize)size usingAlpha:(BOOL)usingAlpha
 {
     _bufferSize = size;

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -53,7 +53,7 @@
     RefPtr<MediaSample> createMediaSample(CGImageRef, const MediaTime&, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
     RefPtr<MediaSample> createMediaSample(CMSampleBufferRef, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
     WEBCORE_EXPORT RefPtr<MediaSample> createMediaSample(IOSurfaceRef, const MediaTime&, const IntSize&, MediaSample::VideoRotation = MediaSample::VideoRotation::None, bool mirrored = false);
 #if ENABLE(MEDIA_STREAM)
     WEBCORE_EXPORT RefPtr<MediaSample> createMediaSample(const RemoteVideoSample&);
@@ -60,7 +60,7 @@
 #endif
 #endif
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
     WEBCORE_EXPORT RetainPtr<CVPixelBufferRef> createPixelBuffer(IOSurfaceRef);
     WEBCORE_EXPORT RetainPtr<CVPixelBufferRef> createPixelBuffer(IOSurfaceRef, const IntSize&);
 #endif
@@ -70,7 +70,7 @@
 private:
     WEBCORE_EXPORT explicit ImageTransferSessionVT(uint32_t pixelFormat);
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
     CFDictionaryRef ioSurfacePixelBufferCreationOptions(IOSurfaceRef);
     RetainPtr<CMSampleBufferRef> createCMSampleBuffer(IOSurfaceRef, const MediaTime&, const IntSize&);
 #endif

Modified: trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cv/ImageTransferSessionVT.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -35,7 +35,7 @@
 #import <CoreMedia/CMFormatDescription.h>
 #import <CoreMedia/CMSampleBuffer.h>
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
 #import <pal/spi/cocoa/IOSurfaceSPI.h>
 #endif
 
@@ -268,7 +268,7 @@
     return createCMSampleBuffer(pixelBuffer.get(), sampleTime, size);
 }
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
 
 #if PLATFORM(MAC)
 static int32_t roundUpToMacroblockMultiple(int32_t size)
@@ -367,7 +367,7 @@
     return MediaSampleAVFObjC::create(resizedBuffer.get(), sample.videoRotation(), sample.videoMirrored());
 }
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
 #if ENABLE(MEDIA_STREAM)
 RefPtr<MediaSample> ImageTransferSessionVT::createMediaSample(const RemoteVideoSample& remoteSample)
 {

Modified: trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -57,7 +57,6 @@
 
 namespace WebCore {
 
-#if HAVE(IOSURFACE)
 enum class PixelRange {
     Unknown,
     Video,
@@ -374,7 +373,6 @@
     ASSERT(iterator != matrices.get().end());
     return iterator->second;
 }
-#endif // HAVE(IOSURFACE)
 
 VideoTextureCopierCV::VideoTextureCopierCV(GraphicsContextGLOpenGL& context)
     : m_sharedContext(context)
@@ -802,7 +800,6 @@
     }
 #endif // USE(ANGLE)
 
-#if HAVE(IOSURFACE)
     // FIXME: This currently only supports '420v' and '420f' pixel formats. Investigate supporting more pixel formats.
     OSType pixelFormat = CVPixelBufferGetPixelFormatType(image);
     if (pixelFormat != kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange && pixelFormat != kCVPixelFormatType_420YpCbCr8BiPlanarFullRange) {
@@ -944,9 +941,6 @@
     m_lastFlipY = flipY;
 
     return true;
-#else
-    return false;
-#endif // HAVE(IOSURFACE)
 }
 
 bool VideoTextureCopierCV::copyVideoTextureToPlatformTexture(TextureType inputVideoTexture, size_t width, size_t height, PlatformGLObject outputTexture, GCGLenum outputTarget, GCGLint level, GCGLenum internalFormat, GCGLenum format, GCGLenum type, bool premultiplyAlpha, bool flipY, bool swapColorChannels)

Modified: trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h (261132 => 261133)


--- trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/platform/graphics/cv/VideoTextureCopierCV.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -62,19 +62,12 @@
     bool initializeContextObjects();
     bool initializeUVContextObjects();
 
-#if HAVE(IOSURFACE)
     unsigned lastTextureSeed(GCGLuint texture)
     {
-        auto iterator = m_lastTextureSeed.find(texture);
-        return iterator == m_lastTextureSeed.end() ? 0 : iterator->value;
+        return m_lastTextureSeed.get(texture);
     }
-#endif
 
 #if USE(ANGLE)
-#if !HAVE(IOSURFACE)
-#error USE(ANGLE) requires HAVE(IOSURFACE)
-#endif // !HAVE(IOSURFACE)
-
     // Returns a handle which, if non-null, must be released via the
     // detach call below.
     void* attachIOSurfaceToTexture(GCGLenum target, GCGLenum internalFormat, GCGLsizei width, GCGLsizei height, GCGLenum type, IOSurfaceRef, GCGLuint plane);
@@ -105,7 +98,6 @@
     GCGLint m_yTextureSizeUniformLocation { -1 };
     GCGLint m_uvTextureSizeUniformLocation { -1 };
 
-#if HAVE(IOSURFACE)
     bool m_lastFlipY { false };
     UnsafePointer<IOSurfaceRef> m_lastSurface;
     uint32_t m_lastSurfaceSeed { 0 };
@@ -112,7 +104,6 @@
 
     using TextureSeedMap = HashMap<GCGLuint, unsigned, WTF::IntHash<GCGLuint>, WTF::UnsignedWithZeroKeyHashTraits<GCGLuint>>;
     TextureSeedMap m_lastTextureSeed;
-#endif
 };
 
 }

Modified: trunk/Source/WebCore/rendering/RenderThemeIOS.h (261132 => 261133)


--- trunk/Source/WebCore/rendering/RenderThemeIOS.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebCore/rendering/RenderThemeIOS.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -31,9 +31,7 @@
 #include "RenderThemeCocoa.h"
 
 #if USE(SYSTEM_PREVIEW)
-#if HAVE(IOSURFACE)
 #include "IOSurface.h"
-#endif
 #include <wtf/RetainPtr.h>
 #endif
 
@@ -169,11 +167,9 @@
 
 #if USE(SYSTEM_PREVIEW)
     RetainPtr<CIContext> m_ciContext;
-#if HAVE(IOSURFACE)
     std::unique_ptr<IOSurface> m_largeBadgeSurface;
     std::unique_ptr<IOSurface> m_smallBadgeSurface;
 #endif
-#endif
 
     bool m_shouldMockBoldSystemFontForAccessibility { false };
 };

Modified: trunk/Source/WebKit/ChangeLog (261132 => 261133)


--- trunk/Source/WebKit/ChangeLog	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/ChangeLog	2020-05-05 01:00:39 UTC (rev 261133)
@@ -1,3 +1,44 @@
+2020-05-04  Darin Adler  <[email protected]>
+
+        Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code
+        https://bugs.webkit.org/show_bug.cgi?id=211389
+
+        Reviewed by Alexey Proskuryakov.
+
+        * GPUProcess/webrtc/LibWebRTCCodecsProxy.mm:
+        (WebKit::LibWebRTCCodecsProxy::encodeFrame): Remove HAVE(IOSURFACE) since
+        this is Cocoa-specific code.
+        * Shared/RemoteLayerTree/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::ensureBackingStore): Ditto.
+        (WebKit::RemoteLayerBackingStore::clearBackingStore): Ditto.
+        (WebKit::RemoteLayerBackingStore::encode const): Ditto.
+        (WebKit::RemoteLayerBackingStore::decode): Ditto.
+        (WebKit::RemoteLayerBackingStore::bytesPerPixel const): Ditto.
+        (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer): Ditto.
+        (WebKit::RemoteLayerBackingStore::display): Ditto.
+        (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer): Ditto.
+        (WebKit::RemoteLayerBackingStore::setBufferVolatility): Ditto.
+        (WebKit::RemoteLayerBackingStore::Buffer::discard): Ditto.
+        (WebKit::RemoteLayerBackingStore::surfaceBufferFormat const): Ditto.
+        * UIProcess/API/ios/WKWebViewIOS.mm:
+        (-[WKWebView _takeViewSnapshot]): Ditto.
+        (-[WKWebView _snapshotRect:intoImageOfWidth:completionHandler:]): Ditto.
+        * UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp: Ditto.
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
+        (WebKit::RemoteLayerTreeDrawingAreaProxy::RemoteLayerTreeDrawingAreaProxy): Ditto.
+        * UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
+        (WebKit::recursivelyMapIOSurfaceBackingStore): Ditto.
+        (WebKit::RemoteLayerTreeHost::mapAllIOSurfaceBackingStore): Ditto.
+        * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp: Ditto.
+        * WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h: Ditto.
+        * WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp:
+        (WebKit::MediaRecorderPrivate::sampleBufferUpdated): Ditto.
+        * WebProcess/Network/webrtc/LibWebRTCProvider.cpp:
+        (WebKit::LibWebRTCProvider::createDecoderFactory): Ditto.
+        * WebProcess/cocoa/UserMediaCaptureManager.cpp:
+        (WebKit::UserMediaCaptureManager::Source::remoteVideoSampleAvailable): Ditto.
+        (WebKit::UserMediaCaptureManager::remoteVideoSampleAvailable): Ditto.
+
 2020-05-04  David Kilzer  <[email protected]>
 
         Use default constructor and default initializer for SecItemRequestData

Modified: trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm (261132 => 261133)


--- trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/GPUProcess/webrtc/LibWebRTCCodecsProxy.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -146,7 +146,7 @@
     if (!m_imageTransferSession || m_imageTransferSession->pixelFormat() != sample.videoFormat())
         m_imageTransferSession = WebCore::ImageTransferSessionVT::create(sample.videoFormat());
 
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if !PLATFORM(MACCATALYST)
     auto pixelBuffer = m_imageTransferSession->createPixelBuffer(sample.surface());
     webrtc::encodeLocalEncoderFrame(encoder, pixelBuffer.get(), sample.time().toTimeScale(1000000).timeValue(), toWebRTCVideoRotation(sample.rotation()), shouldEncodeAsKeyFrame);
 #endif

Modified: trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm (261132 => 261133)


--- trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -38,12 +38,9 @@
 #import <WebCore/IOSurface.h>
 #import <WebCore/PlatformCALayerClient.h>
 #import <WebCore/WebLayer.h>
+#import <mach/mach_port.h>
 #import <pal/spi/cocoa/QuartzCoreSPI.h>
 
-#if HAVE(IOSURFACE)
-#import <mach/mach_port.h>
-#endif
-
 namespace WebKit {
 
 RemoteLayerBackingStore::RemoteLayerBackingStore(PlatformCALayerRemote* layer)
@@ -70,9 +67,6 @@
 
 void RemoteLayerBackingStore::ensureBackingStore(WebCore::FloatSize size, float scale, bool acceleratesDrawing, bool deepColor, bool isOpaque)
 {
-#if !HAVE(IOSURFACE)
-    acceleratesDrawing = false;
-#endif
     if (m_size == size && m_scale == scale && m_deepColor == deepColor && m_acceleratesDrawing == acceleratesDrawing && m_isOpaque == isOpaque)
         return;
 
@@ -95,9 +89,7 @@
 {
     m_frontBuffer.discard();
     m_backBuffer.discard();
-#if HAVE(IOSURFACE)
     m_secondaryBackBuffer.discard();
-#endif
 }
 
 void RemoteLayerBackingStore::encode(IPC::Encoder& encoder) const
@@ -107,7 +99,6 @@
     encoder << m_acceleratesDrawing;
     encoder << m_isOpaque;
 
-#if HAVE(IOSURFACE)
     if (m_acceleratesDrawing) {
         if (m_frontBuffer.surface)
             encoder << m_frontBuffer.surface->createSendRight();
@@ -115,7 +106,6 @@
             encoder << WTF::MachSendRight();
         return;
     }
-#endif
 
     ASSERT(!m_acceleratesDrawing);
 
@@ -138,7 +128,6 @@
     if (!decoder.decode(result.m_isOpaque))
         return false;
 
-#if HAVE(IOSURFACE)
     if (result.m_acceleratesDrawing) {
         MachSendRight sendRight;
         if (!decoder.decode(sendRight))
@@ -146,7 +135,6 @@
         result.m_frontBufferSendRight = WTFMove(sendRight);
         return true;
     }
-#endif
 
     ASSERT(!result.m_acceleratesDrawing);
 
@@ -177,7 +165,6 @@
 
 unsigned RemoteLayerBackingStore::bytesPerPixel() const
 {
-#if HAVE(IOSURFACE)
     switch (surfaceBufferFormat()) {
     case WebCore::IOSurface::Format::RGBA: return 4;
     case WebCore::IOSurface::Format::YUV422: return 2;
@@ -186,7 +173,6 @@
     case WebCore::IOSurface::Format::RGB10A8: return 5;
 #endif
     }
-#endif
     return 4;
 }
 
@@ -194,7 +180,6 @@
 {
     WebCore::IntSize expandedScaledSize = backingStoreSize();
 
-#if HAVE(IOSURFACE)
     if (m_acceleratesDrawing) {
         if (!m_backBuffer.surface || m_backBuffer.surface->isInUse()) {
             std::swap(m_backBuffer, m_secondaryBackBuffer);
@@ -210,7 +195,6 @@
         setBufferVolatility(BufferType::Front, false);
         return;
     }
-#endif
 
     ASSERT(!m_acceleratesDrawing);
     std::swap(m_frontBuffer, m_backBuffer);
@@ -254,7 +238,6 @@
 
     swapToValidFrontBuffer();
 
-#if HAVE(IOSURFACE)
     if (m_acceleratesDrawing) {
         RetainPtr<CGImageRef> backImage;
         if (m_backBuffer.surface && !willPaintEntireBackingStore)
@@ -269,9 +252,7 @@
 
             m_frontBuffer.surface->releaseGraphicsContext();
         }
-    } else
-#endif
-    {
+    } else {
         ASSERT(!m_acceleratesDrawing);
         std::unique_ptr<WebCore::GraphicsContext> context = m_frontBuffer.bitmap->createGraphicsContext();
 
@@ -402,7 +383,6 @@
 {
     layer.contentsOpaque = m_isOpaque;
 
-#if HAVE(IOSURFACE)
     if (acceleratesDrawing()) {
         switch (contentsType) {
         case LayerContentsType::IOSurface:
@@ -419,7 +399,6 @@
         }
         return;
     }
-#endif
 
     ASSERT(!acceleratesDrawing());
     layer.contents = (__bridge id)m_frontBuffer.bitmap->makeCGImageCopy().get();
@@ -430,7 +409,6 @@
     return WTFMove(m_frontContextPendingFlush);
 }
 
-#if HAVE(IOSURFACE)
 bool RemoteLayerBackingStore::setBufferVolatility(BufferType type, bool isVolatile)
 {
     // Return value is true if we succeeded in making volatile.
@@ -484,24 +462,15 @@
     }
     return true;
 }
-#else
-bool RemoteLayerBackingStore::setBufferVolatility(BufferType, bool)
-{
-    return true;
-}
-#endif
 
 void RemoteLayerBackingStore::Buffer::discard()
 {
-#if HAVE(IOSURFACE)
     if (surface)
         WebCore::IOSurface::moveToPool(WTFMove(surface));
     isVolatile = false;
-#endif
     bitmap = nullptr;
 }
 
-#if HAVE(IOSURFACE)
 WebCore::IOSurface::Format RemoteLayerBackingStore::surfaceBufferFormat() const
 {
 #if HAVE(IOSURFACE_RGB10)
@@ -511,6 +480,5 @@
 
     return WebCore::IOSurface::Format::RGBA;
 }
-#endif // HAVE(IOSURFACE)
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm (261132 => 261133)


--- trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -1009,7 +1009,6 @@
 
     CATransform3D transform = CATransform3DMakeScale(deviceScale, deviceScale, 1);
 
-#if HAVE(IOSURFACE)
 #if HAVE(IOSURFACE_RGB10)
     WebCore::IOSurface::Format snapshotFormat = WebCore::screenSupportsExtendedColor() ? WebCore::IOSurface::Format::RGB10 : WebCore::IOSurface::Format::RGBA;
 #else
@@ -1034,16 +1033,6 @@
 #endif // HAVE(IOSURFACE_ACCELERATOR)
 
     return WebKit::ViewSnapshot::create(WTFMove(surface));
-#else // HAVE(IOSURFACE)
-    uint32_t slotID = [WebKit::ViewSnapshotStore::snapshottingContext() createImageSlot:snapshotSize hasAlpha:YES];
-
-    if (!slotID)
-        return nullptr;
-
-    CARenderServerCaptureLayerWithTransform(MACH_PORT_NULL, self.layer.context.contextId, (uint64_t)self.layer, slotID, 0, 0, &transform);
-    WebCore::IntSize imageSize = WebCore::expandedIntSize(WebCore::FloatSize(snapshotSize));
-    return WebKit::ViewSnapshot::create(slotID, imageSize, (imageSize.area() * 4).unsafeGet());
-#endif // HAVE(IOSURFACE)
 #else // HAVE(CORE_ANIMATION_RENDER_SERVER)
     return nullptr;
 #endif
@@ -2888,7 +2877,7 @@
         return;
     }
 
-#if HAVE(CORE_ANIMATION_RENDER_SERVER) && HAVE(IOSURFACE)
+#if HAVE(CORE_ANIMATION_RENDER_SERVER)
     // If we are parented and not hidden, and thus won't incur a significant penalty from paging in tiles, snapshot the view hierarchy directly.
     NSString *displayName = self.window.screen.displayConfiguration.name;
     if (displayName && !self.window.hidden) {

Modified: trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp (261132 => 261133)


--- trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/UIProcess/Cocoa/UserMediaCaptureManagerProxy.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -143,7 +143,6 @@
 
     void videoSampleAvailable(MediaSample& sample) final
     {
-#if HAVE(IOSURFACE)
         std::unique_ptr<RemoteVideoSample> remoteSample;
         if (m_shouldApplyRotation && sample.videoRotation() != MediaSample::VideoRotation::None) {
             auto pixelBuffer = rotatePixelBuffer(sample);
@@ -152,9 +151,6 @@
             remoteSample = RemoteVideoSample::create(sample);
         if (remoteSample)
             m_connection->send(Messages::UserMediaCaptureManager::RemoteVideoSampleAvailable(m_id, WTFMove(*remoteSample)), 0);
-#else
-        ASSERT_NOT_REACHED();
-#endif
     }
 
     RetainPtr<CVPixelBufferRef> rotatePixelBuffer(MediaSample& sample)

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm (261132 => 261133)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -115,11 +115,9 @@
     : DrawingAreaProxy(DrawingAreaTypeRemoteLayerTree, webPageProxy, process)
     , m_remoteLayerTreeHost(makeUnique<RemoteLayerTreeHost>(*this))
 {
-#if HAVE(IOSURFACE)
     // We don't want to pool surfaces in the UI process.
     // FIXME: We should do this somewhere else.
     IOSurfacePool::sharedPool().setPoolSize(0);
-#endif
 
     process.addMessageReceiver(Messages::RemoteLayerTreeDrawingAreaProxy::messageReceiverName(), m_identifier, *this);
 

Modified: trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm (261132 => 261133)


--- trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -307,7 +307,6 @@
     m_rootNode = nullptr;
 }
 
-#if HAVE(IOSURFACE)
 static void recursivelyMapIOSurfaceBackingStore(CALayer *layer)
 {
     if (layer.contents && CFGetTypeID((__bridge CFTypeRef)layer.contents) == CAMachPortGetTypeID()) {
@@ -319,13 +318,10 @@
     for (CALayer *sublayer in layer.sublayers)
         recursivelyMapIOSurfaceBackingStore(sublayer);
 }
-#endif
 
 void RemoteLayerTreeHost::mapAllIOSurfaceBackingStore()
 {
-#if HAVE(IOSURFACE)
     recursivelyMapIOSurfaceBackingStore(rootLayer());
-#endif
 }
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp (261132 => 261133)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -27,7 +27,6 @@
 #include "ImageBufferShareableIOSurfaceBackend.h"
 
 #if ENABLE(GPU_PROCESS)
-#if HAVE(IOSURFACE)
 
 #include <WebCore/GraphicsContextCG.h>
 #include <wtf/IsoMallocInlines.h>
@@ -78,5 +77,4 @@
 
 } // namespace WebKit
 
-#endif // HAVE(IOSURFACE)
-#endif // ENABLE(GPU_PROCESS)
+#endif // ENABLE(GPU_PROCESS) && HAVE(IOSURFACE)

Modified: trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h (261132 => 261133)


--- trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/WebProcess/GPU/graphics/cocoa/ImageBufferShareableIOSurfaceBackend.h	2020-05-05 01:00:39 UTC (rev 261133)
@@ -26,7 +26,6 @@
 #pragma once
 
 #if ENABLE(GPU_PROCESS)
-#if HAVE(IOSURFACE)
 
 #include "ImageBufferBackendHandle.h"
 #include <WebCore/ImageBufferIOSurfaceBackend.h>
@@ -50,5 +49,4 @@
 
 } // namespace WebKit
 
-#endif // HAVE(IOSURFACE)
 #endif // ENABLE(GPU_PROCESS)

Modified: trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp (261132 => 261133)


--- trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/WebProcess/GPU/webrtc/MediaRecorderPrivate.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -84,12 +84,8 @@
 {
     if (track.id() != m_recordedVideoTrackID)
         return;
-#if HAVE(IOSURFACE)
     if (auto remoteSample = RemoteVideoSample::create(sample))
         m_connection->send(Messages::RemoteMediaRecorder::VideoSampleAvailable { WTFMove(*remoteSample) }, m_identifier);
-#else
-    ASSERT_NOT_REACHED();
-#endif
 }
 
 void MediaRecorderPrivate::audioSamplesAvailable(const MediaTime& time, const PlatformAudioData& audioData, const AudioStreamDescription& description, size_t numberOfFrames)

Modified: trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp (261132 => 261133)


--- trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/WebProcess/Network/webrtc/LibWebRTCProvider.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -137,16 +137,15 @@
 }
 
 #if PLATFORM(COCOA)
+
 std::unique_ptr<webrtc::VideoDecoderFactory> LibWebRTCProvider::createDecoderFactory()
 {
-#if ENABLE(GPU_PROCESS)
-    // We only support efficient sending of video frames with IOSURFACE
-#if HAVE(IOSURFACE) && !PLATFORM(MACCATALYST)
+#if ENABLE(GPU_PROCESS) && !PLATFORM(MACCATALYST)
     LibWebRTCCodecs::setCallbacks(RuntimeEnabledFeatures::sharedFeatures().webRTCPlatformCodecsInGPUProcessEnabled());
 #endif
-#endif
     return LibWebRTCProviderCocoa::createDecoderFactory();
 }
+
 #endif
 
 } // namespace WebKit

Modified: trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp (261132 => 261133)


--- trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Source/WebKit/WebProcess/cocoa/UserMediaCaptureManager.cpp	2020-05-05 01:00:39 UTC (rev 261133)
@@ -193,7 +193,6 @@
         RealtimeMediaSource::audioSamplesAvailable(time, audioData, m_description, numberOfFrames);
     }
 
-#if HAVE(IOSURFACE)
     void remoteVideoSampleAvailable(RemoteVideoSample&& remoteSample)
     {
         ASSERT(type() == Type::Video);
@@ -216,7 +215,6 @@
 
         RealtimeMediaSource::videoSampleAvailable(*sampleRef);
     }
-#endif
 
     void applyConstraintsSucceeded(const WebCore::RealtimeMediaSourceSettings& settings)
     {
@@ -396,18 +394,11 @@
     }
 }
 
-#if HAVE(IOSURFACE)
 void UserMediaCaptureManager::remoteVideoSampleAvailable(RealtimeMediaSourceIdentifier id, RemoteVideoSample&& sample)
 {
     if (auto source = m_sources.get(id))
         source->remoteVideoSampleAvailable(WTFMove(sample));
 }
-#else
-NO_RETURN_DUE_TO_ASSERT void UserMediaCaptureManager::remoteVideoSampleAvailable(RealtimeMediaSourceIdentifier, RemoteVideoSample&&)
-{
-    ASSERT_NOT_REACHED();
-}
-#endif
 
 IPC::Connection* UserMediaCaptureManager::Source::connection()
 {

Modified: trunk/Tools/ChangeLog (261132 => 261133)


--- trunk/Tools/ChangeLog	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Tools/ChangeLog	2020-05-05 01:00:39 UTC (rev 261133)
@@ -1,3 +1,17 @@
+2020-05-04  Darin Adler  <[email protected]>
+
+        Remove HAVE(IOSURFACE) checks in Cocoa-platform-specific code
+        https://bugs.webkit.org/show_bug.cgi?id=211389
+
+        Reviewed by Alexey Proskuryakov.
+
+        * DumpRenderTree/ios/PixelDumpSupportIOS.mm:
+        (createBitmapContextFromWebView): Remove BEGIN/END_BLOCK_OBJC_EXCEPTIONS
+        since they are not needed/appropriate in test code. Remove HAVE(IOSURFACE)
+        since this is Cocoa-specific.
+        * WebKitTestRunner/ios/PlatformWebViewIOS.mm:
+        (WTR::PlatformWebView::windowSnapshotImage): Ditto.
+
 2020-05-04  Alexey Proskuryakov  <[email protected]>
 
         block-spammers tool should hide attachments

Modified: trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm (261132 => 261133)


--- trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Tools/DumpRenderTree/ios/PixelDumpSupportIOS.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -54,9 +54,6 @@
 
 RefPtr<BitmapContext> createBitmapContextFromWebView(bool onscreen, bool incrementalRepaint, bool sweepHorizontally, bool drawSelectionRect)
 {
-    // TODO: <rdar://problem/6558366> DumpRenderTree: Investigate testRepaintSweepHorizontally and dumpSelectionRect
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
     WebThreadLock();
     [CATransaction flush];
 
@@ -66,7 +63,6 @@
     int bufferWidth = ceil(viewSize.width * deviceScaleFactor);
     int bufferHeight = ceil(viewSize.height * deviceScaleFactor);
 
-#if HAVE(IOSURFACE)
     WebCore::FloatSize snapshotSize(viewSize);
     snapshotSize.scale(deviceScaleFactor);
 
@@ -86,38 +82,4 @@
 
     CGContextDrawImage(bitmapContext->cgContext(), CGRectMake(0, 0, bufferWidth, bufferHeight), cgImage.get());
     return bitmapContext;
-#else
-    CATransform3D transform = CATransform3DMakeScale(deviceScaleFactor, deviceScaleFactor, 1);
-    static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
-
-    CARenderServerBufferRef buffer = CARenderServerCreateBuffer(bufferWidth, bufferHeight);
-    if (!buffer) {
-        WTFLogAlways("CARenderServerCreateBuffer failed for buffer with width %d height %d\n", bufferWidth, bufferHeight);
-        return nullptr;
-    }
-
-    CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, [gWebBrowserView layer].context.contextId, reinterpret_cast<uint64_t>([gWebBrowserView layer]), buffer, 0, 0, &transform);
-
-    uint8_t* data = ""
-    size_t rowBytes = CARenderServerGetBufferRowBytes(buffer);
-
-    RetainPtr<CGDataProviderRef> provider = adoptCF(CGDataProviderCreateWithData(0, data, CARenderServerGetBufferDataSize(buffer), nullptr));
-    
-    RetainPtr<CGImageRef> cgImage = adoptCF(CGImageCreate(bufferWidth, bufferHeight, 8, 32, rowBytes, sRGBSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, provider.get(), 0, false, kCGRenderingIntentDefault));
-
-    void* bitmapBuffer = nullptr;
-    size_t bitmapRowBytes = 0;
-    auto bitmapContext = createBitmapContext(bufferWidth, bufferHeight, bitmapRowBytes, bitmapBuffer);
-    if (!bitmapContext) {
-        CARenderServerDestroyBuffer(buffer);
-        return nullptr;
-    }
-
-    CGContextDrawImage(bitmapContext->cgContext(), CGRectMake(0, 0, bufferWidth, bufferHeight), cgImage.get());
-    CARenderServerDestroyBuffer(buffer);
-
-    return bitmapContext;
-#endif
-
-    END_BLOCK_OBJC_EXCEPTIONS;
 }

Modified: trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm (261132 => 261133)


--- trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2020-05-05 00:59:07 UTC (rev 261132)
+++ trunk/Tools/WebKitTestRunner/ios/PlatformWebViewIOS.mm	2020-05-05 01:00:39 UTC (rev 261133)
@@ -312,17 +312,8 @@
 {
 }
 
-#if !HAVE(IOSURFACE)
-static void releaseDataProviderData(void* info, const void*, size_t)
-{
-    CARenderServerDestroyBuffer(static_cast<CARenderServerBufferRef>(info));
-}
-#endif
-
 RetainPtr<CGImageRef> PlatformWebView::windowSnapshotImage()
 {
-    BEGIN_BLOCK_OBJC_EXCEPTIONS;
-
     CGSize viewSize = m_view.bounds.size;
     RELEASE_ASSERT(viewSize.width);
     RELEASE_ASSERT(viewSize.height);
@@ -346,11 +337,10 @@
         viewsToUnhide.uncheckedAppend(endGrabberView);
     }
 
-#if HAVE(IOSURFACE)
     __block bool isDone = false;
     __block RetainPtr<CGImageRef> result;
     
-    RetainPtr<WKSnapshotConfiguration> snapshotConfiguration = adoptNS([[WKSnapshotConfiguration alloc] init]);
+    auto snapshotConfiguration = adoptNS([[WKSnapshotConfiguration alloc] init]);
     [snapshotConfiguration setRect:CGRectMake(0, 0, viewSize.width, viewSize.height)];
     [snapshotConfiguration setSnapshotWidth:@(viewSize.width)];
     
@@ -365,32 +355,11 @@
     }];
     while (!isDone)
         [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantPast]];
-#else
-    CGFloat deviceScaleFactor = 2; // FIXME: hardcode 2x for now. In future we could respect 1x and 3x as we do on Mac.
-    CATransform3D transform = CATransform3DMakeScale(deviceScaleFactor, deviceScaleFactor, 1);
-    
-    int bufferWidth = ceil(viewSize.width * deviceScaleFactor);
-    int bufferHeight = ceil(viewSize.height * deviceScaleFactor);
 
-    CARenderServerBufferRef buffer = CARenderServerCreateBuffer(bufferWidth, bufferHeight);
-    RELEASE_ASSERT(buffer);
-
-    CARenderServerRenderLayerWithTransform(MACH_PORT_NULL, m_view.layer.context.contextId, reinterpret_cast<uint64_t>(m_view.layer), buffer, 0, 0, &transform);
-
-    uint8_t* data = ""
-    size_t rowBytes = CARenderServerGetBufferRowBytes(buffer);
-
-    static CGColorSpaceRef sRGBSpace = CGColorSpaceCreateWithName(kCGColorSpaceSRGB);
-    auto provider = adoptCF(CGDataProviderCreateWithData(buffer, data, CARenderServerGetBufferDataSize(buffer), releaseDataProviderData));
-    
-    auto result = adoptCF(CGImageCreate(bufferWidth, bufferHeight, 8, 32, rowBytes, sRGBSpace, kCGImageAlphaPremultipliedFirst | kCGBitmapByteOrder32Host, provider.get(), 0, false, kCGRenderingIntentDefault));
-    RELEASE_ASSERT(result);
-#endif
     for (auto view : viewsToUnhide)
         [view setHidden:NO];
 
     return result;
-    END_BLOCK_OBJC_EXCEPTIONS;
 }
 
 void PlatformWebView::setNavigationGesturesEnabled(bool enabled)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to