<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[202142] trunk/Source</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/202142">202142</a></dd>
<dt>Author</dt> <dd>andersca@apple.com</dd>
<dt>Date</dt> <dd>2016-06-16 15:44:32 -0700 (Thu, 16 Jun 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>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):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfaceh">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm">trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm</a></li>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacViewSnapshotStoremm">trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (202141 => 202142)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,18 @@
</span><ins>+2016-06-16  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        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:
+
</ins><span class="cx"> 2016-06-16  Andreas Kling  &lt;akling@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         REGRESSION(r196217): 3% JSBench regression on iPhone 5.
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfaceh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.h (202141 => 202142)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -65,6 +65,7 @@
</span><span class="cx">     WEBCORE_EXPORT RetainPtr&lt;CGImageRef&gt; createImage();
</span><span class="cx">     static RetainPtr&lt;CGImageRef&gt; sinkIntoImage(std::unique_ptr&lt;IOSurface&gt;);
</span><span class="cx"> 
</span><ins>+    id asLayerContents() const { return (id)(CFTypeRef)m_surface.get(); }
</ins><span class="cx">     IOSurfaceRef surface() const { return m_surface.get(); }
</span><span class="cx">     WEBCORE_EXPORT GraphicsContext&amp; ensureGraphicsContext();
</span><span class="cx">     WEBCORE_EXPORT CGContextRef ensurePlatformContext();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscocoaIOSurfacemm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/cocoa/IOSurface.mm (202141 => 202142)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -45,7 +45,7 @@
</span><span class="cx"> 
</span><span class="cx"> using namespace WebCore;
</span><span class="cx"> 
</span><del>-inline std::unique_ptr&lt;IOSurface&gt; IOSurface::surfaceFromPool(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
</del><ins>+inline std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::surfaceFromPool(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
</ins><span class="cx"> {
</span><span class="cx">     auto cachedSurface = IOSurfacePool::sharedPool().takeSurface(size, colorSpace, pixelFormat);
</span><span class="cx">     if (!cachedSurface)
</span><span class="lines">@@ -55,7 +55,7 @@
</span><span class="cx">     return cachedSurface;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
</del><ins>+std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::create(IntSize size, ColorSpace colorSpace, Format pixelFormat)
</ins><span class="cx"> {
</span><span class="cx">     if (auto cachedSurface = surfaceFromPool(size, size, colorSpace, pixelFormat))
</span><span class="cx">         return cachedSurface;
</span><span class="lines">@@ -63,25 +63,25 @@
</span><span class="cx">     return std::unique_ptr&lt;IOSurface&gt;(new IOSurface(size, colorSpace, pixelFormat));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
</del><ins>+std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::create(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
</ins><span class="cx"> {
</span><span class="cx">     if (auto cachedSurface = surfaceFromPool(size, contextSize, colorSpace, pixelFormat))
</span><span class="cx">         return cachedSurface;
</span><span class="cx">     return std::unique_ptr&lt;IOSurface&gt;(new IOSurface(size, contextSize, colorSpace, pixelFormat));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::createFromSendRight(const MachSendRight&amp; sendRight, ColorSpace colorSpace)
</del><ins>+std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::createFromSendRight(const MachSendRight&amp; sendRight, ColorSpace colorSpace)
</ins><span class="cx"> {
</span><span class="cx">     auto surface = adoptCF(IOSurfaceLookupFromMachPort(sendRight.sendRight()));
</span><span class="cx">     return IOSurface::createFromSurface(surface.get(), colorSpace);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::createFromSurface(IOSurfaceRef surface, ColorSpace colorSpace)
</del><ins>+std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::createFromSurface(IOSurfaceRef surface, ColorSpace colorSpace)
</ins><span class="cx"> {
</span><span class="cx">     return std::unique_ptr&lt;IOSurface&gt;(new IOSurface(surface, colorSpace));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::createFromImage(CGImageRef image)
</del><ins>+std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::createFromImage(CGImageRef image)
</ins><span class="cx"> {
</span><span class="cx">     if (!image)
</span><span class="cx">         return nullptr;
</span><span class="lines">@@ -97,12 +97,12 @@
</span><span class="cx">     return surface;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IOSurface::moveToPool(std::unique_ptr&lt;IOSurface&gt;&amp;&amp; surface)
</del><ins>+void WebCore::IOSurface::moveToPool(std::unique_ptr&lt;IOSurface&gt;&amp;&amp; surface)
</ins><span class="cx"> {
</span><span class="cx">     IOSurfacePool::sharedPool().addSurface(WTFMove(surface));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-std::unique_ptr&lt;IOSurface&gt; IOSurface::createFromImageBuffer(std::unique_ptr&lt;ImageBuffer&gt; imageBuffer)
</del><ins>+std::unique_ptr&lt;WebCore::IOSurface&gt; WebCore::IOSurface::createFromImageBuffer(std::unique_ptr&lt;ImageBuffer&gt; imageBuffer)
</ins><span class="cx"> {
</span><span class="cx">     return WTFMove(imageBuffer-&gt;m_data.surface);
</span><span class="cx"> }
</span><span class="lines">@@ -179,7 +179,7 @@
</span><span class="cx"> 
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
</del><ins>+WebCore::IOSurface::IOSurface(IntSize size, ColorSpace colorSpace, Format format)
</ins><span class="cx">     : m_colorSpace(colorSpace)
</span><span class="cx">     , m_size(size)
</span><span class="cx">     , m_contextSize(size)
</span><span class="lines">@@ -207,7 +207,7 @@
</span><span class="cx">         NSLog(@&quot;Surface creation failed for options %@&quot;, options);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
</del><ins>+WebCore::IOSurface::IOSurface(IntSize size, IntSize contextSize, ColorSpace colorSpace, Format pixelFormat)
</ins><span class="cx">     : IOSurface(size, colorSpace, pixelFormat)
</span><span class="cx"> {
</span><span class="cx">     ASSERT(contextSize.width() &lt;= size.width());
</span><span class="lines">@@ -215,7 +215,7 @@
</span><span class="cx">     m_contextSize = contextSize;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
</del><ins>+WebCore::IOSurface::IOSurface(IOSurfaceRef surface, ColorSpace colorSpace)
</ins><span class="cx">     : m_colorSpace(colorSpace)
</span><span class="cx">     , m_surface(surface)
</span><span class="cx"> {
</span><span class="lines">@@ -223,7 +223,7 @@
</span><span class="cx">     m_totalBytes = IOSurfaceGetAllocSize(surface);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IntSize IOSurface::maximumSize()
</del><ins>+IntSize WebCore::IOSurface::maximumSize()
</ins><span class="cx"> {
</span><span class="cx">     IntSize maxSize(clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceWidth)), clampToInteger(IOSurfaceGetPropertyMaximum(kIOSurfaceHeight)));
</span><span class="cx"> 
</span><span class="lines">@@ -241,17 +241,17 @@
</span><span class="cx">     return maxSize.constrainedBetween({ iOSMaxSurfaceDimensionLowerBound, iOSMaxSurfaceDimensionLowerBound }, { iOSMaxSurfaceDimension, iOSMaxSurfaceDimension });
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-MachSendRight IOSurface::createSendRight() const
</del><ins>+MachSendRight WebCore::IOSurface::createSendRight() const
</ins><span class="cx"> {
</span><span class="cx">     return MachSendRight::adopt(IOSurfaceCreateMachPort(m_surface.get()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RetainPtr&lt;CGImageRef&gt; IOSurface::createImage()
</del><ins>+RetainPtr&lt;CGImageRef&gt; WebCore::IOSurface::createImage()
</ins><span class="cx"> {
</span><span class="cx">     return adoptCF(CGIOSurfaceContextCreateImage(ensurePlatformContext()));
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-RetainPtr&lt;CGImageRef&gt; IOSurface::sinkIntoImage(std::unique_ptr&lt;IOSurface&gt; surface)
</del><ins>+RetainPtr&lt;CGImageRef&gt; WebCore::IOSurface::sinkIntoImage(std::unique_ptr&lt;IOSurface&gt; surface)
</ins><span class="cx"> {
</span><span class="cx"> #if (PLATFORM(IOS) &amp;&amp; __IPHONE_OS_VERSION_MIN_REQUIRED &gt;= 100000) || (PLATFORM(MAC) &amp;&amp; __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101100)
</span><span class="cx">     return adoptCF(CGIOSurfaceContextCreateImageReference(surface-&gt;ensurePlatformContext()));
</span><span class="lines">@@ -260,7 +260,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IOSurface::setContextSize(IntSize contextSize)
</del><ins>+void WebCore::IOSurface::setContextSize(IntSize contextSize)
</ins><span class="cx"> {
</span><span class="cx">     if (contextSize == m_contextSize)
</span><span class="cx">         return;
</span><span class="lines">@@ -271,7 +271,7 @@
</span><span class="cx">     m_contextSize = contextSize;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CGContextRef IOSurface::ensurePlatformContext()
</del><ins>+CGContextRef WebCore::IOSurface::ensurePlatformContext()
</ins><span class="cx"> {
</span><span class="cx">     if (m_cgContext)
</span><span class="cx">         return m_cgContext.get();
</span><span class="lines">@@ -302,7 +302,7 @@
</span><span class="cx">     return m_cgContext.get();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-GraphicsContext&amp; IOSurface::ensureGraphicsContext()
</del><ins>+GraphicsContext&amp; WebCore::IOSurface::ensureGraphicsContext()
</ins><span class="cx"> {
</span><span class="cx">     if (m_graphicsContext)
</span><span class="cx">         return *m_graphicsContext;
</span><span class="lines">@@ -313,7 +313,7 @@
</span><span class="cx">     return *m_graphicsContext;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::SurfaceState IOSurface::state() const
</del><ins>+WebCore::IOSurface::SurfaceState WebCore::IOSurface::state() const
</ins><span class="cx"> {
</span><span class="cx">     uint32_t previousState = 0;
</span><span class="cx">     IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), kIOSurfacePurgeableKeepCurrent, &amp;previousState);
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx">     return previousState == kIOSurfacePurgeableEmpty ? IOSurface::SurfaceState::Empty : IOSurface::SurfaceState::Valid;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool IOSurface::isVolatile() const
</del><ins>+bool WebCore::IOSurface::isVolatile() const
</ins><span class="cx"> {
</span><span class="cx">     uint32_t previousState = 0;
</span><span class="cx">     IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), kIOSurfacePurgeableKeepCurrent, &amp;previousState);
</span><span class="lines">@@ -329,7 +329,7 @@
</span><span class="cx">     return previousState != kIOSurfacePurgeableNonVolatile;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::SurfaceState IOSurface::setIsVolatile(bool isVolatile)
</del><ins>+WebCore::IOSurface::SurfaceState WebCore::IOSurface::setIsVolatile(bool isVolatile)
</ins><span class="cx"> {
</span><span class="cx">     uint32_t previousState = 0;
</span><span class="cx">     IOReturn ret = IOSurfaceSetPurgeable(m_surface.get(), isVolatile ? kIOSurfacePurgeableVolatile : kIOSurfacePurgeableNonVolatile, &amp;previousState);
</span><span class="lines">@@ -341,7 +341,7 @@
</span><span class="cx">     return IOSurface::SurfaceState::Valid;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-IOSurface::Format IOSurface::format() const
</del><ins>+WebCore::IOSurface::Format WebCore::IOSurface::format() const
</ins><span class="cx"> {
</span><span class="cx">     unsigned pixelFormat = IOSurfaceGetPixelFormat(m_surface.get());
</span><span class="cx">     if (pixelFormat == 'BGRA')
</span><span class="lines">@@ -360,19 +360,19 @@
</span><span class="cx">     return Format::RGBA;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool IOSurface::isInUse() const
</del><ins>+bool WebCore::IOSurface::isInUse() const
</ins><span class="cx"> {
</span><span class="cx">     return IOSurfaceIsInUse(m_surface.get());
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IOSurface::releaseGraphicsContext()
</del><ins>+void WebCore::IOSurface::releaseGraphicsContext()
</ins><span class="cx"> {
</span><span class="cx">     m_graphicsContext = nullptr;
</span><span class="cx">     m_cgContext = nullptr;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(IOS)
</span><del>-bool IOSurface::allowConversionFromFormatToFormat(Format sourceFormat, Format destFormat)
</del><ins>+bool WebCore::IOSurface::allowConversionFromFormatToFormat(Format sourceFormat, Format destFormat)
</ins><span class="cx"> {
</span><span class="cx">     if ((sourceFormat == Format::RGB10 || sourceFormat == Format::RGB10A8) &amp;&amp; destFormat == Format::YUV422)
</span><span class="cx">         return false;
</span><span class="lines">@@ -380,7 +380,7 @@
</span><span class="cx">     return true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void IOSurface::convertToFormat(std::unique_ptr&lt;WebCore::IOSurface&gt;&amp;&amp; inSurface, Format format, std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt; callback)
</del><ins>+void WebCore::IOSurface::convertToFormat(std::unique_ptr&lt;WebCore::IOSurface&gt;&amp;&amp; inSurface, Format format, std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt; callback)
</ins><span class="cx"> {
</span><span class="cx">     static IOSurfaceAcceleratorRef accelerator;
</span><span class="cx">     if (!accelerator) {
</span><span class="lines">@@ -399,11 +399,11 @@
</span><span class="cx">     IOSurfaceRef destinationIOSurfaceRef = destinationSurface-&gt;surface();
</span><span class="cx"> 
</span><span class="cx">     IOSurfaceAcceleratorCompletion completion;
</span><del>-    completion.completionRefCon = new std::function&lt;void(std::unique_ptr&lt;IOSurface&gt;)&gt; (WTFMove(callback));
</del><ins>+    completion.completionRefCon = new std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt; (WTFMove(callback));
</ins><span class="cx">     completion.completionRefCon2 = destinationSurface.release();
</span><span class="cx">     completion.completionCallback = [](void *completionRefCon, IOReturn, void * completionRefCon2) {
</span><span class="cx">         auto* callback = static_cast&lt;std::function&lt;void(std::unique_ptr&lt;WebCore::IOSurface&gt;)&gt;*&gt;(completionRefCon);
</span><del>-        auto destinationSurface = std::unique_ptr&lt;IOSurface&gt;(static_cast&lt;IOSurface*&gt;(completionRefCon2));
</del><ins>+        auto destinationSurface = std::unique_ptr&lt;WebCore::IOSurface&gt;(static_cast&lt;WebCore::IOSurface*&gt;(completionRefCon2));
</ins><span class="cx">         
</span><span class="cx">         (*callback)(WTFMove(destinationSurface));
</span><span class="cx">         delete callback;
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (202141 => 202142)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -1,3 +1,25 @@
</span><ins>+2016-06-16  Anders Carlsson  &lt;andersca@apple.com&gt;
+
+        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):
+
</ins><span class="cx"> 2016-06-16  Brady Eidson  &lt;beidson@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         When a WebsiteDataStore finds no ProcessPools and creates one from scratch, it should represent the data store's config.
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (202141 => 202142)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -150,7 +150,7 @@
</span><span class="cx">         MachSendRight sendRight;
</span><span class="cx">         if (!decoder.decode(sendRight))
</span><span class="cx">             return false;
</span><del>-        result.m_frontBuffer.surface = IOSurface::createFromSendRight(sendRight, ColorSpaceSRGB);
</del><ins>+        result.m_frontBuffer.surface = WebCore::IOSurface::createFromSendRight(sendRight, ColorSpaceSRGB);
</ins><span class="cx">         return true;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -185,12 +185,11 @@
</span><span class="cx"> unsigned RemoteLayerBackingStore::bytesPerPixel() const
</span><span class="cx"> {
</span><span class="cx"> #if USE(IOSURFACE)
</span><del>-    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;
</del><ins>+    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;
</ins><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="cx">     return 4;
</span><span class="lines">@@ -211,7 +210,7 @@
</span><span class="cx">         std::swap(m_frontBuffer, m_backBuffer);
</span><span class="cx"> 
</span><span class="cx">         if (!m_frontBuffer.surface)
</span><del>-            m_frontBuffer.surface = IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque));
</del><ins>+            m_frontBuffer.surface = WebCore::IOSurface::create(expandedScaledSize, ColorSpaceSRGB, bufferFormat(m_isOpaque));
</ins><span class="cx"> 
</span><span class="cx">         setBufferVolatility(BufferType::Front, false);
</span><span class="cx">         return;
</span><span class="lines">@@ -401,7 +400,7 @@
</span><span class="cx"> 
</span><span class="cx"> #if USE(IOSURFACE)
</span><span class="cx">     if (acceleratesDrawing()) {
</span><del>-        layer.contents = (id)m_frontBuffer.surface-&gt;surface();
</del><ins>+//        layer.contents = (id)m_frontBuffer.surface-&gt;surface();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> #endif
</span><span class="lines">@@ -424,11 +423,11 @@
</span><span class="cx">             if (isVolatile)
</span><span class="cx">                 m_frontBuffer.surface-&gt;releaseGraphicsContext();
</span><span class="cx">             if (!isVolatile || !m_frontBuffer.surface-&gt;isInUse()) {
</span><del>-                IOSurface::SurfaceState previousState = m_frontBuffer.surface-&gt;setIsVolatile(isVolatile);
</del><ins>+                auto previousState = m_frontBuffer.surface-&gt;setIsVolatile(isVolatile);
</ins><span class="cx">                 m_frontBuffer.isVolatile = isVolatile;
</span><span class="cx"> 
</span><span class="cx">                 // Becoming non-volatile and the front buffer was purged, so we need to repaint.
</span><del>-                if (!isVolatile &amp;&amp; (previousState == IOSurface::SurfaceState::Empty))
</del><ins>+                if (!isVolatile &amp;&amp; (previousState == WebCore::IOSurface::SurfaceState::Empty))
</ins><span class="cx">                     setNeedsDisplay();
</span><span class="cx">             } else
</span><span class="cx">                 return false;
</span><span class="lines">@@ -470,7 +469,7 @@
</span><span class="cx"> {
</span><span class="cx"> #if USE(IOSURFACE)
</span><span class="cx">     if (surface)
</span><del>-        IOSurface::moveToPool(WTFMove(surface));
</del><ins>+        WebCore::IOSurface::moveToPool(WTFMove(surface));
</ins><span class="cx">     isVolatile = false;
</span><span class="cx"> #endif
</span><span class="cx">     bitmap = nullptr;
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacViewSnapshotStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/ViewSnapshotStore.mm (202141 => 202142)</h4>
<pre class="diff"><span>
<span class="info">--- 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)
</span><span class="lines">@@ -132,7 +132,7 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if USE(IOSURFACE)
</span><del>-Ref&lt;ViewSnapshot&gt; ViewSnapshot::create(std::unique_ptr&lt;IOSurface&gt; surface)
</del><ins>+Ref&lt;ViewSnapshot&gt; ViewSnapshot::create(std::unique_ptr&lt;WebCore::IOSurface&gt; surface)
</ins><span class="cx"> {
</span><span class="cx">     return adoptRef(*new ViewSnapshot(WTFMove(surface)));
</span><span class="cx"> }
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> #if USE(IOSURFACE)
</span><del>-ViewSnapshot::ViewSnapshot(std::unique_ptr&lt;IOSurface&gt; surface)
</del><ins>+ViewSnapshot::ViewSnapshot(std::unique_ptr&lt;WebCore::IOSurface&gt; surface)
</ins><span class="cx">     : m_surface(WTFMove(surface))
</span><span class="cx"> #else
</span><span class="cx"> ViewSnapshot::ViewSnapshot(uint32_t slotID, IntSize size, size_t imageSizeInBytes)
</span><span class="lines">@@ -207,12 +207,12 @@
</span><span class="cx">     if (!m_surface)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><del>-    if (m_surface-&gt;setIsVolatile(false) != IOSurface::SurfaceState::Valid) {
</del><ins>+    if (m_surface-&gt;setIsVolatile(false) != WebCore::IOSurface::SurfaceState::Valid) {
</ins><span class="cx">         clearImage();
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    return (id)m_surface-&gt;surface();
</del><ins>+    return m_surface-&gt;asLayerContents();
</ins><span class="cx"> #else
</span><span class="cx">     return [CAContext objectForSlot:m_slotID];
</span><span class="cx"> #endif
</span></span></pre>
</div>
</div>

</body>
</html>