Title: [202142] trunk/Source
Revision
202142
Author
[email protected]
Date
2016-06-16 15:44:32 -0700 (Thu, 16 Jun 2016)

Log Message

Fix macOS Sierra build
https://bugs.webkit.org/show_bug.cgi?id=158849

Reviewed by Tim Horton.

Source/WebCore:

Add WebCore:: qualifiers for IOSurface, to avoid conflicts with the IOSurface Objective-C class.

Also, add an asLayerContents() getter that will return an id that's suitable for setting
as the contents of a CALayer.

* platform/graphics/cocoa/IOSurface.h:
* platform/graphics/cocoa/IOSurface.mm:

Source/WebKit2:

Add WebCore:: qualifiers for IOSurface, to avoid conflicts with the IOSurface Objective-C class
and adopt IOSurface::asLayerContents().

* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::decode):
(WebKit::RemoteLayerBackingStore::bytesPerPixel):
(WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
(WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
(WebKit::RemoteLayerBackingStore::setBufferVolatility):
(WebKit::RemoteLayerBackingStore::Buffer::discard):
* UIProcess/mac/ViewSnapshotStore.mm:
(WebKit::ViewSnapshot::create):
(WebKit::ViewSnapshot::ViewSnapshot):
(WebKit::ViewSnapshot::asLayerContents):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (202141 => 202142)


--- trunk/Source/WebCore/ChangeLog	2016-06-16 22:18:06 UTC (rev 202141)
+++ trunk/Source/WebCore/ChangeLog	2016-06-16 22:44:32 UTC (rev 202142)
@@ -1,3 +1,18 @@
+2016-06-16  Anders Carlsson  <[email protected]>
+
+        Fix macOS Sierra build
+        https://bugs.webkit.org/show_bug.cgi?id=158849
+
+        Reviewed by Tim Horton.
+
+        Add WebCore:: qualifiers for IOSurface, to avoid conflicts with the IOSurface Objective-C class.
+        
+        Also, add an asLayerContents() getter that will return an id that's suitable for setting 
+        as the contents of a CALayer.
+
+        * platform/graphics/cocoa/IOSurface.h:
+        * platform/graphics/cocoa/IOSurface.mm:
+
 2016-06-16  Andreas Kling  <[email protected]>
 
         REGRESSION(r196217): 3% JSBench regression on iPhone 5.

Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (202141 => 202142)


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2016-06-16 22:18:06 UTC (rev 202141)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h	2016-06-16 22:44:32 UTC (rev 202142)
@@ -65,6 +65,7 @@
     WEBCORE_EXPORT RetainPtr<CGImageRef> createImage();
     static RetainPtr<CGImageRef> sinkIntoImage(std::unique_ptr<IOSurface>);
 
+    id asLayerContents() const { return (id)(CFTypeRef)m_surface.get(); }
     IOSurfaceRef surface() const { return m_surface.get(); }
     WEBCORE_EXPORT GraphicsContext& ensureGraphicsContext();
     WEBCORE_EXPORT CGContextRef ensurePlatformContext();

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


--- trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2016-06-16 22:18:06 UTC (rev 202141)
+++ trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm	2016-06-16 22:44:32 UTC (rev 202142)
@@ -45,7 +45,7 @@
 
 using namespace WebCore;
 
-inline std::unique_ptr<IOSurface> IOSurface::surfaceFromPool(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
+inline std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::surfaceFromPool(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
 {
     auto cachedSurface = IOSurfacePool::sharedPool().takeSurface(size, colorSpace, pixelFormat);
     if (!cachedSurface)
@@ -55,7 +55,7 @@
     return cachedSurface;
 }
 
-std::unique_ptr<IOSurface> IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
+std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
 {
     if (auto cachedSurface = surfaceFromPool(size, size, colorSpace, pixelFormat))
         return cachedSurface;
@@ -63,25 +63,25 @@
     return std::unique_ptr<IOSurface>(new IOSurface(size, colorSpace, pixelFormat));
 }
 
-std::unique_ptr<IOSurface> IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
+std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
 {
     if (auto cachedSurface = surfaceFromPool(size, contextSize, colorSpace, pixelFormat))
         return cachedSurface;
     return std::unique_ptr<IOSurface>(new IOSurface(size, contextSize, colorSpace, pixelFormat));
 }
 
-std::unique_ptr<IOSurface> IOSurface::createFromSendRight(const MachSendRight& sendRight, ColorSpace colorSpace)
+std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromSendRight(const MachSendRight& sendRight, ColorSpace colorSpace)
 {
     auto surface = adoptCF(IOSurfaceLookupFromMachPort(sendRight.sendRight()));
     return IOSurface::createFromSurface(surface.get(), colorSpace);
 }
 
-std::unique_ptr<IOSurface> IOSurface::createFromSurface(IOSurfaceRef surface, ColorSpace colorSpace)
+std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromSurface(IOSurfaceRef surface, ColorSpace colorSpace)
 {
     return std::unique_ptr<IOSurface>(new IOSurface(surface, colorSpace));
 }
 
-std::unique_ptr<IOSurface> IOSurface::createFromImage(CGImageRef image)
+std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromImage(CGImageRef image)
 {
     if (!image)
         return nullptr;
@@ -97,12 +97,12 @@
     return surface;
 }
 
-void IOSurface::moveToPool(std::unique_ptr<IOSurface>&& surface)
+void WebCore::IOSurface::moveToPool(std::unique_ptr<IOSurface>&& surface)
 {
     IOSurfacePool::sharedPool().addSurface(WTFMove(surface));
 }
 
-std::unique_ptr<IOSurface> IOSurface::createFromImageBuffer(std::unique_ptr<ImageBuffer> imageBuffer)
+std::unique_ptr<WebCore::IOSurface> WebCore::IOSurface::createFromImageBuffer(std::unique_ptr<ImageBuffer> imageBuffer)
 {
     return WTFMove(imageBuffer->m_data.surface);
 }
@@ -179,7 +179,7 @@
 
 }
 
-IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
+WebCore::IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
     : m_colorSpace(colorSpace)
     , m_size(size)
     , m_contextSize(size)
@@ -207,7 +207,7 @@
         NSLog(@"Surface creation failed for options %@", options);
 }
 
-IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
+WebCore::IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
     : IOSurface(size, colorSpace, pixelFormat)
 {
     ASSERT(contextSize.width() <= size.width());
@@ -215,7 +215,7 @@
     m_contextSize = contextSize;
 }
 
-IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
+WebCore::IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
     : m_colorSpace(colorSpace)
     , m_surface(surface)
 {
@@ -223,7 +223,7 @@
     m_totalBytes = IOSurfaceGetAllocSize(surface);
 }
 
-IntSize IOSurface::maximumSize()
+IntSize WebCore::IOSurface::maximumSize()
 {
     IntSize maxSize(clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth)), clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)));
 
