<!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>[184011] trunk/Source/WebKit2</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/184011">184011</a></dd>
<dt>Author</dt> <dd>timothy_horton@apple.com</dd>
<dt>Date</dt> <dd>2015-05-08 13:40:32 -0700 (Fri, 08 May 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Flip the direction of the fence in scaleViewAndUpdateGeometryFenced
https://bugs.webkit.org/show_bug.cgi?id=144810

Reviewed by Simon Fraser.

Send the fence from the Web process to the UI process, instead of vice versa.
This means that we won't keep the UI process CAContext blocked for the whole
time that the Web process is doing layout/painting/etc. Instead, we'll start
blocking the Web process CAContext immediately after flushing and before committing,
and send the fence to the UI process to be applied immediately. This minimizes
the amount of time in both processes spent blocked on the fence.

* Platform/mac/LayerHostingContext.h:
* Platform/mac/LayerHostingContext.mm:
(WebKit::LayerHostingContext::createFencePort):
Add createFencePort, which creates a MachSendRight wrapping a CA fence port.
Note that you must setFencePort() with this port if you want the LayerHostingContext's
CAContext to block on it!

* UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::scaleViewAndUpdateGeometryFenced):
(WebKit::WebPageProxy::machSendRightCallback):
* UIProcess/WebPageProxy.h:
* UIProcess/WebPageProxy.messages.in:
Create a callback and send it to the Web process along with scaleViewAndUpdateGeometryFenced.

* UIProcess/mac/WKViewLayoutStrategy.mm:
(-[WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy updateLayout]):
When called back, install the fence port in our CAContext; when the commit goes through,
remove the transient scale as we did previously.

* WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::replyWithFenceAfterNextFlush):
(WebKit::DrawingArea::updateGeometry): Deleted.
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::scaleViewAndUpdateGeometryFenced):
* WebProcess/WebPage/WebPage.h:
* WebProcess/WebPage/WebPage.messages.in:
Instead of installing a fence created in the UI process, tell the DrawingArea
to create one and reply to the UI process with it after the next flush.

* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::flushLayers):
(WebKit::TiledCoreAnimationDrawingArea::replyWithFenceAfterNextFlush):
After flushing, before committing, create a fence and reply to any
callbacks that requested fences, and install it in our context.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformmacLayerHostingContexth">trunk/Source/WebKit2/Platform/mac/LayerHostingContext.h</a></li>
<li><a href="#trunkSourceWebKit2PlatformmacLayerHostingContextmm">trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxycpp">trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxyh">trunk/Source/WebKit2/UIProcess/WebPageProxy.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessWebPageProxymessagesin">trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in</a></li>
<li><a href="#trunkSourceWebKit2UIProcessmacWKViewLayoutStrategymm">trunk/Source/WebKit2/UIProcess/mac/WKViewLayoutStrategy.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagecpp">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPageh">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageWebPagemessagesin">trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm">trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/ChangeLog        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2015-05-08  Timothy Horton  &lt;timothy_horton@apple.com&gt;
+
+        Flip the direction of the fence in scaleViewAndUpdateGeometryFenced
+        https://bugs.webkit.org/show_bug.cgi?id=144810
+
+        Reviewed by Simon Fraser.
+
+        Send the fence from the Web process to the UI process, instead of vice versa.
+        This means that we won't keep the UI process CAContext blocked for the whole
+        time that the Web process is doing layout/painting/etc. Instead, we'll start
+        blocking the Web process CAContext immediately after flushing and before committing,
+        and send the fence to the UI process to be applied immediately. This minimizes
+        the amount of time in both processes spent blocked on the fence.
+
+        * Platform/mac/LayerHostingContext.h:
+        * Platform/mac/LayerHostingContext.mm:
+        (WebKit::LayerHostingContext::createFencePort):
+        Add createFencePort, which creates a MachSendRight wrapping a CA fence port.
+        Note that you must setFencePort() with this port if you want the LayerHostingContext's
+        CAContext to block on it!
+
+        * UIProcess/WebPageProxy.cpp:
+        (WebKit::WebPageProxy::scaleViewAndUpdateGeometryFenced):
+        (WebKit::WebPageProxy::machSendRightCallback):
+        * UIProcess/WebPageProxy.h:
+        * UIProcess/WebPageProxy.messages.in:
+        Create a callback and send it to the Web process along with scaleViewAndUpdateGeometryFenced.
+
+        * UIProcess/mac/WKViewLayoutStrategy.mm:
+        (-[WKViewDynamicSizeWithMinimumViewSizeLayoutStrategy updateLayout]):
+        When called back, install the fence port in our CAContext; when the commit goes through,
+        remove the transient scale as we did previously.
+
+        * WebProcess/WebPage/DrawingArea.h:
+        (WebKit::DrawingArea::replyWithFenceAfterNextFlush):
+        (WebKit::DrawingArea::updateGeometry): Deleted.
+        * WebProcess/WebPage/WebPage.cpp:
+        (WebKit::WebPage::scaleViewAndUpdateGeometryFenced):
+        * WebProcess/WebPage/WebPage.h:
+        * WebProcess/WebPage/WebPage.messages.in:
+        Instead of installing a fence created in the UI process, tell the DrawingArea
+        to create one and reply to the UI process with it after the next flush.
+
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
+        * WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
+        (WebKit::TiledCoreAnimationDrawingArea::flushLayers):
+        (WebKit::TiledCoreAnimationDrawingArea::replyWithFenceAfterNextFlush):
+        After flushing, before committing, create a fence and reply to any
+        callbacks that requested fences, and install it in our context.
+
</ins><span class="cx"> 2015-05-08  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;, Martin Robinson &lt;mrobinson@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [GTK] Checks for DEVELOPMENT_BUILD are all wrong
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformmacLayerHostingContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/mac/LayerHostingContext.h (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/mac/LayerHostingContext.h        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/Platform/mac/LayerHostingContext.h        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -62,9 +62,14 @@
</span><span class="cx">     void setColorSpace(CGColorSpaceRef);
</span><span class="cx">     CGColorSpaceRef colorSpace() const;
</span><span class="cx"> 
</span><del>-    // This only works on iOS and OS 10.10+
</del><ins>+    // Fences only work on iOS and OS 10.10+.
</ins><span class="cx">     void setFencePort(mach_port_t);
</span><span class="cx"> 
</span><ins>+    // createFencePort does not install the fence port on the LayerHostingContext's
+    // CAContext; call setFencePort() with the newly created port if synchronization
+    // with this context is desired.
+    WebCore::MachSendRight createFencePort();
+
</ins><span class="cx"> private:
</span><span class="cx">     LayerHostingMode m_layerHostingMode;
</span><span class="cx">     RetainPtr&lt;CAContext&gt; m_context;
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformmacLayerHostingContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/Platform/mac/LayerHostingContext.mm        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -107,11 +107,21 @@
</span><span class="cx"> {
</span><span class="cx">     [m_context setFencePort:fencePort];
</span><span class="cx"> }
</span><ins>+
+MachSendRight LayerHostingContext::createFencePort()
+{
+    return MachSendRight::adopt([m_context createFencePort]);
+}
</ins><span class="cx"> #else
</span><span class="cx"> NO_RETURN_DUE_TO_ASSERT void LayerHostingContext::setFencePort(mach_port_t fencePort)
</span><span class="cx"> {
</span><span class="cx">     ASSERT_NOT_REACHED();
</span><span class="cx"> }
</span><ins>+
+NO_RETURN_DUE_TO_ASSERT const MachSendRight&amp; LayerHostingContext::createFencePort()
+{
+    ASSERT_NOT_REACHED();
+}
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxycpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.cpp        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -2248,15 +2248,18 @@
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-void WebPageProxy::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, const MachSendRight&amp; fencePort)
</del><ins>+void WebPageProxy::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, std::function&lt;void (const MachSendRight&amp;, CallbackBase::Error)&gt; callback)
</ins><span class="cx"> {
</span><del>-    if (!isValid())
</del><ins>+    if (!isValid()) {
+        callback(MachSendRight(), CallbackBase::Error::OwnerWasInvalidated);
</ins><span class="cx">         return;
</span><ins>+    }
</ins><span class="cx"> 
</span><span class="cx">     m_viewScaleFactor = scale;
</span><span class="cx">     if (m_drawingArea)
</span><span class="cx">         m_drawingArea-&gt;willSendUpdateGeometry();
</span><del>-    m_process-&gt;send(Messages::WebPage::ScaleViewAndUpdateGeometryFenced(scale, viewSize, fencePort), m_pageID);
</del><ins>+    uint64_t callbackID = m_callbacks.put(WTF::move(callback), m_process-&gt;throttler().backgroundActivityToken());
+    m_process-&gt;send(Messages::WebPage::ScaleViewAndUpdateGeometryFenced(scale, viewSize, callbackID), m_pageID);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="lines">@@ -4656,6 +4659,17 @@
</span><span class="cx">     callback-&gt;performCallbackWithReturnValue(range);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+void WebPageProxy::machSendRightCallback(const MachSendRight&amp; sendRight, uint64_t callbackID)
+{
+    auto callback = m_callbacks.take&lt;MachSendRightCallback&gt;(callbackID);
+    if (!callback)
+        return;
+
+    callback-&gt;performCallbackWithReturnValue(sendRight);
+}
+#endif
+
</ins><span class="cx"> static bool shouldLogDiagnosticMessage(bool shouldSample)
</span><span class="cx"> {
</span><span class="cx">     if (!shouldSample)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxyh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.h (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.h        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -242,6 +242,10 @@
</span><span class="cx"> typedef GenericCallback&lt;const WebCore::IntPoint&amp;, uint32_t&gt; TouchesCallback;
</span><span class="cx"> #endif
</span><span class="cx"> 
</span><ins>+#if PLATFORM(COCOA)
+typedef GenericCallback&lt;const WebCore::MachSendRight&amp;&gt; MachSendRightCallback;
+#endif
+
</ins><span class="cx"> struct WebPageConfiguration {
</span><span class="cx">     WebPageGroup* pageGroup = nullptr;
</span><span class="cx">     WebPreferences* preferences = nullptr;
</span><span class="lines">@@ -649,7 +653,7 @@
</span><span class="cx">     double viewScaleFactor() const { return m_viewScaleFactor; }
</span><span class="cx">     void scaleView(double scale);
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-    void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, const WebCore::MachSendRight&amp; fencePort);
</del><ins>+    void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, std::function&lt;void (const WebCore::MachSendRight&amp;, CallbackBase::Error)&gt;);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     float deviceScaleFactor() const;
</span><span class="lines">@@ -1313,6 +1317,9 @@
</span><span class="cx">     void validateCommandCallback(const String&amp;, bool, int, uint64_t);
</span><span class="cx">     void unsignedCallback(uint64_t, uint64_t);
</span><span class="cx">     void editingRangeCallback(const EditingRange&amp;, uint64_t);
</span><ins>+#if PLATFORM(COCOA)
+    void machSendRightCallback(const WebCore::MachSendRight&amp;, uint64_t);
+#endif
</ins><span class="cx">     void rectForCharacterRangeCallback(const WebCore::IntRect&amp;, const EditingRange&amp;, uint64_t);
</span><span class="cx"> #if PLATFORM(MAC)
</span><span class="cx">     void attributedStringForCharacterRangeCallback(const AttributedString&amp;, const EditingRange&amp;, uint64_t);
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessWebPageProxymessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/UIProcess/WebPageProxy.messages.in        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -194,6 +194,9 @@
</span><span class="cx"> #if PLATFORM(GTK)
</span><span class="cx">     PrintFinishedCallback(WebCore::ResourceError error, uint64_t callbackID)
</span><span class="cx"> #endif
</span><ins>+#if PLATFORM(COCOA)
+    MachSendRightCallback(WebCore::MachSendRight sendRight, uint64_t callbackID)
+#endif
</ins><span class="cx"> 
</span><span class="cx">     PageScaleFactorDidChange(double scaleFactor)
</span><span class="cx">     PluginScaleFactorDidChange(double zoomFactor)
</span></span></pre></div>
<a id="trunkSourceWebKit2UIProcessmacWKViewLayoutStrategymm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/UIProcess/mac/WKViewLayoutStrategy.mm (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/mac/WKViewLayoutStrategy.mm        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/UIProcess/mac/WKViewLayoutStrategy.mm        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -293,12 +293,13 @@
</span><span class="cx">         _wkView._rootLayer.transform = transform;
</span><span class="cx">     } else if (scale != _page-&gt;viewScaleFactor()) {
</span><span class="cx"> #if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED &gt;= 101000
</span><del>-        CAContext *context = [_wkView.layer context];
-        MachSendRight fencePort = MachSendRight::adopt([context createFencePort]);
-        _page-&gt;scaleViewAndUpdateGeometryFenced(scale, IntSize(_wkView.frame.size), fencePort);
-        [context setFencePort:fencePort.sendRight() commitHandler:^{
-            _wkView._rootLayer.transform = CATransform3DIdentity;
-        }];
</del><ins>+        RetainPtr&lt;CAContext&gt; context = [_wkView.layer context];
+        RetainPtr&lt;WKView&gt; retainedWKView = _wkView;
+        _page-&gt;scaleViewAndUpdateGeometryFenced(scale, IntSize(_wkView.frame.size), [retainedWKView, context] (const WebCore::MachSendRight&amp; fencePort, CallbackBase::Error) {
+            [context setFencePort:fencePort.sendRight() commitHandler:^{
+                [retainedWKView _rootLayer].transform = CATransform3DIdentity;
+            }];
+        });
</ins><span class="cx"> #else
</span><span class="cx">         _page-&gt;scaleView(scale);
</span><span class="cx">         _wkView._rootLayer.transform = CATransform3DIdentity;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -129,6 +129,8 @@
</span><span class="cx"> #if PLATFORM(COCOA)
</span><span class="cx">     // Used by TiledCoreAnimationDrawingArea.
</span><span class="cx">     virtual void updateGeometry(const WebCore::IntSize&amp; viewSize, const WebCore::IntSize&amp; layerPosition, bool flushSynchronously) { }
</span><ins>+
+    virtual void replyWithFenceAfterNextFlush(uint64_t callbackID) { ASSERT_NOT_REACHED(); }
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> protected:
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.cpp        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -1449,11 +1449,11 @@
</span><span class="cx"> 
</span><span class="cx"> 
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-void WebPage::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, const MachSendRight&amp; fencePort)
</del><ins>+void WebPage::scaleViewAndUpdateGeometryFenced(double scale, IntSize viewSize, uint64_t callbackID)
</ins><span class="cx"> {
</span><span class="cx">     scaleView(scale);
</span><span class="cx">     m_drawingArea-&gt;updateGeometry(viewSize, IntSize(), false);
</span><del>-    m_drawingArea-&gt;addFence(fencePort);
</del><ins>+    m_drawingArea-&gt;replyWithFenceAfterNextFlush(callbackID);
</ins><span class="cx"> }
</span><span class="cx"> #endif
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPageh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.h        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -362,7 +362,7 @@
</span><span class="cx">     double viewScaleFactor() const { return m_viewScaleFactor; }
</span><span class="cx">     void scaleView(double scale);
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-    void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, const WebCore::MachSendRight&amp; fencePort);
</del><ins>+    void scaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, uint64_t callbackID);
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     void setUseFixedLayout(bool);
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageWebPagemessagesin"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/WebPage.messages.in        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -203,7 +203,7 @@
</span><span class="cx">     ScalePageInViewCoordinates(double scale, WebCore::IntPoint centerInViewCoordinates)
</span><span class="cx">     ScaleView(double scale)
</span><span class="cx"> #if PLATFORM(COCOA)
</span><del>-    ScaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, WebCore::MachSendRight fencePort)
</del><ins>+    ScaleViewAndUpdateGeometryFenced(double scale, WebCore::IntSize viewSize, uint64_t callbackID)
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx">     SetUseFixedLayout(bool fixed)
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -86,6 +86,8 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
</span><span class="cx"> 
</span><ins>+    virtual void replyWithFenceAfterNextFlush(uint64_t callbackID) override;
+
</ins><span class="cx">     // WebCore::LayerFlushSchedulerClient
</span><span class="cx">     virtual bool flushLayers() override;
</span><span class="cx"> 
</span><span class="lines">@@ -146,6 +148,8 @@
</span><span class="cx">     bool m_wantsDidUpdateViewState;
</span><span class="cx"> 
</span><span class="cx">     WebCore::GraphicsLayer* m_viewOverlayRootLayer;
</span><ins>+
+    Vector&lt;uint64_t&gt; m_fenceCallbacksForAfterNextFlush;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacTiledCoreAnimationDrawingAreamm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm (184010 => 184011)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2015-05-08 20:29:45 UTC (rev 184010)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm        2015-05-08 20:40:32 UTC (rev 184011)
</span><span class="lines">@@ -329,6 +329,16 @@
</span><span class="cx">         if (m_transientZoomScale != 1)
</span><span class="cx">             applyTransientZoomToLayers(m_transientZoomScale, m_transientZoomOrigin);
</span><span class="cx"> 
</span><ins>+        if (!m_fenceCallbacksForAfterNextFlush.isEmpty()) {
+            MachSendRight fencePort = m_layerHostingContext-&gt;createFencePort();
+
+            for (auto callbackID : m_fenceCallbacksForAfterNextFlush)
+                m_webPage.send(Messages::WebPageProxy::MachSendRightCallback(fencePort, callbackID));
+            m_fenceCallbacksForAfterNextFlush.clear();
+
+            m_layerHostingContext-&gt;setFencePort(fencePort.sendRight());
+        }
+
</ins><span class="cx">         return returnValue;
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="lines">@@ -746,6 +756,11 @@
</span><span class="cx">     m_layerHostingContext-&gt;setFencePort(fencePort.sendRight());
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void TiledCoreAnimationDrawingArea::replyWithFenceAfterNextFlush(uint64_t callbackID)
+{
+    m_fenceCallbacksForAfterNextFlush.append(callbackID);
+}
+
</ins><span class="cx"> } // namespace WebKit
</span><span class="cx"> 
</span><span class="cx"> #endif // !PLATFORM(IOS)
</span></span></pre>
</div>
</div>

</body>
</html>