<!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>[183242] 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/183242">183242</a></dd>
<dt>Author</dt> <dd>simon.fraser@apple.com</dd>
<dt>Date</dt> <dd>2015-04-23 21:36:12 -0700 (Thu, 23 Apr 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Make it possible to detach GraphicsLayerCA backing store
https://bugs.webkit.org/show_bug.cgi?id=144140

Reviewed by Tim Horton.
Source/WebCore:

This changes makes it possible to denote a GraphicsLayerCA's backing store
as &quot;attached&quot; or not. When not attached, the backing store is made volatile
and can be purged. This will be used in a future patch.

* platform/graphics/ca/GraphicsLayerCA.h: Add updateBackingStoreAttachment().
* platform/graphics/ca/PlatformCALayer.h:
* platform/graphics/ca/mac/PlatformCALayerMac.h:
* platform/graphics/ca/mac/PlatformCALayerMac.mm: Stubs. In future, we could
remove backing store on Mac and iOS WK1 too.
(PlatformCALayerMac::setBackingStoreAttached):
(PlatformCALayerMac::backingStoreAttached):

Source/WebKit2:

This changes makes it possible to denote a GraphicsLayerCA's backing store
as &quot;attached&quot; or not. When not attached, the backing store is made volatile
and can be purged. This will be used in a future patch.

* Shared/mac/RemoteLayerBackingStore.mm:
(WebKit::RemoteLayerBackingStore::~RemoteLayerBackingStore): Whitespace.
(WebKit::RemoteLayerBackingStore::display): If backingStoreWillBeDisplayed()
returns true, this indicates that the backing store was brought out of the
&quot;unreachable&quot; list, so return true even if the backing store doesn't require
painting.
* Shared/mac/RemoteLayerBackingStoreCollection.h: C++11 initializer, and comments.
* Shared/mac/RemoteLayerBackingStoreCollection.mm:
(WebKit::RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection):
(WebKit::RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed): Return true
if the caller will need to submit the backing store in the current transaction.
(WebKit::RemoteLayerBackingStoreCollection::backingStoreBecameUnreachable): This
explicit dirtying is no longer necessary given the backingStoreWillBeDisplayed() change.
* Shared/mac/RemoteLayerTreePropertyApplier.mm:
(WebKit::applyPropertiesToLayer): Only set the layer's backing if we both have backing
store, and it's attached.
* Shared/mac/RemoteLayerTreeTransaction.h: New bit, and data member.
* Shared/mac/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
(WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
(WebKit::dumpChangedLayers):
* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(WebKit::PlatformCALayerRemote::recursiveBuildTransaction): Only call display()
on the backing store if it's attached.
(WebKit::PlatformCALayerRemote::setBackingStoreAttached):
(WebKit::PlatformCALayerRemote::backingStoreAttached):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
* WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::backingStoreWillBeDisplayed):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebCoreChangeLog">trunk/Source/WebCore/ChangeLog</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh">trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscaPlatformCALayerh">trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h</a></li>
<li><a href="#trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm">trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.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="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoreCollectionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerBackingStoreCollectionmm">trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreePropertyAppliermm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h</a></li>
<li><a href="#trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm">trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh">trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContexth">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContextmm">trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/ChangeLog (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/ChangeLog        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/ChangeLog        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -1,5 +1,24 @@
</span><span class="cx"> 2015-04-23  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Make it possible to detach GraphicsLayerCA backing store
+        https://bugs.webkit.org/show_bug.cgi?id=144140
+
+        Reviewed by Tim Horton.
+
+        This changes makes it possible to denote a GraphicsLayerCA's backing store
+        as &quot;attached&quot; or not. When not attached, the backing store is made volatile
+        and can be purged. This will be used in a future patch.
+
+        * platform/graphics/ca/GraphicsLayerCA.h: Add updateBackingStoreAttachment().
+        * platform/graphics/ca/PlatformCALayer.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.h:
+        * platform/graphics/ca/mac/PlatformCALayerMac.mm: Stubs. In future, we could
+        remove backing store on Mac and iOS WK1 too.
+        (PlatformCALayerMac::setBackingStoreAttached):
+        (PlatformCALayerMac::backingStoreAttached):
+
+2015-04-23  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
</ins><span class="cx">         Remove &quot;layer&quot; from GraphicsLayerCA member function names
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=144139
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaGraphicsLayerCAh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -363,6 +363,7 @@
</span><span class="cx">     void updateBackfaceVisibility();
</span><span class="cx">     void updateStructuralLayer();
</span><span class="cx">     void updateDrawsContent();
</span><ins>+    void updateBackingStoreAttachment();
</ins><span class="cx">     void updateBackgroundColor();
</span><span class="cx"> 
</span><span class="cx">     void updateContentsImage();
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscaPlatformCALayerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/PlatformCALayer.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -176,6 +176,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setContentsRect(const FloatRect&amp;) = 0;
</span><span class="cx"> 
</span><ins>+    virtual void setBackingStoreAttached(bool) = 0;
+    virtual bool backingStoreAttached() const = 0;
+
</ins><span class="cx">     virtual void setMinificationFilter(FilterType) = 0;
</span><span class="cx">     virtual void setMagnificationFilter(FilterType) = 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMach"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -89,6 +89,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setHidden(bool) override;
</span><span class="cx"> 
</span><ins>+    virtual void setBackingStoreAttached(bool) override;
+    virtual bool backingStoreAttached() const override;
+
</ins><span class="cx">     WEBCORE_EXPORT virtual void setGeometryFlipped(bool) override;
</span><span class="cx"> 
</span><span class="cx">     virtual bool isDoubleSided() const override;
</span></span></pre></div>
<a id="trunkSourceWebCoreplatformgraphicscamacPlatformCALayerMacmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebCore/platform/graphics/ca/mac/PlatformCALayerMac.mm        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -594,6 +594,16 @@
</span><span class="cx">     END_BLOCK_OBJC_EXCEPTIONS
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformCALayerMac::setBackingStoreAttached(bool)
+{
+    // We could throw away backing store here with setContents:nil.
+}
+
+bool PlatformCALayerMac::backingStoreAttached() const
+{
+    return true;
+}
+
</ins><span class="cx"> void PlatformCALayerMac::setGeometryFlipped(bool value)
</span><span class="cx"> {
</span><span class="cx">     BEGIN_BLOCK_OBJC_EXCEPTIONS
</span></span></pre></div>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/ChangeLog        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2015-04-23  Simon Fraser  &lt;simon.fraser@apple.com&gt;
+
+        Make it possible to detach GraphicsLayerCA backing store
+        https://bugs.webkit.org/show_bug.cgi?id=144140
+
+        Reviewed by Tim Horton.
+        
+        This changes makes it possible to denote a GraphicsLayerCA's backing store
+        as &quot;attached&quot; or not. When not attached, the backing store is made volatile
+        and can be purged. This will be used in a future patch.
+
+        * Shared/mac/RemoteLayerBackingStore.mm:
+        (WebKit::RemoteLayerBackingStore::~RemoteLayerBackingStore): Whitespace.
+        (WebKit::RemoteLayerBackingStore::display): If backingStoreWillBeDisplayed()
+        returns true, this indicates that the backing store was brought out of the
+        &quot;unreachable&quot; list, so return true even if the backing store doesn't require
+        painting.
+        * Shared/mac/RemoteLayerBackingStoreCollection.h: C++11 initializer, and comments.
+        * Shared/mac/RemoteLayerBackingStoreCollection.mm:
+        (WebKit::RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection):
+        (WebKit::RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed): Return true
+        if the caller will need to submit the backing store in the current transaction.
+        (WebKit::RemoteLayerBackingStoreCollection::backingStoreBecameUnreachable): This
+        explicit dirtying is no longer necessary given the backingStoreWillBeDisplayed() change.
+        * Shared/mac/RemoteLayerTreePropertyApplier.mm:
+        (WebKit::applyPropertiesToLayer): Only set the layer's backing if we both have backing
+        store, and it's attached.
+        * Shared/mac/RemoteLayerTreeTransaction.h: New bit, and data member.
+        * Shared/mac/RemoteLayerTreeTransaction.mm:
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::LayerProperties):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::encode):
+        (WebKit::RemoteLayerTreeTransaction::LayerProperties::decode):
+        (WebKit::dumpChangedLayers):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (WebKit::PlatformCALayerRemote::recursiveBuildTransaction): Only call display()
+        on the backing store if it's attached.
+        (WebKit::PlatformCALayerRemote::setBackingStoreAttached):
+        (WebKit::PlatformCALayerRemote::backingStoreAttached):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.h:
+        * WebProcess/WebPage/mac/RemoteLayerTreeContext.mm:
+        (WebKit::RemoteLayerTreeContext::backingStoreWillBeDisplayed):
+
</ins><span class="cx"> 2015-04-23  Tim Horton  &lt;timothy_horton@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Quick Look preview popover is not dismissed on scroll in Mail
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoremm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStore.mm        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -66,6 +66,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!m_layer)
</span><span class="cx">         return;
</span><ins>+
</ins><span class="cx">     if (RemoteLayerTreeContext* context = m_layer-&gt;context())
</span><span class="cx">         context-&gt;backingStoreWillBeDestroyed(*this);
</span><span class="cx"> }
</span><span class="lines">@@ -206,8 +207,9 @@
</span><span class="cx"> 
</span><span class="cx">     m_lastDisplayTime = std::chrono::steady_clock::now();
</span><span class="cx"> 
</span><ins>+    bool needToEncodeBackingStore = false;
</ins><span class="cx">     if (RemoteLayerTreeContext* context = m_layer-&gt;context())
</span><del>-        context-&gt;backingStoreWillBeDisplayed(*this);
</del><ins>+        needToEncodeBackingStore = context-&gt;backingStoreWillBeDisplayed(*this);
</ins><span class="cx"> 
</span><span class="cx">     // Make the previous front buffer non-volatile early, so that we can dirty the whole layer if it comes back empty.
</span><span class="cx">     setBufferVolatility(BufferType::Front, false);
</span><span class="lines">@@ -215,7 +217,7 @@
</span><span class="cx">     IntSize expandedScaledSize = backingStoreSize();
</span><span class="cx"> 
</span><span class="cx">     if (m_dirtyRegion.isEmpty() || expandedScaledSize.isEmpty())
</span><del>-        return false;
</del><ins>+        return needToEncodeBackingStore;
</ins><span class="cx"> 
</span><span class="cx">     IntRect layerBounds(IntPoint(), expandedIntSize(m_size));
</span><span class="cx">     if (!hasFrontBuffer())
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoreCollectionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -45,7 +45,8 @@
</span><span class="cx">     void backingStoreWasCreated(RemoteLayerBackingStore&amp;);
</span><span class="cx">     void backingStoreWillBeDestroyed(RemoteLayerBackingStore&amp;);
</span><span class="cx"> 
</span><del>-    void backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp;);
</del><ins>+    // Return value indicates whether the backing store needs to be included in the transaction.
+    bool backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp;);
</ins><span class="cx">     void backingStoreBecameUnreachable(RemoteLayerBackingStore&amp;);
</span><span class="cx"> 
</span><span class="cx">     void willFlushLayers();
</span><span class="lines">@@ -67,11 +68,13 @@
</span><span class="cx"> 
</span><span class="cx">     HashSet&lt;RemoteLayerBackingStore*&gt; m_liveBackingStore;
</span><span class="cx">     HashSet&lt;RemoteLayerBackingStore*&gt; m_unparentedBackingStore;
</span><ins>+
+    // Only used during a single flush.
</ins><span class="cx">     HashSet&lt;RemoteLayerBackingStore*&gt; m_reachableBackingStoreInLatestFlush;
</span><span class="cx"> 
</span><span class="cx">     WebCore::Timer m_volatilityTimer;
</span><span class="cx"> 
</span><del>-    bool m_inLayerFlush;
</del><ins>+    bool m_inLayerFlush { false };
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerBackingStoreCollectionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerBackingStoreCollection.mm        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -38,7 +38,6 @@
</span><span class="cx"> 
</span><span class="cx"> RemoteLayerBackingStoreCollection::RemoteLayerBackingStoreCollection()
</span><span class="cx">     : m_volatilityTimer(*this, &amp;RemoteLayerBackingStoreCollection::volatilityTimerFired)
</span><del>-    , m_inLayerFlush(false)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -88,16 +87,18 @@
</span><span class="cx">     m_unparentedBackingStore.remove(&amp;backingStore);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp; backingStore)
</del><ins>+bool RemoteLayerBackingStoreCollection::backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp; backingStore)
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_inLayerFlush);
</span><span class="cx">     m_reachableBackingStoreInLatestFlush.add(&amp;backingStore);
</span><span class="cx"> 
</span><span class="cx">     auto backingStoreIter = m_unparentedBackingStore.find(&amp;backingStore);
</span><span class="cx">     if (backingStoreIter == m_unparentedBackingStore.end())
</span><del>-        return;
</del><ins>+        return false;
+
</ins><span class="cx">     m_liveBackingStore.add(&amp;backingStore);
</span><span class="cx">     m_unparentedBackingStore.remove(backingStoreIter);
</span><ins>+    return true;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> bool RemoteLayerBackingStoreCollection::markBackingStoreVolatileImmediately(RemoteLayerBackingStore&amp; backingStore, VolatilityMarkingFlags volatilityMarkingFlags)
</span><span class="lines">@@ -141,10 +142,6 @@
</span><span class="cx">     m_unparentedBackingStore.add(&amp;backingStore);
</span><span class="cx">     m_liveBackingStore.remove(backingStoreIter);
</span><span class="cx"> 
</span><del>-    // If a layer with backing store is removed from the tree, mark it as having changed backing store, so that
-    // on the commit which returns it to the tree, we serialize the backing store (despite possibly not painting).
-    backingStore.layer()-&gt;properties().notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
-
</del><span class="cx">     // This will not succeed in marking all buffers as volatile, because the commit unparenting the layer hasn't
</span><span class="cx">     // made it to the UI process yet. The volatility timer will finish marking the remaining buffers later.
</span><span class="cx">     markBackingStoreVolatileImmediately(backingStore);
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreePropertyAppliermm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreePropertyApplier.mm        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -233,8 +233,11 @@
</span><span class="cx">     if (properties.changedProperties &amp; RemoteLayerTreeTransaction::TimeOffsetChanged)
</span><span class="cx">         layer.timeOffset = properties.timeOffset;
</span><span class="cx"> 
</span><del>-    if (properties.changedProperties &amp; RemoteLayerTreeTransaction::BackingStoreChanged) {
-        if (RemoteLayerBackingStore* backingStore = properties.backingStore.get())
</del><ins>+    if (properties.changedProperties &amp; RemoteLayerTreeTransaction::BackingStoreChanged
+        || properties.changedProperties &amp; RemoteLayerTreeTransaction::BackingStoreAttachmentChanged)
+    {
+        RemoteLayerBackingStore* backingStore = properties.backingStore.get();
+        if (backingStore &amp;&amp; properties.backingStoreAttached)
</ins><span class="cx">             backingStore-&gt;applyBackingStoreToLayer(layer);
</span><span class="cx">         else {
</span><span class="cx">             layer.contents = nil;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -81,10 +81,11 @@
</span><span class="cx">         SpeedChanged                    = 1LLU &lt;&lt; 28,
</span><span class="cx">         TimeOffsetChanged               = 1LLU &lt;&lt; 29,
</span><span class="cx">         BackingStoreChanged             = 1LLU &lt;&lt; 30,
</span><del>-        FiltersChanged                  = 1LLU &lt;&lt; 31,
-        AnimationsChanged               = 1LLU &lt;&lt; 32,
-        EdgeAntialiasingMaskChanged     = 1LLU &lt;&lt; 33,
-        CustomAppearanceChanged         = 1LLU &lt;&lt; 34
</del><ins>+        BackingStoreAttachmentChanged   = 1LLU &lt;&lt; 31,
+        FiltersChanged                  = 1LLU &lt;&lt; 32,
+        AnimationsChanged               = 1LLU &lt;&lt; 33,
+        EdgeAntialiasingMaskChanged     = 1LLU &lt;&lt; 34,
+        CustomAppearanceChanged         = 1LLU &lt;&lt; 35,
</ins><span class="cx">     };
</span><span class="cx">     typedef uint64_t LayerChange;
</span><span class="cx"> 
</span><span class="lines">@@ -156,6 +157,7 @@
</span><span class="cx">         WebCore::BlendMode blendMode;
</span><span class="cx">         WebCore::WindRule windRule;
</span><span class="cx">         bool hidden;
</span><ins>+        bool backingStoreAttached;
</ins><span class="cx">         bool geometryFlipped;
</span><span class="cx">         bool doubleSided;
</span><span class="cx">         bool masksToBounds;
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedmacRemoteLayerTreeTransactionmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/Shared/mac/RemoteLayerTreeTransaction.mm        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -98,6 +98,7 @@
</span><span class="cx">     , blendMode(BlendModeNormal)
</span><span class="cx">     , windRule(RULE_NONZERO)
</span><span class="cx">     , hidden(false)
</span><ins>+    , backingStoreAttached(true)
</ins><span class="cx">     , geometryFlipped(false)
</span><span class="cx">     , doubleSided(true)
</span><span class="cx">     , masksToBounds(false)
</span><span class="lines">@@ -134,6 +135,7 @@
</span><span class="cx">     , blendMode(other.blendMode)
</span><span class="cx">     , windRule(other.windRule)
</span><span class="cx">     , hidden(other.hidden)
</span><ins>+    , backingStoreAttached(other.backingStoreAttached)
</ins><span class="cx">     , geometryFlipped(other.geometryFlipped)
</span><span class="cx">     , doubleSided(other.doubleSided)
</span><span class="cx">     , masksToBounds(other.masksToBounds)
</span><span class="lines">@@ -255,6 +257,9 @@
</span><span class="cx">             encoder &lt;&lt; *backingStore;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (changedProperties &amp; BackingStoreAttachmentChanged)
+        encoder &lt;&lt; backingStoreAttached;
+
</ins><span class="cx">     if (changedProperties &amp; FiltersChanged)
</span><span class="cx">         encoder &lt;&lt; *filters;
</span><span class="cx"> 
</span><span class="lines">@@ -454,6 +459,11 @@
</span><span class="cx">             result.backingStore = nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (result.changedProperties &amp; BackingStoreAttachmentChanged) {
+        if (!decoder.decode(result.backingStoreAttached))
+            return false;
+    }
+
</ins><span class="cx">     if (result.changedProperties &amp; FiltersChanged) {
</span><span class="cx">         std::unique_ptr&lt;FilterOperations&gt; filters = std::make_unique&lt;FilterOperations&gt;();
</span><span class="cx">         if (!decoder.decode(*filters))
</span><span class="lines">@@ -1181,6 +1191,9 @@
</span><span class="cx">                 dumpProperty(ts, &quot;backingStore&quot;, &quot;removed&quot;);
</span><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        if (layerProperties.changedProperties &amp; RemoteLayerTreeTransaction::BackingStoreAttachmentChanged)
+            dumpProperty(ts, &quot;backingStoreAttached&quot;, layerProperties.backingStoreAttached);
+
</ins><span class="cx">         if (layerProperties.changedProperties &amp; RemoteLayerTreeTransaction::FiltersChanged)
</span><span class="cx">             dumpProperty(ts, &quot;filters&quot;, layerProperties.filters ? *layerProperties.filters : FilterOperations());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemotecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -153,7 +153,7 @@
</span><span class="cx">         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (m_properties.backingStore &amp;&amp; m_properties.backingStore-&gt;display())
</del><ins>+    if (m_properties.backingStore &amp;&amp; m_properties.backingStoreAttached &amp;&amp; m_properties.backingStore-&gt;display())
</ins><span class="cx">         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreChanged);
</span><span class="cx"> 
</span><span class="cx">     if (m_properties.changedProperties != RemoteLayerTreeTransaction::NoChange) {
</span><span class="lines">@@ -502,6 +502,20 @@
</span><span class="cx">     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::HiddenChanged);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void PlatformCALayerRemote::setBackingStoreAttached(bool value)
+{
+    if (m_properties.backingStoreAttached == value)
+        return;
+
+    m_properties.backingStoreAttached = value;
+    m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BackingStoreAttachmentChanged);
+}
+
+bool PlatformCALayerRemote::backingStoreAttached() const
+{
+    return m_properties.backingStoreAttached;
+}
+
</ins><span class="cx"> void PlatformCALayerRemote::setGeometryFlipped(bool value)
</span><span class="cx"> {
</span><span class="cx">     m_properties.geometryFlipped = value;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacPlatformCALayerRemoteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -94,6 +94,9 @@
</span><span class="cx"> 
</span><span class="cx">     virtual void setHidden(bool) override;
</span><span class="cx"> 
</span><ins>+    virtual void setBackingStoreAttached(bool) override;
+    virtual bool backingStoreAttached() const override;
+
</ins><span class="cx">     virtual void setGeometryFlipped(bool) override;
</span><span class="cx"> 
</span><span class="cx">     virtual bool isDoubleSided() const override;
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContexth"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.h        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx"> 
</span><span class="cx">     void backingStoreWasCreated(RemoteLayerBackingStore&amp;);
</span><span class="cx">     void backingStoreWillBeDestroyed(RemoteLayerBackingStore&amp;);
</span><del>-    void backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp;);
</del><ins>+    bool backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp;);
</ins><span class="cx"> 
</span><span class="cx">     WebCore::LayerPool&amp; layerPool() { return m_layerPool; }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPagemacRemoteLayerTreeContextmm"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm (183241 => 183242)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm        2015-04-24 04:05:58 UTC (rev 183241)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/RemoteLayerTreeContext.mm        2015-04-24 04:36:12 UTC (rev 183242)
</span><span class="lines">@@ -94,9 +94,9 @@
</span><span class="cx">     m_backingStoreCollection.backingStoreWillBeDestroyed(backingStore);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp; backingStore)
</del><ins>+bool RemoteLayerTreeContext::backingStoreWillBeDisplayed(RemoteLayerBackingStore&amp; backingStore)
</ins><span class="cx"> {
</span><del>-    m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore);
</del><ins>+    return m_backingStoreCollection.backingStoreWillBeDisplayed(backingStore);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> std::unique_ptr&lt;GraphicsLayer&gt; RemoteLayerTreeContext::createGraphicsLayer(WebCore::GraphicsLayer::Type layerType, GraphicsLayerClient&amp; client)
</span></span></pre>
</div>
</div>

</body>
</html>