@@ -241,17 +241,17 @@
     return maxSize.constrainedBetween({ iOSMaxSurfaceDimensionLowerBound, iOSMaxSurfaceDimensionLowerBound }, { iOSMaxSurfaceDimension, iOSMaxSurfaceDimension });
 }
 
-MachSendRight IOSurface::createSendRight() const
+MachSendRight WebCore::IOSurface::createSendRight() const
 {
     return MachSendRight::adopt(IOSurfaceCreateMachPort(m_surface.get()));
 }
 
-RetainPtr<CGImageRef> IOSurface::createImage()
+RetainPtr<CGImageRef> WebCore::IOSurface::createImage()
 {
     return adoptCF(CGIOSurfaceContextCreateImage(ensurePlatformContext()));
 }
 
-RetainPtr<CGImageRef> IOSurface::sinkIntoImage(std::unique_ptr<IOSurface> surface)
+RetainPtr<CGImageRef> WebCore::IOSurface::sinkIntoImage(std::unique_ptr<IOSurface> surface)
 {
 #if (PLATFORM(IOS) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 100000) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100)
     return adoptCF(CGIOSurfaceContextCreateImageReference(surface->ensurePlatformContext()));
@@ -260,7 +260,7 @@
 #endif
 }
 
-void IOSurface::setContextSize(IntSize contextSize)
+void WebCore::IOSurface::setContextSize(IntSize contextSize)
 {
     if (contextSize == m_contextSize)
         return;
@@ -271,7 +271,7 @@
     m_contextSize = contextSize;
 }
 
-CGContextRef IOSurface::ensurePlatformContext()
+CGContextRef WebCore::IOSurface::ensurePlatformContext()
 {
     if (m_cgContext)
         return m_cgContext.get();
@@ -302,7 +302,7 @@
     return m_cgContext.get();
 }
 
-GraphicsContext& IOSurface::ensureGraphicsContext()
+GraphicsContext& WebCore::IOSurface::ensureGraphicsContext()
 {
     if (m_graphicsContext)
         return *m_graphicsContext;
@@ -313,7 +313,7 @@
     return *m_graphicsContext;
 }
 
-IOSurface::SurfaceState IOSurface::state() const
+WebCore::IOSurface::SurfaceState WebCore::IOSurface::state() const
 {
     uint32_t previousState = 0;
     IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), kIOSurfacePurgeableKeepCurrent, &previousState);
@@ -321,7 +321,7 @@
     return previousState == kIOSurfacePurgeableEmpty ? IOSurface::SurfaceState::Empty : IOSurface::SurfaceState::Valid;
 }
 
-bool IOSurface::isVolatile() const
+bool WebCore::IOSurface::isVolatile() const
 {
     uint32_t previousState = 0;
     IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), kIOSurfacePurgeableKeepCurrent, &previousState);
@@ -329,7 +329,7 @@
     return previousState != kIOSurfacePurgeableNonVolatile;
 }
 
-IOSurface::SurfaceState IOSurface::setIsVolatile(bool isVolatile)
+WebCore::IOSurface::SurfaceState WebCore::IOSurface::setIsVolatile(bool isVolatile)
 {
     uint32_t previousState = 0;
     IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), isVolatile ? kIOSurfacePurgeableVolatile : kIOSurfacePurgeableNonVolatile, &previousState);
@@ -341,7 +341,7 @@
     return IOSurface::SurfaceState::Valid;
 }
 
-IOSurface::Format IOSurface::format() const
+WebCore::IOSurface::Format WebCore::IOSurface::format() const
 {
     unsigned pixelFormat = IOSurfaceGetPixelFormat(m_surface.get());
     if (pixelFormat == 'BGRA')
@@ -360,19 +360,19 @@
     return Format::RGBA;
 }
 
-bool IOSurface::isInUse() const
+bool WebCore::IOSurface::isInUse() const
 {
     return IOSurfaceIsInUse(m_surface.get());
 }
 
-void IOSurface::releaseGraphicsContext()
+void WebCore::IOSurface::releaseGraphicsContext()
 {
     m_graphicsContext = nullptr;
     m_cgContext = nullptr;
 }
 
 #if PLATFORM(IOS)
-bool IOSurface::allowConversionFromFormatToFormat(Format sourceFormat, Format destFormat)
+bool WebCore::IOSurface::allowConversionFromFormatToFormat(Format sourceFormat, Format destFormat)
 {
     if ((sourceFormat == Format::RGB10 || sourceFormat == Format::RGB10A8) && destFormat == Format::YUV422)
         return false;
@@ -380,7 +380,7 @@
     return true;
 }
 
-void IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, std::function<void(std::unique_ptr<WebCore::IOSurface>)> callback)
+void WebCore::IOSurface::convertToFormat(std::unique_ptr<WebCore::IOSurface>&& inSurface, Format format, std::function<void(std::unique_ptr<WebCore::IOSurface>)> callback)
 {
     static IOSurfaceAcceleratorRef accelerator;
     if (!accelerator) {
@@ -399,11 +399,11 @@
     IOSurfaceRef destinationIOSurfaceRef = destinationSurface->surface();
 
     IOSurfaceAcceleratorCompletion completion;
-    completion.completionRefCon = new std::function<void(std::unique_ptr<IOSurface>)> (WTFMove(callback));
+    completion.completionRefCon = new std::function<void(std::unique_ptr<WebCore::IOSurface>)> (WTFMove(callback));
     completion.completionRefCon2 = destinationSurface.release();
     completion.completionCallback = [](void *completionRefCon, IOReturn, void * completionRefCon2) {
         auto* callback = static_cast<std::function<void(std::unique_ptr<WebCore::IOSurface>)>*>(completionRefCon);
-        auto destinationSurface = std::unique_ptr<IOSurface>(static_cast<IOSurface*>(completionRefCon2));
+        auto destinationSurface = std::unique_ptr<WebCore::IOSurface>(static_cast<WebCore::IOSurface*>(completionRefCon2));
         
         (*callback)(WTFMove(destinationSurface));
         delete callback;

Modified: trunk/Source/WebKit2/ChangeLog (202141 => 202142)


--- trunk/Source/WebKit2/ChangeLog	2016-06-16 22:18:06 UTC (rev 202141)
+++ trunk/Source/WebKit2/ChangeLog	2016-06-16 22:44:32 UTC (rev 202142)
@@ -1,3 +1,25 @@
+2016-06-16  Anders Carlsson  <[email protected]>
+
+        Fix macOS Sierra build
+        https://bugs.webkit.org/show_bug.cgi?id=158849
+
+        Reviewed by Tim Horton.
+
+        Add WebCore:: qualifiers for IOSurface, to avoid conflicts with the IOSurface Objective-C class
+        and adopt IOSurface::asLayerContents().
+
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::decode):
+        (WebKit::RemoteLayerBackingStore::bytesPerPixel):
+        (WebKit::RemoteLayerBackingStore::swapToValidFrontBuffer):
+        (WebKit::RemoteLayerBackingStore::applyBackingStoreToLayer):
+        (WebKit::RemoteLayerBackingStore::setBufferVolatility):
+        (WebKit::RemoteLayerBackingStore::Buffer::discard):
+        * UIProcess/mac/ViewSnapshotStore.mm:
+        (WebKit::ViewSnapshot::create):
+        (WebKit::ViewSnapshot::ViewSnapshot):
+        (WebKit::ViewSnapshot::asLayerContents):
+
 2016-06-16  Brady Eidson  <[email protected]>
 
         When a WebsiteDataStore finds no ProcessPools and creates one from scratch, it should represent the data store's config.

Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (202141 => 202142)


--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2016-06-16 22:18:06 UTC (rev 202141)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm	2016-06-16 22:44:32 UTC (rev 202142)
@@ -150,7 +150,7 @@
         MachSendRight sendRight;
         if (!decoder.decode(sendRight))
             return false;
-        result.m_frontBuffer.surface = IOSurface::createFromSendRight(sendRight, ColorSpaceSRGB);
+        result.m_frontBuffer.surface = WebCore::IOSurface::createFromSendRight(sendRight, ColorSpaceSRGB);
         return true;
     }
 #endif
@@ -185,12 +185,11 @@
 unsigned RemoteLayerBackingStore::bytesPerPixel() const
 {
 #if USE(IOSURFACE)
-    WebCore::IOSurface::Format format = bufferFormat(m_isOpaque);
-    switch (format) {
-    case IOSurface::Format::RGBA: return 4;
-    case IOSurface::Format::YUV422: return 2;
-    case IOSurface::Format::RGB10: return 4;
-    case IOSurface::Format::RGB10A8: return 5;
+    switch (bufferFormat(m_isOpaque)) {
+    case WebCore::IOSurface::Format::RGBA: return 4;
+    case WebCore::IOSurface::Format::YUV422: return 2;
+    case WebCore::IOSurface::Format::RGB10: return 4;
+    case WebCore::IOSurface::Format::RGB10A8: return 5;
     }
 #endif
     return 4;
@@ -211,7 +210,7 @@
         std::swap(m_frontBuffer, m_backBuffer);
 
         if (!m_frontBuffer.surface)
-            m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque));
+            m_frontBuffer.surface = WebCore::IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque));
 
         setBufferVolatility(BufferType::Front, false);
         return;
@@ -401,7 +400,7 @@
 
 #if USE(IOSURFACE)
     if (acceleratesDrawing()) {
-        layer.contents = (id)m_frontBuffer.surface->surface();
+//        layer.contents = (id)m_frontBuffer.surface->surface();
         return;
     }
 #endif
@@ -424,11 +423,11 @@
             if (isVolatile)
                 m_frontBuffer.surface->releaseGraphicsContext();
             if (!isVolatile || !m_frontBuffer.surface->isInUse()) {
-                IOSurface::SurfaceState previousState = m_frontBuffer.surface->setIsVolatile(isVolatile);
+                auto previousState = m_frontBuffer.surface->setIsVolatile(isVolatile);
                 m_frontBuffer.isVolatile = isVolatile;
 
                 // Becoming non-volatile and the front buffer was purged, so we need to repaint.
-                if (!isVolatile && (previousState == IOSurface::SurfaceState::Empty))
+                if (!isVolatile && (previousState == WebCore::IOSurface::SurfaceState::Empty))
                     setNeedsDisplay();
             } else
                 return false;
@@ -470,7 +469,7 @@
 {
 #if USE(IOSURFACE)
     if (surface)
-        IOSurface::moveToPool(WTFMove(surface));
+        WebCore::IOSurface::moveToPool(WTFMove(surface));
     isVolatile = false;
 #endif
     bitmap = nullptr;

Modified: trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm (202141 => 202142)


--- trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm	2016-06-16 22:18:06 UTC (rev 202141)
+++ trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm	2016-06-16 22:44:32 UTC (rev 202142)
@@ -132,7 +132,7 @@
 }
 
 #if USE(IOSURFACE)
-Ref<ViewSnapshot> ViewSnapshot::create(std::unique_ptr<IOSurface> surface)
+Ref<ViewSnapshot> ViewSnapshot::create(std::unique_ptr<WebCore::IOSurface> surface)
 {
     return adoptRef(*new ViewSnapshot(WTFMove(surface)));
 }
@@ -144,7 +144,7 @@
 #endif
 
 #if USE(IOSURFACE)
-ViewSnapshot::ViewSnapshot(std::unique_ptr<IOSurface> surface)
+ViewSnapshot::ViewSnapshot(std::unique_ptr<WebCore::IOSurface> surface)
     : m_surface(WTFMove(surface))
 #else
 ViewSnapshot::ViewSnapshot(uint32_t slotID, IntSize size, size_t imageSizeInBytes)
@@ -207,12 +207,12 @@
     if (!m_surface)
         return nullptr;
 
-    if (m_surface->setIsVolatile(false) != IOSurface::SurfaceState::Valid) {
+    if (m_surface->setIsVolatile(false) != WebCore::IOSurface::SurfaceState::Valid) {
         clearImage();
         return nullptr;
     }
 
-    return (id)m_surface->surface();
+    return m_surface->asLayerContents();
 #else
     return [CAContext objectForSlot:m_slotID];
 #endif
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to