<!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>[176946] 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/176946">176946</a></dd>
<dt>Author</dt> <dd>yoon@igalia.com</dd>
<dt>Date</dt> <dd>2014-12-08 04:09:30 -0800 (Mon, 08 Dec 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[CoordinatedGraphics] Move CoordinatedBackingStore and CoordinatedGraphicsScene to Shared
https://bugs.webkit.org/show_bug.cgi?id=139385

Reviewed by Martin Robinson.

For the Threaded Compositor, CoordinatedBackingStore and
CoordinatedGraphicsScene should be placed at the Shared instead of
UIProcess because it can be used in the WebProcess also.

No new tests because there is no behavior change.

* PlatformEfl.cmake:
* Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp.
* Shared/CoordinatedGraphics/CoordinatedBackingStore.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h.
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp.
* Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2ChangeLog">trunk/Source/WebKit2/ChangeLog</a></li>
<li><a href="#trunkSourceWebKit2PlatformEflcmake">trunk/Source/WebKit2/PlatformEfl.cmake</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedBackingStorecpp">trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedBackingStoreh">trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.h</a></li>
<li><a href="#trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedGraphicsScenecpp">trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp</a></li>
<li><a href="#trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedGraphicsSceneh">trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedBackingStorecpp">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedBackingStoreh">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedGraphicsScenecpp">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp</a></li>
<li><a href="#trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedGraphicsSceneh">trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (176945 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2014-12-08 11:34:48 UTC (rev 176945)
+++ trunk/Source/WebKit2/ChangeLog        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -1,3 +1,22 @@
</span><ins>+2014-12-08  Gwang Yoon Hwang  &lt;yoon@igalia.com&gt;
+
+        [CoordinatedGraphics] Move CoordinatedBackingStore and CoordinatedGraphicsScene to Shared
+        https://bugs.webkit.org/show_bug.cgi?id=139385
+
+        Reviewed by Martin Robinson.
+
+        For the Threaded Compositor, CoordinatedBackingStore and
+        CoordinatedGraphicsScene should be placed at the Shared instead of
+        UIProcess because it can be used in the WebProcess also.
+
+        No new tests because there is no behavior change.
+
+        * PlatformEfl.cmake:
+        * Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp.
+        * Shared/CoordinatedGraphics/CoordinatedBackingStore.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h.
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp.
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h: Renamed from Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h.
+
</ins><span class="cx"> 2014-12-08  Shivakumar JM  &lt;shiva.jm@samsung.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Fix build warning in WebKit2/UIProcess module.
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformEfl.cmake (176945 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformEfl.cmake        2014-12-08 11:34:48 UTC (rev 176945)
+++ trunk/Source/WebKit2/PlatformEfl.cmake        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -23,7 +23,9 @@
</span><span class="cx"> 
</span><span class="cx">     Shared/API/c/efl/WKArrayEfl.cpp
</span><span class="cx"> 
</span><ins>+    Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp
</ins><span class="cx">     Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp
</span><ins>+    Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
</ins><span class="cx">     Shared/CoordinatedGraphics/WebCoordinatedSurface.cpp
</span><span class="cx"> 
</span><span class="cx">     Shared/Downloads/efl/DownloadSoupErrorsEfl.cpp
</span><span class="lines">@@ -113,9 +115,7 @@
</span><span class="cx">     UIProcess/API/efl/ewk_view.cpp
</span><span class="cx">     UIProcess/API/efl/ewk_window_features.cpp
</span><span class="cx"> 
</span><del>-    UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp
</del><span class="cx">     UIProcess/CoordinatedGraphics/CoordinatedDrawingAreaProxy.cpp
</span><del>-    UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp
</del><span class="cx">     UIProcess/CoordinatedGraphics/CoordinatedLayerTreeHostProxy.cpp
</span><span class="cx">     UIProcess/CoordinatedGraphics/PageViewportController.cpp
</span><span class="cx">     UIProcess/CoordinatedGraphics/WebPageProxyCoordinatedGraphics.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedBackingStorecppfromrev176945trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedBackingStorecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp (from rev 176945, trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp) (0 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp                                (rev 0)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.cpp        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -0,0 +1,188 @@
</span><ins>+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;CoordinatedBackingStore.h&quot;
+
+#if USE(COORDINATED_GRAPHICS)
+#include &lt;WebCore/CoordinatedSurface.h&gt;
+#include &lt;WebCore/GraphicsLayer.h&gt;
+#include &lt;WebCore/TextureMapper.h&gt;
+#include &lt;WebCore/TextureMapperGL.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void CoordinatedBackingStoreTile::swapBuffers(TextureMapper* textureMapper)
+{
+    if (!m_surface)
+        return;
+
+    FloatRect tileRect(m_tileRect);
+    tileRect.scale(1. / m_scale);
+    bool shouldReset = false;
+    if (tileRect != rect()) {
+        setRect(tileRect);
+        shouldReset = true;
+    }
+    RefPtr&lt;BitmapTexture&gt; texture = this-&gt;texture();
+    if (!texture) {
+        texture = textureMapper-&gt;createTexture();
+        setTexture(texture.get());
+        shouldReset = true;
+    }
+
+    ASSERT(textureMapper-&gt;maxTextureSize().width() &gt;= m_tileRect.size().width());
+    ASSERT(textureMapper-&gt;maxTextureSize().height() &gt;= m_tileRect.size().height());
+    if (shouldReset)
+        texture-&gt;reset(m_tileRect.size(), m_surface-&gt;supportsAlpha());
+
+    m_surface-&gt;copyToTexture(texture, m_sourceRect, m_surfaceOffset);
+    m_surface.clear();
+}
+
+void CoordinatedBackingStoreTile::setBackBuffer(const IntRect&amp; tileRect, const IntRect&amp; sourceRect, PassRefPtr&lt;CoordinatedSurface&gt; buffer, const IntPoint&amp; offset)
+{
+    m_sourceRect = sourceRect;
+    m_tileRect = tileRect;
+    m_surfaceOffset = offset;
+    m_surface = buffer;
+}
+
+void CoordinatedBackingStore::createTile(uint32_t id, float scale)
+{
+    m_tiles.add(id, CoordinatedBackingStoreTile(scale));
+    m_scale = scale;
+}
+
+void CoordinatedBackingStore::removeTile(uint32_t id)
+{
+    ASSERT(m_tiles.contains(id));
+    m_tilesToRemove.add(id);
+}
+
+void CoordinatedBackingStore::removeAllTiles()
+{
+    for (auto&amp; key : m_tiles.keys())
+        m_tilesToRemove.add(key);
+}
+
+void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect&amp; sourceRect, const IntRect&amp; tileRect, PassRefPtr&lt;CoordinatedSurface&gt; backBuffer, const IntPoint&amp; offset)
+{
+    CoordinatedBackingStoreTileMap::iterator it = m_tiles.find(id);
+    ASSERT(it != m_tiles.end());
+    it-&gt;value.setBackBuffer(tileRect, sourceRect, backBuffer, offset);
+}
+
+PassRefPtr&lt;BitmapTexture&gt; CoordinatedBackingStore::texture() const
+{
+    for (auto&amp; tile : m_tiles.values()) {
+        RefPtr&lt;BitmapTexture&gt; texture = tile.texture();
+        if (texture)
+            return texture;
+    }
+
+    return PassRefPtr&lt;BitmapTexture&gt;();
+}
+
+void CoordinatedBackingStore::setSize(const FloatSize&amp; size)
+{
+    m_pendingSize = size;
+}
+
+void CoordinatedBackingStore::paintTilesToTextureMapper(Vector&lt;TextureMapperTile*&gt;&amp; tiles, TextureMapper* textureMapper, const TransformationMatrix&amp; transform, float opacity, const FloatRect&amp; rect)
+{
+    for (auto&amp; tile : tiles)
+        tile-&gt;paint(textureMapper, transform, opacity, calculateExposedTileEdges(rect, tile-&gt;rect()));
+}
+
+TransformationMatrix CoordinatedBackingStore::adjustedTransformForRect(const FloatRect&amp; targetRect)
+{
+    return TransformationMatrix::rectToRect(rect(), targetRect);
+}
+
+void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect&amp; targetRect, const TransformationMatrix&amp; transform, float opacity)
+{
+    if (m_tiles.isEmpty())
+        return;
+    ASSERT(!m_size.isZero());
+
+    Vector&lt;TextureMapperTile*&gt; tilesToPaint;
+    Vector&lt;TextureMapperTile*&gt; previousTilesToPaint;
+
+    // We have to do this every time we paint, in case the opacity has changed.
+    FloatRect coveredRect;
+    for (auto&amp; tile : m_tiles.values()) {
+        if (!tile.texture())
+            continue;
+
+        if (tile.scale() == m_scale) {
+            tilesToPaint.append(&amp;tile);
+            coveredRect.unite(tile.rect());
+            continue;
+        }
+
+        // Only show the previous tile if the opacity is high, otherwise effect looks like a bug.
+        // We show the previous-scale tile anyway if it doesn't intersect with any current-scale tile.
+        if (opacity &lt; 0.95 &amp;&amp; coveredRect.intersects(tile.rect()))
+            continue;
+
+        previousTilesToPaint.append(&amp;tile);
+    }
+
+    // targetRect is on the contents coordinate system, so we must compare two rects on the contents coordinate system.
+    // See TiledBackingStore.
+    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
+
+    paintTilesToTextureMapper(previousTilesToPaint, textureMapper, adjustedTransform, opacity, rect());
+    paintTilesToTextureMapper(tilesToPaint, textureMapper, adjustedTransform, opacity, rect());
+}
+
+void CoordinatedBackingStore::drawBorder(TextureMapper* textureMapper, const Color&amp; borderColor, float borderWidth, const FloatRect&amp; targetRect, const TransformationMatrix&amp; transform)
+{
+    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
+    for (auto&amp; tile : m_tiles.values())
+        textureMapper-&gt;drawBorder(borderColor, borderWidth, tile.rect(), adjustedTransform);
+}
+
+void CoordinatedBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color&amp; borderColor, const FloatRect&amp; targetRect, const TransformationMatrix&amp; transform)
+{
+    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
+    for (auto&amp; tile : m_tiles.values())
+        textureMapper-&gt;drawNumber(repaintCount, borderColor, tile.rect().location(), adjustedTransform);
+}
+
+void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper)
+{
+    if (!m_pendingSize.isZero()) {
+        m_size = m_pendingSize;
+        m_pendingSize = FloatSize();
+    }
+
+    for (auto&amp; tileToRemove : m_tilesToRemove)
+        m_tiles.remove(tileToRemove);
+    m_tilesToRemove.clear();
+
+    for (auto&amp; tile : m_tiles.values())
+        tile.swapBuffers(textureMapper);
+}
+
+} // namespace WebCore
+#endif // USE(COORDINATED_GRAPHICS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedBackingStorehfromrev176945trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedBackingStoreh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.h (from rev 176945, trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h) (0 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedBackingStore.h        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -0,0 +1,93 @@
</span><ins>+/*
+ Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public
+ License as published by the Free Software Foundation; either
+ version 2 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public License
+ along with this library; see the file COPYING.LIB.  If not, write to
+ the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
+ */
+
+#ifndef CoordinatedBackingStore_h
+#define CoordinatedBackingStore_h
+
+#if USE(COORDINATED_GRAPHICS)
+
+#include &lt;WebCore/TextureMapper.h&gt;
+#include &lt;WebCore/TextureMapperBackingStore.h&gt;
+#include &lt;WebCore/TextureMapperTile.h&gt;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/HashSet.h&gt;
+
+
+namespace WebCore {
+class CoordinatedSurface;
+}
+
+namespace WebKit {
+
+class CoordinatedBackingStoreTile : public WebCore::TextureMapperTile {
+public:
+    explicit CoordinatedBackingStoreTile(float scale = 1)
+        : WebCore::TextureMapperTile(WebCore::FloatRect())
+        , m_scale(scale)
+    {
+    }
+
+    inline float scale() const { return m_scale; }
+    void swapBuffers(WebCore::TextureMapper*);
+    void setBackBuffer(const WebCore::IntRect&amp;, const WebCore::IntRect&amp;, PassRefPtr&lt;WebCore::CoordinatedSurface&gt; buffer, const WebCore::IntPoint&amp;);
+
+private:
+    RefPtr&lt;WebCore::CoordinatedSurface&gt; m_surface;
+    WebCore::IntRect m_sourceRect;
+    WebCore::IntRect m_tileRect;
+    WebCore::IntPoint m_surfaceOffset;
+    float m_scale;
+};
+
+class CoordinatedBackingStore : public WebCore::TextureMapperBackingStore {
+public:
+    void createTile(uint32_t tileID, float);
+    void removeTile(uint32_t tileID);
+    void removeAllTiles();
+    void updateTile(uint32_t tileID, const WebCore::IntRect&amp;, const WebCore::IntRect&amp;, PassRefPtr&lt;WebCore::CoordinatedSurface&gt;, const WebCore::IntPoint&amp;);
+    static PassRefPtr&lt;CoordinatedBackingStore&gt; create() { return adoptRef(new CoordinatedBackingStore); }
+    void commitTileOperations(WebCore::TextureMapper*);
+    PassRefPtr&lt;WebCore::BitmapTexture&gt; texture() const;
+    void setSize(const WebCore::FloatSize&amp;);
+    virtual void paintToTextureMapper(WebCore::TextureMapper*, const WebCore::FloatRect&amp;, const WebCore::TransformationMatrix&amp;, float);
+    virtual void drawBorder(WebCore::TextureMapper*, const WebCore::Color&amp;, float borderWidth, const WebCore::FloatRect&amp;, const WebCore::TransformationMatrix&amp;) override;
+    virtual void drawRepaintCounter(WebCore::TextureMapper*, int repaintCount, const WebCore::Color&amp;, const WebCore::FloatRect&amp;, const WebCore::TransformationMatrix&amp;) override;
+
+private:
+    CoordinatedBackingStore()
+        : m_scale(1.)
+    { }
+    void paintTilesToTextureMapper(Vector&lt;WebCore::TextureMapperTile*&gt;&amp;, WebCore::TextureMapper*, const WebCore::TransformationMatrix&amp;, float, const WebCore::FloatRect&amp;);
+    WebCore::TransformationMatrix adjustedTransformForRect(const WebCore::FloatRect&amp;);
+    WebCore::FloatRect rect() const { return WebCore::FloatRect(WebCore::FloatPoint::zero(), m_size); }
+
+    typedef HashMap&lt;uint32_t, CoordinatedBackingStoreTile&gt; CoordinatedBackingStoreTileMap;
+    CoordinatedBackingStoreTileMap m_tiles;
+    HashSet&lt;uint32_t&gt; m_tilesToRemove;
+    // FIXME: m_pendingSize should be removed after the following bug is fixed: https://bugs.webkit.org/show_bug.cgi?id=108294
+    WebCore::FloatSize m_pendingSize;
+    WebCore::FloatSize m_size;
+    float m_scale;
+};
+
+} // namespace WebKit
+
+#endif // USE(COORDINATED_GRAPHICS)
+
+#endif // CoordinatedBackingStore_h
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedGraphicsScenecppfromrev176945trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedGraphicsScenecpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (from rev 176945, trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp) (0 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp                                (rev 0)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -0,0 +1,716 @@
</span><ins>+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2012 Company 100, Inc.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#include &quot;config.h&quot;
+
+#if USE(COORDINATED_GRAPHICS)
+#include &quot;CoordinatedGraphicsScene.h&quot;
+
+#include &quot;CoordinatedBackingStore.h&quot;
+#include &lt;WebCore/TextureMapper.h&gt;
+#include &lt;WebCore/TextureMapperBackingStore.h&gt;
+#include &lt;WebCore/TextureMapperGL.h&gt;
+#include &lt;WebCore/TextureMapperLayer.h&gt;
+#include &lt;wtf/Atomics.h&gt;
+#include &lt;wtf/MainThread.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+void CoordinatedGraphicsScene::dispatchOnMainThread(std::function&lt;void()&gt; function)
+{
+    if (isMainThread())
+        function();
+    else
+        callOnMainThread(WTF::move(function));
+}
+
+static bool layerShouldHaveBackingStore(TextureMapperLayer* layer)
+{
+    return layer-&gt;drawsContent() &amp;&amp; layer-&gt;contentsAreVisible() &amp;&amp; !layer-&gt;size().isEmpty();
+}
+
+CoordinatedGraphicsScene::CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient* client)
+    : m_client(client)
+    , m_isActive(false)
+    , m_rootLayerID(InvalidCoordinatedLayerID)
+    , m_viewBackgroundColor(Color::white)
+{
+    ASSERT(isMainThread());
+}
+
+CoordinatedGraphicsScene::~CoordinatedGraphicsScene()
+{
+}
+
+void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix&amp; matrix, float opacity, const FloatRect&amp; clipRect, const Color&amp; backgroundColor, bool drawsBackground, const FloatPoint&amp; contentPosition, TextureMapper::PaintFlags PaintFlags)
+{
+    if (!m_textureMapper) {
+        m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
+        static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;setEnableEdgeDistanceAntialiasing(true);
+    }
+
+    ASSERT(m_textureMapper-&gt;accelerationMode() == TextureMapper::OpenGLMode);
+    syncRemoteContent();
+
+    adjustPositionForFixedLayers(contentPosition);
+    TextureMapperLayer* currentRootLayer = rootLayer();
+    if (!currentRootLayer)
+        return;
+
+    currentRootLayer-&gt;setTextureMapper(m_textureMapper.get());
+    currentRootLayer-&gt;applyAnimationsRecursively();
+    m_textureMapper-&gt;beginPainting(PaintFlags);
+    m_textureMapper-&gt;beginClip(TransformationMatrix(), clipRect);
+
+    if (drawsBackground) {
+        RGBA32 rgba = makeRGBA32FromFloats(backgroundColor.red(),
+            backgroundColor.green(), backgroundColor.blue(),
+            backgroundColor.alpha() * opacity);
+        m_textureMapper-&gt;drawSolidColor(clipRect, TransformationMatrix(), Color(rgba));
+    } else {
+        GraphicsContext3D* context = static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;graphicsContext3D();
+        context-&gt;clearColor(m_viewBackgroundColor.red() / 255.0f, m_viewBackgroundColor.green() / 255.0f, m_viewBackgroundColor.blue() / 255.0f, m_viewBackgroundColor.alpha() / 255.0f);
+        context-&gt;clear(GraphicsContext3D::COLOR_BUFFER_BIT);
+    }
+
+    if (currentRootLayer-&gt;opacity() != opacity || currentRootLayer-&gt;transform() != matrix) {
+        currentRootLayer-&gt;setOpacity(opacity);
+        currentRootLayer-&gt;setTransform(matrix);
+    }
+
+    currentRootLayer-&gt;paint();
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location(), matrix);
+    m_textureMapper-&gt;endClip();
+    m_textureMapper-&gt;endPainting();
+
+    if (currentRootLayer-&gt;descendantsOrSelfHaveRunningAnimations()) {
+        RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
+        dispatchOnMainThread([=] {
+            protector-&gt;updateViewport();
+        });
+    }
+}
+
+void CoordinatedGraphicsScene::paintToGraphicsContext(PlatformGraphicsContext* platformContext, const Color&amp; backgroundColor, bool drawsBackground)
+{
+    if (!m_textureMapper)
+        m_textureMapper = TextureMapper::create();
+    ASSERT(m_textureMapper-&gt;accelerationMode() == TextureMapper::SoftwareMode);
+    syncRemoteContent();
+    TextureMapperLayer* layer = rootLayer();
+
+    if (!layer)
+        return;
+
+    GraphicsContext graphicsContext(platformContext);
+    m_textureMapper-&gt;setGraphicsContext(&amp;graphicsContext);
+    m_textureMapper-&gt;beginPainting();
+
+    IntRect clipRect = graphicsContext.clipBounds();
+    if (drawsBackground)
+        m_textureMapper-&gt;drawSolidColor(clipRect, TransformationMatrix(), backgroundColor);
+    else
+        m_textureMapper-&gt;drawSolidColor(clipRect, TransformationMatrix(), m_viewBackgroundColor);
+
+    layer-&gt;paint();
+    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location());
+    m_textureMapper-&gt;endPainting();
+    m_textureMapper-&gt;setGraphicsContext(0);
+}
+
+void CoordinatedGraphicsScene::updateViewport()
+{
+    ASSERT(isMainThread());
+    if (m_client)
+        m_client-&gt;updateViewport();
+}
+
+void CoordinatedGraphicsScene::adjustPositionForFixedLayers(const FloatPoint&amp; contentPosition)
+{
+    if (m_fixedLayers.isEmpty())
+        return;
+
+    // Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position.
+    // If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset
+    // them by the delta between the current position and the position of the viewport used for the last layout.
+    FloatSize delta = contentPosition - m_renderedContentsScrollPosition;
+
+    for (auto&amp; fixedLayer : m_fixedLayers.values())
+        fixedLayer-&gt;setScrollPositionDeltaIfNeeded(delta);
+}
+
+#if USE(GRAPHICS_SURFACE)
+void CoordinatedGraphicsScene::createPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (!state.platformLayerToken.isValid())
+        return;
+
+    RefPtr&lt;TextureMapperSurfaceBackingStore&gt; platformLayerBackingStore(TextureMapperSurfaceBackingStore::create());
+    m_surfaceBackingStores.set(layer, platformLayerBackingStore);
+    platformLayerBackingStore-&gt;setGraphicsSurface(GraphicsSurface::create(state.platformLayerSize, state.platformLayerSurfaceFlags, state.platformLayerToken));
+    layer-&gt;setContentsLayer(platformLayerBackingStore.get());
+}
+
+void CoordinatedGraphicsScene::syncPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    ASSERT(m_textureMapper);
+
+    if (state.platformLayerChanged) {
+        destroyPlatformLayerIfNeeded(layer, state);
+        createPlatformLayerIfNeeded(layer, state);
+    }
+
+    if (state.platformLayerShouldSwapBuffers) {
+        ASSERT(m_surfaceBackingStores.contains(layer));
+        SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(layer);
+        RefPtr&lt;TextureMapperSurfaceBackingStore&gt; platformLayerBackingStore = it-&gt;value;
+        platformLayerBackingStore-&gt;swapBuffersIfNeeded(state.platformLayerFrontBuffer);
+    }
+}
+
+void CoordinatedGraphicsScene::destroyPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (state.platformLayerToken.isValid())
+        return;
+
+    m_surfaceBackingStores.remove(layer);
+    layer-&gt;setContentsLayer(0);
+}
+#endif
+
+void CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (!layer-&gt;isShowingRepaintCounter() || !state.repaintCountChanged)
+        return;
+
+    layer-&gt;setRepaintCount(state.repaintCount);
+}
+
+void CoordinatedGraphicsScene::setLayerChildrenIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (!state.childrenChanged)
+        return;
+
+    Vector&lt;TextureMapperLayer*&gt; children;
+
+    for (auto&amp; child : state.children) {
+        TextureMapperLayer* childLayer = layerByID(child);
+        children.append(childLayer);
+    }
+    layer-&gt;setChildren(children);
+}
+
+void CoordinatedGraphicsScene::setLayerFiltersIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (!state.filtersChanged)
+        return;
+
+    layer-&gt;setFilters(state.filters);
+}
+
+void CoordinatedGraphicsScene::setLayerState(CoordinatedLayerID id, const CoordinatedGraphicsLayerState&amp; layerState)
+{
+    ASSERT(m_rootLayerID != InvalidCoordinatedLayerID);
+    TextureMapperLayer* layer = layerByID(id);
+
+    if (layerState.positionChanged)
+        layer-&gt;setPosition(layerState.pos);
+
+    if (layerState.anchorPointChanged)
+        layer-&gt;setAnchorPoint(layerState.anchorPoint);
+
+    if (layerState.sizeChanged)
+        layer-&gt;setSize(layerState.size);
+
+    if (layerState.transformChanged)
+        layer-&gt;setTransform(layerState.transform);
+
+    if (layerState.childrenTransformChanged)
+        layer-&gt;setChildrenTransform(layerState.childrenTransform);
+
+    if (layerState.contentsRectChanged)
+        layer-&gt;setContentsRect(layerState.contentsRect);
+
+    if (layerState.contentsTilingChanged) {
+        layer-&gt;setContentsTilePhase(layerState.contentsTilePhase);
+        layer-&gt;setContentsTileSize(layerState.contentsTileSize);
+    }
+
+    if (layerState.opacityChanged)
+        layer-&gt;setOpacity(layerState.opacity);
+
+    if (layerState.solidColorChanged)
+        layer-&gt;setSolidColor(layerState.solidColor);
+
+    if (layerState.debugBorderColorChanged || layerState.debugBorderWidthChanged)
+        layer-&gt;setDebugVisuals(layerState.showDebugBorders, layerState.debugBorderColor, layerState.debugBorderWidth, layerState.showRepaintCounter);
+
+    if (layerState.replicaChanged)
+        layer-&gt;setReplicaLayer(getLayerByIDIfExists(layerState.replica));
+
+    if (layerState.maskChanged)
+        layer-&gt;setMaskLayer(getLayerByIDIfExists(layerState.mask));
+
+    if (layerState.imageChanged)
+        assignImageBackingToLayer(layer, layerState.imageID);
+
+    if (layerState.flagsChanged) {
+        layer-&gt;setContentsOpaque(layerState.contentsOpaque);
+        layer-&gt;setDrawsContent(layerState.drawsContent);
+        layer-&gt;setContentsVisible(layerState.contentsVisible);
+        layer-&gt;setBackfaceVisibility(layerState.backfaceVisible);
+
+        // Never clip the root layer.
+        layer-&gt;setMasksToBounds(id == m_rootLayerID ? false : layerState.masksToBounds);
+        layer-&gt;setPreserves3D(layerState.preserves3D);
+
+        bool fixedToViewportChanged = layer-&gt;fixedToViewport() != layerState.fixedToViewport;
+        layer-&gt;setFixedToViewport(layerState.fixedToViewport);
+        if (fixedToViewportChanged) {
+            if (layerState.fixedToViewport)
+                m_fixedLayers.add(id, layer);
+            else
+                m_fixedLayers.remove(id);
+        }
+
+        layer-&gt;setIsScrollable(layerState.isScrollable);
+    }
+
+    if (layerState.committedScrollOffsetChanged)
+        layer-&gt;didCommitScrollOffset(layerState.committedScrollOffset);
+
+    prepareContentBackingStore(layer);
+
+    // Apply Operations.
+    setLayerChildrenIfNeeded(layer, layerState);
+    createTilesIfNeeded(layer, layerState);
+    removeTilesIfNeeded(layer, layerState);
+    updateTilesIfNeeded(layer, layerState);
+    setLayerFiltersIfNeeded(layer, layerState);
+    setLayerAnimationsIfNeeded(layer, layerState);
+#if USE(GRAPHICS_SURFACE)
+    syncPlatformLayerIfNeeded(layer, layerState);
+#endif
+    setLayerRepaintCountIfNeeded(layer, layerState);
+}
+
+TextureMapperLayer* CoordinatedGraphicsScene::getLayerByIDIfExists(CoordinatedLayerID id)
+{
+    return (id != InvalidCoordinatedLayerID) ? layerByID(id) : 0;
+}
+
+void CoordinatedGraphicsScene::createLayers(const Vector&lt;CoordinatedLayerID&gt;&amp; layerIDs)
+{
+    for (auto&amp; layerID : layerIDs)
+        createLayer(layerID);
+}
+
+void CoordinatedGraphicsScene::createLayer(CoordinatedLayerID id)
+{
+    std::unique_ptr&lt;TextureMapperLayer&gt; newLayer = std::make_unique&lt;TextureMapperLayer&gt;();
+    newLayer-&gt;setID(id);
+    newLayer-&gt;setScrollClient(this);
+    m_layers.add(id, WTF::move(newLayer));
+}
+
+void CoordinatedGraphicsScene::deleteLayers(const Vector&lt;CoordinatedLayerID&gt;&amp; layerIDs)
+{
+    for (auto&amp; layerID : layerIDs)
+        deleteLayer(layerID);
+}
+
+void CoordinatedGraphicsScene::deleteLayer(CoordinatedLayerID layerID)
+{
+    std::unique_ptr&lt;TextureMapperLayer&gt; layer = m_layers.take(layerID);
+    ASSERT(layer);
+
+    m_backingStores.remove(layer.get());
+    m_fixedLayers.remove(layerID);
+#if USE(GRAPHICS_SURFACE)
+    m_surfaceBackingStores.remove(layer.get());
+#endif
+}
+
+void CoordinatedGraphicsScene::setRootLayerID(CoordinatedLayerID layerID)
+{
+    ASSERT(layerID != InvalidCoordinatedLayerID);
+    ASSERT(m_rootLayerID == InvalidCoordinatedLayerID);
+
+    m_rootLayerID = layerID;
+
+    TextureMapperLayer* layer = layerByID(layerID);
+    ASSERT(m_rootLayer-&gt;children().isEmpty());
+    m_rootLayer-&gt;addChild(layer);
+}
+
+void CoordinatedGraphicsScene::prepareContentBackingStore(TextureMapperLayer* layer)
+{
+    if (!layerShouldHaveBackingStore(layer)) {
+        removeBackingStoreIfNeeded(layer);
+        return;
+    }
+
+    createBackingStoreIfNeeded(layer);
+    resetBackingStoreSizeToLayerSize(layer);
+}
+
+void CoordinatedGraphicsScene::createBackingStoreIfNeeded(TextureMapperLayer* layer)
+{
+    if (m_backingStores.contains(layer))
+        return;
+
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore(CoordinatedBackingStore::create());
+    m_backingStores.add(layer, backingStore);
+    layer-&gt;setBackingStore(backingStore);
+}
+
+void CoordinatedGraphicsScene::removeBackingStoreIfNeeded(TextureMapperLayer* layer)
+{
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.take(layer);
+    if (!backingStore)
+        return;
+
+    layer-&gt;setBackingStore(0);
+}
+
+void CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize(TextureMapperLayer* layer)
+{
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
+    ASSERT(backingStore);
+    backingStore-&gt;setSize(layer-&gt;size());
+    m_backingStoresWithPendingBuffers.add(backingStore);
+}
+
+void CoordinatedGraphicsScene::createTilesIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (state.tilesToCreate.isEmpty())
+        return;
+
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
+    ASSERT(backingStore);
+
+    for (auto&amp; tile : state.tilesToCreate)
+        backingStore-&gt;createTile(tile.tileID, tile.scale);
+}
+
+void CoordinatedGraphicsScene::removeTilesIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (state.tilesToRemove.isEmpty())
+        return;
+
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
+    if (!backingStore)
+        return;
+
+    for (auto&amp; tile : state.tilesToRemove)
+        backingStore-&gt;removeTile(tile);
+
+    m_backingStoresWithPendingBuffers.add(backingStore);
+}
+
+void CoordinatedGraphicsScene::updateTilesIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (state.tilesToUpdate.isEmpty())
+        return;
+
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
+    ASSERT(backingStore);
+
+    for (auto&amp; tile : state.tilesToUpdate) {
+        const SurfaceUpdateInfo&amp; surfaceUpdateInfo = tile.updateInfo;
+
+        SurfaceMap::iterator surfaceIt = m_surfaces.find(surfaceUpdateInfo.atlasID);
+        ASSERT(surfaceIt != m_surfaces.end());
+
+        backingStore-&gt;updateTile(tile.tileID, surfaceUpdateInfo.updateRect, tile.tileRect, surfaceIt-&gt;value, surfaceUpdateInfo.surfaceOffset);
+        m_backingStoresWithPendingBuffers.add(backingStore);
+    }
+}
+
+void CoordinatedGraphicsScene::syncUpdateAtlases(const CoordinatedGraphicsState&amp; state)
+{
+    for (auto&amp; atlas : state.updateAtlasesToCreate)
+        createUpdateAtlas(atlas.first, atlas.second);
+
+    for (auto&amp; atlas : state.updateAtlasesToRemove)
+        removeUpdateAtlas(atlas);
+}
+
+void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, PassRefPtr&lt;CoordinatedSurface&gt; surface)
+{
+    ASSERT(!m_surfaces.contains(atlasID));
+    m_surfaces.add(atlasID, surface);
+}
+
+void CoordinatedGraphicsScene::removeUpdateAtlas(uint32_t atlasID)
+{
+    ASSERT(m_surfaces.contains(atlasID));
+    m_surfaces.remove(atlasID);
+}
+
+void CoordinatedGraphicsScene::syncImageBackings(const CoordinatedGraphicsState&amp; state)
+{
+    for (auto&amp; image : state.imagesToRemove)
+        removeImageBacking(image);
+
+    for (auto&amp; image : state.imagesToCreate)
+        createImageBacking(image);
+
+    for (auto&amp; image : state.imagesToUpdate)
+        updateImageBacking(image.first, image.second);
+
+    for (auto&amp; image : state.imagesToClear)
+        clearImageBackingContents(image);
+}
+
+void CoordinatedGraphicsScene::createImageBacking(CoordinatedImageBackingID imageID)
+{
+    ASSERT(!m_imageBackings.contains(imageID));
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore(CoordinatedBackingStore::create());
+    m_imageBackings.add(imageID, backingStore.release());
+}
+
+void CoordinatedGraphicsScene::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr&lt;CoordinatedSurface&gt; surface)
+{
+    ASSERT(m_imageBackings.contains(imageID));
+    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = it-&gt;value;
+
+    // CoordinatedImageBacking is realized to CoordinatedBackingStore with only one tile in UI Process.
+    backingStore-&gt;createTile(1 /* id */, 1 /* scale */);
+    IntRect rect(IntPoint::zero(), surface-&gt;size());
+    // See CoordinatedGraphicsLayer::shouldDirectlyCompositeImage()
+    ASSERT(2000 &gt;= std::max(rect.width(), rect.height()));
+    backingStore-&gt;setSize(rect.size());
+    backingStore-&gt;updateTile(1 /* id */, rect, rect, surface, rect.location());
+
+    m_backingStoresWithPendingBuffers.add(backingStore);
+}
+
+void CoordinatedGraphicsScene::clearImageBackingContents(CoordinatedImageBackingID imageID)
+{
+    ASSERT(m_imageBackings.contains(imageID));
+    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
+    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = it-&gt;value;
+    backingStore-&gt;removeAllTiles();
+    m_backingStoresWithPendingBuffers.add(backingStore);
+}
+
+void CoordinatedGraphicsScene::removeImageBacking(CoordinatedImageBackingID imageID)
+{
+    ASSERT(m_imageBackings.contains(imageID));
+
+    // We don't want TextureMapperLayer refers a dangling pointer.
+    m_releasedImageBackings.append(m_imageBackings.take(imageID));
+}
+
+void CoordinatedGraphicsScene::assignImageBackingToLayer(TextureMapperLayer* layer, CoordinatedImageBackingID imageID)
+{
+#if USE(GRAPHICS_SURFACE)
+    if (m_surfaceBackingStores.contains(layer))
+        return;
+#endif
+
+    if (imageID == InvalidCoordinatedImageBackingID) {
+        layer-&gt;setContentsLayer(0);
+        return;
+    }
+
+    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
+    ASSERT(it != m_imageBackings.end());
+    layer-&gt;setContentsLayer(it-&gt;value.get());
+}
+
+void CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded()
+{
+    m_releasedImageBackings.clear();
+}
+
+void CoordinatedGraphicsScene::commitPendingBackingStoreOperations()
+{
+    for (auto&amp; backingStore : m_backingStoresWithPendingBuffers)
+        backingStore-&gt;commitTileOperations(m_textureMapper.get());
+
+    m_backingStoresWithPendingBuffers.clear();
+}
+
+void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState&amp; state)
+{
+    m_renderedContentsScrollPosition = state.scrollPosition;
+
+    createLayers(state.layersToCreate);
+    deleteLayers(state.layersToRemove);
+
+    if (state.rootCompositingLayer != m_rootLayerID)
+        setRootLayerID(state.rootCompositingLayer);
+
+    syncImageBackings(state);
+    syncUpdateAtlases(state);
+
+    for (auto&amp; layer : state.layersToUpdate)
+        setLayerState(layer.first, layer.second);
+
+    commitPendingBackingStoreOperations();
+    removeReleasedImageBackingsIfNeeded();
+
+    // The pending tiles state is on its way for the screen, tell the web process to render the next one.
+    RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
+    dispatchOnMainThread([=] {
+        protector-&gt;renderNextFrame();
+    });
+}
+
+void CoordinatedGraphicsScene::renderNextFrame()
+{
+    if (m_client)
+        m_client-&gt;renderNextFrame();
+}
+
+void CoordinatedGraphicsScene::ensureRootLayer()
+{
+    if (m_rootLayer)
+        return;
+
+    m_rootLayer = std::make_unique&lt;TextureMapperLayer&gt;();
+    m_rootLayer-&gt;setMasksToBounds(false);
+    m_rootLayer-&gt;setDrawsContent(false);
+    m_rootLayer-&gt;setAnchorPoint(FloatPoint3D(0, 0, 0));
+
+    // The root layer should not have zero size, or it would be optimized out.
+    m_rootLayer-&gt;setSize(FloatSize(1.0, 1.0));
+
+    ASSERT(m_textureMapper);
+    m_rootLayer-&gt;setTextureMapper(m_textureMapper.get());
+}
+
+void CoordinatedGraphicsScene::syncRemoteContent()
+{
+    // We enqueue messages and execute them during paint, as they require an active GL context.
+    ensureRootLayer();
+
+    Vector&lt;std::function&lt;void()&gt;&gt; renderQueue;
+    bool calledOnMainThread = WTF::isMainThread();
+    if (!calledOnMainThread)
+        m_renderQueueMutex.lock();
+    renderQueue = WTF::move(m_renderQueue);
+    if (!calledOnMainThread)
+        m_renderQueueMutex.unlock();
+
+    for (auto&amp; function : renderQueue)
+        function();
+}
+
+void CoordinatedGraphicsScene::purgeGLResources()
+{
+    m_imageBackings.clear();
+    m_releasedImageBackings.clear();
+#if USE(GRAPHICS_SURFACE)
+    m_surfaceBackingStores.clear();
+#endif
+    m_surfaces.clear();
+
+    m_rootLayer = nullptr;
+    m_rootLayerID = InvalidCoordinatedLayerID;
+    m_layers.clear();
+    m_fixedLayers.clear();
+    m_textureMapper = nullptr;
+    m_backingStores.clear();
+    m_backingStoresWithPendingBuffers.clear();
+
+    setActive(false);
+
+    RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
+    dispatchOnMainThread([=] {
+        protector-&gt;purgeBackingStores();
+    });
+}
+
+void CoordinatedGraphicsScene::dispatchCommitScrollOffset(uint32_t layerID, const IntSize&amp; offset)
+{
+    m_client-&gt;commitScrollOffset(layerID, offset);
+}
+
+void CoordinatedGraphicsScene::commitScrollOffset(uint32_t layerID, const IntSize&amp; offset)
+{
+    RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
+    dispatchOnMainThread([=] {
+        protector-&gt;dispatchCommitScrollOffset(layerID, offset);
+    });
+}
+
+void CoordinatedGraphicsScene::purgeBackingStores()
+{
+    if (m_client)
+        m_client-&gt;purgeBackingStores();
+}
+
+void CoordinatedGraphicsScene::setLayerAnimationsIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
+{
+    if (!state.animationsChanged)
+        return;
+
+    layer-&gt;setAnimations(state.animations);
+}
+
+void CoordinatedGraphicsScene::detach()
+{
+    ASSERT(isMainThread());
+    m_renderQueue.clear();
+    m_client = 0;
+}
+
+void CoordinatedGraphicsScene::appendUpdate(std::function&lt;void()&gt; function)
+{
+    if (!m_isActive)
+        return;
+
+    ASSERT(isMainThread());
+    MutexLocker locker(m_renderQueueMutex);
+    m_renderQueue.append(WTF::move(function));
+}
+
+void CoordinatedGraphicsScene::setActive(bool active)
+{
+    if (m_isActive == active)
+        return;
+
+    // Have to clear render queue in both cases.
+    // If there are some updates in queue during activation then those updates are from previous instance of paint node
+    // and cannot be applied to the newly created instance.
+    m_renderQueue.clear();
+    m_isActive = active;
+    if (m_isActive) {
+        RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
+        dispatchOnMainThread([=] {
+            protector-&gt;renderNextFrame();
+        });
+    }
+}
+
+TextureMapperLayer* CoordinatedGraphicsScene::findScrollableContentsLayerAt(const FloatPoint&amp; point)
+{
+    return rootLayer() ? rootLayer()-&gt;findScrollableContentsLayerAt(point) : 0;
+}
+
+} // namespace WebKit
+
+#endif // USE(COORDINATED_GRAPHICS)
</ins></span></pre></div>
<a id="trunkSourceWebKit2SharedCoordinatedGraphicsCoordinatedGraphicsScenehfromrev176945trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedGraphicsSceneh"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h (from rev 176945, trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h) (0 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h                                (rev 0)
+++ trunk/Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.h        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -0,0 +1,192 @@
</span><ins>+/*
+    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
+    Copyright (C) 2013 Company 100, Inc.
+
+    This library is free software; you can redistribute it and/or
+    modify it under the terms of the GNU Library General Public
+    License as published by the Free Software Foundation; either
+    version 2 of the License, or (at your option) any later version.
+
+    This library is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+    Library General Public License for more details.
+
+    You should have received a copy of the GNU Library General Public License
+    along with this library; see the file COPYING.LIB.  If not, write to
+    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+    Boston, MA 02110-1301, USA.
+*/
+
+#ifndef CoordinatedGraphicsScene_h
+#define CoordinatedGraphicsScene_h
+
+#if USE(COORDINATED_GRAPHICS)
+#include &lt;WebCore/CoordinatedGraphicsState.h&gt;
+#include &lt;WebCore/CoordinatedSurface.h&gt;
+#include &lt;WebCore/GraphicsContext.h&gt;
+#include &lt;WebCore/GraphicsLayer.h&gt;
+#include &lt;WebCore/GraphicsLayerAnimation.h&gt;
+#include &lt;WebCore/IntRect.h&gt;
+#include &lt;WebCore/IntSize.h&gt;
+#include &lt;WebCore/TextureMapper.h&gt;
+#include &lt;WebCore/TextureMapperBackingStore.h&gt;
+#include &lt;WebCore/TextureMapperFPSCounter.h&gt;
+#include &lt;WebCore/TextureMapperLayer.h&gt;
+#include &lt;WebCore/Timer.h&gt;
+#include &lt;functional&gt;
+#include &lt;wtf/HashSet.h&gt;
+#include &lt;wtf/ThreadingPrimitives.h&gt;
+#include &lt;wtf/Vector.h&gt;
+
+#if USE(GRAPHICS_SURFACE)
+#include &lt;WebCore/GraphicsSurface.h&gt;
+#include &lt;WebCore/TextureMapperSurfaceBackingStore.h&gt;
+#endif
+
+namespace WebKit {
+
+class CoordinatedBackingStore;
+
+class CoordinatedGraphicsSceneClient {
+public:
+    virtual ~CoordinatedGraphicsSceneClient() { }
+    virtual void purgeBackingStores() = 0;
+    virtual void renderNextFrame() = 0;
+    virtual void updateViewport() = 0;
+    virtual void commitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset) = 0;
+};
+
+class CoordinatedGraphicsScene : public ThreadSafeRefCounted&lt;CoordinatedGraphicsScene&gt;, public WebCore::TextureMapperLayer::ScrollingClient {
+public:
+    explicit CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient*);
+    virtual ~CoordinatedGraphicsScene();
+    void paintToCurrentGLContext(const WebCore::TransformationMatrix&amp;, float, const WebCore::FloatRect&amp;, const WebCore::Color&amp; backgroundColor, bool drawsBackground, const WebCore::FloatPoint&amp;, WebCore::TextureMapper::PaintFlags = 0);
+    void paintToGraphicsContext(PlatformGraphicsContext*, const WebCore::Color&amp; backgroundColor, bool drawsBackground);
+    void detach();
+    void appendUpdate(std::function&lt;void()&gt;);
+
+    WebCore::TextureMapperLayer* findScrollableContentsLayerAt(const WebCore::FloatPoint&amp;);
+
+    virtual void commitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset);
+
+    // The painting thread must lock the main thread to use below two methods, because two methods access members that the main thread manages. See m_client.
+    // Currently, QQuickWebPage::updatePaintNode() locks the main thread before calling both methods.
+    void purgeGLResources();
+
+    bool isActive() const { return m_isActive; }
+    void setActive(bool);
+
+    void commitSceneState(const WebCore::CoordinatedGraphicsState&amp;);
+
+    void setViewBackgroundColor(const WebCore::Color&amp; color) { m_viewBackgroundColor = color; }
+    WebCore::Color viewBackgroundColor() const { return m_viewBackgroundColor; }
+
+private:
+    void setRootLayerID(WebCore::CoordinatedLayerID);
+    void createLayers(const Vector&lt;WebCore::CoordinatedLayerID&gt;&amp;);
+    void deleteLayers(const Vector&lt;WebCore::CoordinatedLayerID&gt;&amp;);
+    void setLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void setLayerChildrenIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void updateTilesIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void createTilesIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void removeTilesIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void setLayerFiltersIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void setLayerAnimationsIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+#if USE(GRAPHICS_SURFACE)
+    void createPlatformLayerIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void syncPlatformLayerIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+    void destroyPlatformLayerIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+#endif
+    void setLayerRepaintCountIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
+
+    void syncUpdateAtlases(const WebCore::CoordinatedGraphicsState&amp;);
+    void createUpdateAtlas(uint32_t atlasID, PassRefPtr&lt;WebCore::CoordinatedSurface&gt;);
+    void removeUpdateAtlas(uint32_t atlasID);
+
+    void syncImageBackings(const WebCore::CoordinatedGraphicsState&amp;);
+    void createImageBacking(WebCore::CoordinatedImageBackingID);
+    void updateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr&lt;WebCore::CoordinatedSurface&gt;);
+    void clearImageBackingContents(WebCore::CoordinatedImageBackingID);
+    void removeImageBacking(WebCore::CoordinatedImageBackingID);
+
+    WebCore::TextureMapperLayer* layerByID(WebCore::CoordinatedLayerID id)
+    {
+        ASSERT(m_layers.contains(id));
+        ASSERT(id != WebCore::InvalidCoordinatedLayerID);
+        return m_layers.get(id);
+    }
+    WebCore::TextureMapperLayer* getLayerByIDIfExists(WebCore::CoordinatedLayerID);
+    WebCore::TextureMapperLayer* rootLayer() { return m_rootLayer.get(); }
+
+    void syncRemoteContent();
+    void adjustPositionForFixedLayers(const WebCore::FloatPoint&amp; contentPosition);
+
+    void dispatchOnMainThread(std::function&lt;void()&gt;);
+    void updateViewport();
+    void renderNextFrame();
+    void purgeBackingStores();
+
+    void createLayer(WebCore::CoordinatedLayerID);
+    void deleteLayer(WebCore::CoordinatedLayerID);
+
+    void assignImageBackingToLayer(WebCore::TextureMapperLayer*, WebCore::CoordinatedImageBackingID);
+    void removeReleasedImageBackingsIfNeeded();
+    void ensureRootLayer();
+    void commitPendingBackingStoreOperations();
+
+    void prepareContentBackingStore(WebCore::TextureMapperLayer*);
+    void createBackingStoreIfNeeded(WebCore::TextureMapperLayer*);
+    void removeBackingStoreIfNeeded(WebCore::TextureMapperLayer*);
+    void resetBackingStoreSizeToLayerSize(WebCore::TextureMapperLayer*);
+
+    void dispatchCommitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset);
+
+    // Render queue can be accessed ony from main thread or updatePaintNode call stack!
+    Vector&lt;std::function&lt;void()&gt;&gt; m_renderQueue;
+    Mutex m_renderQueueMutex;
+
+    std::unique_ptr&lt;WebCore::TextureMapper&gt; m_textureMapper;
+
+    typedef HashMap&lt;WebCore::CoordinatedImageBackingID, RefPtr&lt;CoordinatedBackingStore&gt;&gt; ImageBackingMap;
+    ImageBackingMap m_imageBackings;
+    Vector&lt;RefPtr&lt;CoordinatedBackingStore&gt;&gt; m_releasedImageBackings;
+
+    typedef HashMap&lt;WebCore::TextureMapperLayer*, RefPtr&lt;CoordinatedBackingStore&gt;&gt; BackingStoreMap;
+    BackingStoreMap m_backingStores;
+
+    HashSet&lt;RefPtr&lt;CoordinatedBackingStore&gt;&gt; m_backingStoresWithPendingBuffers;
+
+#if USE(GRAPHICS_SURFACE)
+    typedef HashMap&lt;WebCore::TextureMapperLayer*, RefPtr&lt;WebCore::TextureMapperSurfaceBackingStore&gt;&gt; SurfaceBackingStoreMap;
+    SurfaceBackingStoreMap m_surfaceBackingStores;
+#endif
+
+    typedef HashMap&lt;uint32_t /* atlasID */, RefPtr&lt;WebCore::CoordinatedSurface&gt;&gt; SurfaceMap;
+    SurfaceMap m_surfaces;
+
+    // Below two members are accessed by only the main thread. The painting thread must lock the main thread to access both members.
+    CoordinatedGraphicsSceneClient* m_client;
+    bool m_isActive;
+
+    std::unique_ptr&lt;WebCore::TextureMapperLayer&gt; m_rootLayer;
+
+    typedef HashMap&lt;WebCore::CoordinatedLayerID, std::unique_ptr&lt;WebCore::TextureMapperLayer&gt;&gt; LayerMap;
+    LayerMap m_layers;
+    typedef HashMap&lt;WebCore::CoordinatedLayerID, WebCore::TextureMapperLayer*&gt; LayerRawPtrMap;
+    LayerRawPtrMap m_fixedLayers;
+    WebCore::CoordinatedLayerID m_rootLayerID;
+    WebCore::FloatPoint m_scrollPosition;
+    WebCore::FloatPoint m_renderedContentsScrollPosition;
+    WebCore::Color m_viewBackgroundColor;
+
+    WebCore::TextureMapperFPSCounter m_fpsCounter;
+};
+
+} // namespace WebKit
+
+#endif // USE(COORDINATED_GRAPHICS)
+
+#endif // CoordinatedGraphicsScene_h
+
+
</ins></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedBackingStorecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp (176945 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp        2014-12-08 11:34:48 UTC (rev 176945)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.cpp        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -1,188 +0,0 @@
</span><del>-/*
- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB.  If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
- */
-
-#include &quot;config.h&quot;
-#include &quot;CoordinatedBackingStore.h&quot;
-
-#if USE(COORDINATED_GRAPHICS)
-#include &lt;WebCore/CoordinatedSurface.h&gt;
-#include &lt;WebCore/GraphicsLayer.h&gt;
-#include &lt;WebCore/TextureMapper.h&gt;
-#include &lt;WebCore/TextureMapperGL.h&gt;
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void CoordinatedBackingStoreTile::swapBuffers(TextureMapper* textureMapper)
-{
-    if (!m_surface)
-        return;
-
-    FloatRect tileRect(m_tileRect);
-    tileRect.scale(1. / m_scale);
-    bool shouldReset = false;
-    if (tileRect != rect()) {
-        setRect(tileRect);
-        shouldReset = true;
-    }
-    RefPtr&lt;BitmapTexture&gt; texture = this-&gt;texture();
-    if (!texture) {
-        texture = textureMapper-&gt;createTexture();
-        setTexture(texture.get());
-        shouldReset = true;
-    }
-
-    ASSERT(textureMapper-&gt;maxTextureSize().width() &gt;= m_tileRect.size().width());
-    ASSERT(textureMapper-&gt;maxTextureSize().height() &gt;= m_tileRect.size().height());
-    if (shouldReset)
-        texture-&gt;reset(m_tileRect.size(), m_surface-&gt;supportsAlpha());
-
-    m_surface-&gt;copyToTexture(texture, m_sourceRect, m_surfaceOffset);
-    m_surface.clear();
-}
-
-void CoordinatedBackingStoreTile::setBackBuffer(const IntRect&amp; tileRect, const IntRect&amp; sourceRect, PassRefPtr&lt;CoordinatedSurface&gt; buffer, const IntPoint&amp; offset)
-{
-    m_sourceRect = sourceRect;
-    m_tileRect = tileRect;
-    m_surfaceOffset = offset;
-    m_surface = buffer;
-}
-
-void CoordinatedBackingStore::createTile(uint32_t id, float scale)
-{
-    m_tiles.add(id, CoordinatedBackingStoreTile(scale));
-    m_scale = scale;
-}
-
-void CoordinatedBackingStore::removeTile(uint32_t id)
-{
-    ASSERT(m_tiles.contains(id));
-    m_tilesToRemove.add(id);
-}
-
-void CoordinatedBackingStore::removeAllTiles()
-{
-    for (auto&amp; key : m_tiles.keys())
-        m_tilesToRemove.add(key);
-}
-
-void CoordinatedBackingStore::updateTile(uint32_t id, const IntRect&amp; sourceRect, const IntRect&amp; tileRect, PassRefPtr&lt;CoordinatedSurface&gt; backBuffer, const IntPoint&amp; offset)
-{
-    CoordinatedBackingStoreTileMap::iterator it = m_tiles.find(id);
-    ASSERT(it != m_tiles.end());
-    it-&gt;value.setBackBuffer(tileRect, sourceRect, backBuffer, offset);
-}
-
-PassRefPtr&lt;BitmapTexture&gt; CoordinatedBackingStore::texture() const
-{
-    for (auto&amp; tile : m_tiles.values()) {
-        RefPtr&lt;BitmapTexture&gt; texture = tile.texture();
-        if (texture)
-            return texture;
-    }
-
-    return PassRefPtr&lt;BitmapTexture&gt;();
-}
-
-void CoordinatedBackingStore::setSize(const FloatSize&amp; size)
-{
-    m_pendingSize = size;
-}
-
-void CoordinatedBackingStore::paintTilesToTextureMapper(Vector&lt;TextureMapperTile*&gt;&amp; tiles, TextureMapper* textureMapper, const TransformationMatrix&amp; transform, float opacity, const FloatRect&amp; rect)
-{
-    for (auto&amp; tile : tiles)
-        tile-&gt;paint(textureMapper, transform, opacity, calculateExposedTileEdges(rect, tile-&gt;rect()));
-}
-
-TransformationMatrix CoordinatedBackingStore::adjustedTransformForRect(const FloatRect&amp; targetRect)
-{
-    return TransformationMatrix::rectToRect(rect(), targetRect);
-}
-
-void CoordinatedBackingStore::paintToTextureMapper(TextureMapper* textureMapper, const FloatRect&amp; targetRect, const TransformationMatrix&amp; transform, float opacity)
-{
-    if (m_tiles.isEmpty())
-        return;
-    ASSERT(!m_size.isZero());
-
-    Vector&lt;TextureMapperTile*&gt; tilesToPaint;
-    Vector&lt;TextureMapperTile*&gt; previousTilesToPaint;
-
-    // We have to do this every time we paint, in case the opacity has changed.
-    FloatRect coveredRect;
-    for (auto&amp; tile : m_tiles.values()) {
-        if (!tile.texture())
-            continue;
-
-        if (tile.scale() == m_scale) {
-            tilesToPaint.append(&amp;tile);
-            coveredRect.unite(tile.rect());
-            continue;
-        }
-
-        // Only show the previous tile if the opacity is high, otherwise effect looks like a bug.
-        // We show the previous-scale tile anyway if it doesn't intersect with any current-scale tile.
-        if (opacity &lt; 0.95 &amp;&amp; coveredRect.intersects(tile.rect()))
-            continue;
-
-        previousTilesToPaint.append(&amp;tile);
-    }
-
-    // targetRect is on the contents coordinate system, so we must compare two rects on the contents coordinate system.
-    // See TiledBackingStore.
-    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
-
-    paintTilesToTextureMapper(previousTilesToPaint, textureMapper, adjustedTransform, opacity, rect());
-    paintTilesToTextureMapper(tilesToPaint, textureMapper, adjustedTransform, opacity, rect());
-}
-
-void CoordinatedBackingStore::drawBorder(TextureMapper* textureMapper, const Color&amp; borderColor, float borderWidth, const FloatRect&amp; targetRect, const TransformationMatrix&amp; transform)
-{
-    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
-    for (auto&amp; tile : m_tiles.values())
-        textureMapper-&gt;drawBorder(borderColor, borderWidth, tile.rect(), adjustedTransform);
-}
-
-void CoordinatedBackingStore::drawRepaintCounter(TextureMapper* textureMapper, int repaintCount, const Color&amp; borderColor, const FloatRect&amp; targetRect, const TransformationMatrix&amp; transform)
-{
-    TransformationMatrix adjustedTransform = transform * adjustedTransformForRect(targetRect);
-    for (auto&amp; tile : m_tiles.values())
-        textureMapper-&gt;drawNumber(repaintCount, borderColor, tile.rect().location(), adjustedTransform);
-}
-
-void CoordinatedBackingStore::commitTileOperations(TextureMapper* textureMapper)
-{
-    if (!m_pendingSize.isZero()) {
-        m_size = m_pendingSize;
-        m_pendingSize = FloatSize();
-    }
-
-    for (auto&amp; tileToRemove : m_tilesToRemove)
-        m_tiles.remove(tileToRemove);
-    m_tilesToRemove.clear();
-
-    for (auto&amp; tile : m_tiles.values())
-        tile.swapBuffers(textureMapper);
-}
-
-} // namespace WebCore
-#endif // USE(COORDINATED_GRAPHICS)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedBackingStoreh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h (176945 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h        2014-12-08 11:34:48 UTC (rev 176945)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedBackingStore.h        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -1,93 +0,0 @@
</span><del>-/*
- Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
-
- This library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Library General Public
- License as published by the Free Software Foundation; either
- version 2 of the License, or (at your option) any later version.
-
- This library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- Library General Public License for more details.
-
- You should have received a copy of the GNU Library General Public License
- along with this library; see the file COPYING.LIB.  If not, write to
- the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
- */
-
-#ifndef CoordinatedBackingStore_h
-#define CoordinatedBackingStore_h
-
-#if USE(COORDINATED_GRAPHICS)
-
-#include &lt;WebCore/TextureMapper.h&gt;
-#include &lt;WebCore/TextureMapperBackingStore.h&gt;
-#include &lt;WebCore/TextureMapperTile.h&gt;
-#include &lt;wtf/HashMap.h&gt;
-#include &lt;wtf/HashSet.h&gt;
-
-
-namespace WebCore {
-class CoordinatedSurface;
-}
-
-namespace WebKit {
-
-class CoordinatedBackingStoreTile : public WebCore::TextureMapperTile {
-public:
-    explicit CoordinatedBackingStoreTile(float scale = 1)
-        : WebCore::TextureMapperTile(WebCore::FloatRect())
-        , m_scale(scale)
-    {
-    }
-
-    inline float scale() const { return m_scale; }
-    void swapBuffers(WebCore::TextureMapper*);
-    void setBackBuffer(const WebCore::IntRect&amp;, const WebCore::IntRect&amp;, PassRefPtr&lt;WebCore::CoordinatedSurface&gt; buffer, const WebCore::IntPoint&amp;);
-
-private:
-    RefPtr&lt;WebCore::CoordinatedSurface&gt; m_surface;
-    WebCore::IntRect m_sourceRect;
-    WebCore::IntRect m_tileRect;
-    WebCore::IntPoint m_surfaceOffset;
-    float m_scale;
-};
-
-class CoordinatedBackingStore : public WebCore::TextureMapperBackingStore {
-public:
-    void createTile(uint32_t tileID, float);
-    void removeTile(uint32_t tileID);
-    void removeAllTiles();
-    void updateTile(uint32_t tileID, const WebCore::IntRect&amp;, const WebCore::IntRect&amp;, PassRefPtr&lt;WebCore::CoordinatedSurface&gt;, const WebCore::IntPoint&amp;);
-    static PassRefPtr&lt;CoordinatedBackingStore&gt; create() { return adoptRef(new CoordinatedBackingStore); }
-    void commitTileOperations(WebCore::TextureMapper*);
-    PassRefPtr&lt;WebCore::BitmapTexture&gt; texture() const;
-    void setSize(const WebCore::FloatSize&amp;);
-    virtual void paintToTextureMapper(WebCore::TextureMapper*, const WebCore::FloatRect&amp;, const WebCore::TransformationMatrix&amp;, float);
-    virtual void drawBorder(WebCore::TextureMapper*, const WebCore::Color&amp;, float borderWidth, const WebCore::FloatRect&amp;, const WebCore::TransformationMatrix&amp;) override;
-    virtual void drawRepaintCounter(WebCore::TextureMapper*, int repaintCount, const WebCore::Color&amp;, const WebCore::FloatRect&amp;, const WebCore::TransformationMatrix&amp;) override;
-
-private:
-    CoordinatedBackingStore()
-        : m_scale(1.)
-    { }
-    void paintTilesToTextureMapper(Vector&lt;WebCore::TextureMapperTile*&gt;&amp;, WebCore::TextureMapper*, const WebCore::TransformationMatrix&amp;, float, const WebCore::FloatRect&amp;);
-    WebCore::TransformationMatrix adjustedTransformForRect(const WebCore::FloatRect&amp;);
-    WebCore::FloatRect rect() const { return WebCore::FloatRect(WebCore::FloatPoint::zero(), m_size); }
-
-    typedef HashMap&lt;uint32_t, CoordinatedBackingStoreTile&gt; CoordinatedBackingStoreTileMap;
-    CoordinatedBackingStoreTileMap m_tiles;
-    HashSet&lt;uint32_t&gt; m_tilesToRemove;
-    // FIXME: m_pendingSize should be removed after the following bug is fixed: https://bugs.webkit.org/show_bug.cgi?id=108294
-    WebCore::FloatSize m_pendingSize;
-    WebCore::FloatSize m_size;
-    float m_scale;
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
-
-#endif // CoordinatedBackingStore_h
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedGraphicsScenecpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (176945 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp        2014-12-08 11:34:48 UTC (rev 176945)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.cpp        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -1,716 +0,0 @@
</span><del>-/*
-    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
-    Copyright (C) 2012 Company 100, Inc.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#include &quot;config.h&quot;
-
-#if USE(COORDINATED_GRAPHICS)
-#include &quot;CoordinatedGraphicsScene.h&quot;
-
-#include &quot;CoordinatedBackingStore.h&quot;
-#include &lt;WebCore/TextureMapper.h&gt;
-#include &lt;WebCore/TextureMapperBackingStore.h&gt;
-#include &lt;WebCore/TextureMapperGL.h&gt;
-#include &lt;WebCore/TextureMapperLayer.h&gt;
-#include &lt;wtf/Atomics.h&gt;
-#include &lt;wtf/MainThread.h&gt;
-
-using namespace WebCore;
-
-namespace WebKit {
-
-void CoordinatedGraphicsScene::dispatchOnMainThread(std::function&lt;void()&gt; function)
-{
-    if (isMainThread())
-        function();
-    else
-        callOnMainThread(WTF::move(function));
-}
-
-static bool layerShouldHaveBackingStore(TextureMapperLayer* layer)
-{
-    return layer-&gt;drawsContent() &amp;&amp; layer-&gt;contentsAreVisible() &amp;&amp; !layer-&gt;size().isEmpty();
-}
-
-CoordinatedGraphicsScene::CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient* client)
-    : m_client(client)
-    , m_isActive(false)
-    , m_rootLayerID(InvalidCoordinatedLayerID)
-    , m_viewBackgroundColor(Color::white)
-{
-    ASSERT(isMainThread());
-}
-
-CoordinatedGraphicsScene::~CoordinatedGraphicsScene()
-{
-}
-
-void CoordinatedGraphicsScene::paintToCurrentGLContext(const TransformationMatrix&amp; matrix, float opacity, const FloatRect&amp; clipRect, const Color&amp; backgroundColor, bool drawsBackground, const FloatPoint&amp; contentPosition, TextureMapper::PaintFlags PaintFlags)
-{
-    if (!m_textureMapper) {
-        m_textureMapper = TextureMapper::create(TextureMapper::OpenGLMode);
-        static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;setEnableEdgeDistanceAntialiasing(true);
-    }
-
-    ASSERT(m_textureMapper-&gt;accelerationMode() == TextureMapper::OpenGLMode);
-    syncRemoteContent();
-
-    adjustPositionForFixedLayers(contentPosition);
-    TextureMapperLayer* currentRootLayer = rootLayer();
-    if (!currentRootLayer)
-        return;
-
-    currentRootLayer-&gt;setTextureMapper(m_textureMapper.get());
-    currentRootLayer-&gt;applyAnimationsRecursively();
-    m_textureMapper-&gt;beginPainting(PaintFlags);
-    m_textureMapper-&gt;beginClip(TransformationMatrix(), clipRect);
-
-    if (drawsBackground) {
-        RGBA32 rgba = makeRGBA32FromFloats(backgroundColor.red(),
-            backgroundColor.green(), backgroundColor.blue(),
-            backgroundColor.alpha() * opacity);
-        m_textureMapper-&gt;drawSolidColor(clipRect, TransformationMatrix(), Color(rgba));
-    } else {
-        GraphicsContext3D* context = static_cast&lt;TextureMapperGL*&gt;(m_textureMapper.get())-&gt;graphicsContext3D();
-        context-&gt;clearColor(m_viewBackgroundColor.red() / 255.0f, m_viewBackgroundColor.green() / 255.0f, m_viewBackgroundColor.blue() / 255.0f, m_viewBackgroundColor.alpha() / 255.0f);
-        context-&gt;clear(GraphicsContext3D::COLOR_BUFFER_BIT);
-    }
-
-    if (currentRootLayer-&gt;opacity() != opacity || currentRootLayer-&gt;transform() != matrix) {
-        currentRootLayer-&gt;setOpacity(opacity);
-        currentRootLayer-&gt;setTransform(matrix);
-    }
-
-    currentRootLayer-&gt;paint();
-    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location(), matrix);
-    m_textureMapper-&gt;endClip();
-    m_textureMapper-&gt;endPainting();
-
-    if (currentRootLayer-&gt;descendantsOrSelfHaveRunningAnimations()) {
-        RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
-        dispatchOnMainThread([=] {
-            protector-&gt;updateViewport();
-        });
-    }
-}
-
-void CoordinatedGraphicsScene::paintToGraphicsContext(PlatformGraphicsContext* platformContext, const Color&amp; backgroundColor, bool drawsBackground)
-{
-    if (!m_textureMapper)
-        m_textureMapper = TextureMapper::create();
-    ASSERT(m_textureMapper-&gt;accelerationMode() == TextureMapper::SoftwareMode);
-    syncRemoteContent();
-    TextureMapperLayer* layer = rootLayer();
-
-    if (!layer)
-        return;
-
-    GraphicsContext graphicsContext(platformContext);
-    m_textureMapper-&gt;setGraphicsContext(&amp;graphicsContext);
-    m_textureMapper-&gt;beginPainting();
-
-    IntRect clipRect = graphicsContext.clipBounds();
-    if (drawsBackground)
-        m_textureMapper-&gt;drawSolidColor(clipRect, TransformationMatrix(), backgroundColor);
-    else
-        m_textureMapper-&gt;drawSolidColor(clipRect, TransformationMatrix(), m_viewBackgroundColor);
-
-    layer-&gt;paint();
-    m_fpsCounter.updateFPSAndDisplay(m_textureMapper.get(), clipRect.location());
-    m_textureMapper-&gt;endPainting();
-    m_textureMapper-&gt;setGraphicsContext(0);
-}
-
-void CoordinatedGraphicsScene::updateViewport()
-{
-    ASSERT(isMainThread());
-    if (m_client)
-        m_client-&gt;updateViewport();
-}
-
-void CoordinatedGraphicsScene::adjustPositionForFixedLayers(const FloatPoint&amp; contentPosition)
-{
-    if (m_fixedLayers.isEmpty())
-        return;
-
-    // Fixed layer positions are updated by the web process when we update the visible contents rect / scroll position.
-    // If we want those layers to follow accurately the viewport when we move between the web process updates, we have to offset
-    // them by the delta between the current position and the position of the viewport used for the last layout.
-    FloatSize delta = contentPosition - m_renderedContentsScrollPosition;
-
-    for (auto&amp; fixedLayer : m_fixedLayers.values())
-        fixedLayer-&gt;setScrollPositionDeltaIfNeeded(delta);
-}
-
-#if USE(GRAPHICS_SURFACE)
-void CoordinatedGraphicsScene::createPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (!state.platformLayerToken.isValid())
-        return;
-
-    RefPtr&lt;TextureMapperSurfaceBackingStore&gt; platformLayerBackingStore(TextureMapperSurfaceBackingStore::create());
-    m_surfaceBackingStores.set(layer, platformLayerBackingStore);
-    platformLayerBackingStore-&gt;setGraphicsSurface(GraphicsSurface::create(state.platformLayerSize, state.platformLayerSurfaceFlags, state.platformLayerToken));
-    layer-&gt;setContentsLayer(platformLayerBackingStore.get());
-}
-
-void CoordinatedGraphicsScene::syncPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    ASSERT(m_textureMapper);
-
-    if (state.platformLayerChanged) {
-        destroyPlatformLayerIfNeeded(layer, state);
-        createPlatformLayerIfNeeded(layer, state);
-    }
-
-    if (state.platformLayerShouldSwapBuffers) {
-        ASSERT(m_surfaceBackingStores.contains(layer));
-        SurfaceBackingStoreMap::iterator it = m_surfaceBackingStores.find(layer);
-        RefPtr&lt;TextureMapperSurfaceBackingStore&gt; platformLayerBackingStore = it-&gt;value;
-        platformLayerBackingStore-&gt;swapBuffersIfNeeded(state.platformLayerFrontBuffer);
-    }
-}
-
-void CoordinatedGraphicsScene::destroyPlatformLayerIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (state.platformLayerToken.isValid())
-        return;
-
-    m_surfaceBackingStores.remove(layer);
-    layer-&gt;setContentsLayer(0);
-}
-#endif
-
-void CoordinatedGraphicsScene::setLayerRepaintCountIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (!layer-&gt;isShowingRepaintCounter() || !state.repaintCountChanged)
-        return;
-
-    layer-&gt;setRepaintCount(state.repaintCount);
-}
-
-void CoordinatedGraphicsScene::setLayerChildrenIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (!state.childrenChanged)
-        return;
-
-    Vector&lt;TextureMapperLayer*&gt; children;
-
-    for (auto&amp; child : state.children) {
-        TextureMapperLayer* childLayer = layerByID(child);
-        children.append(childLayer);
-    }
-    layer-&gt;setChildren(children);
-}
-
-void CoordinatedGraphicsScene::setLayerFiltersIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (!state.filtersChanged)
-        return;
-
-    layer-&gt;setFilters(state.filters);
-}
-
-void CoordinatedGraphicsScene::setLayerState(CoordinatedLayerID id, const CoordinatedGraphicsLayerState&amp; layerState)
-{
-    ASSERT(m_rootLayerID != InvalidCoordinatedLayerID);
-    TextureMapperLayer* layer = layerByID(id);
-
-    if (layerState.positionChanged)
-        layer-&gt;setPosition(layerState.pos);
-
-    if (layerState.anchorPointChanged)
-        layer-&gt;setAnchorPoint(layerState.anchorPoint);
-
-    if (layerState.sizeChanged)
-        layer-&gt;setSize(layerState.size);
-
-    if (layerState.transformChanged)
-        layer-&gt;setTransform(layerState.transform);
-
-    if (layerState.childrenTransformChanged)
-        layer-&gt;setChildrenTransform(layerState.childrenTransform);
-
-    if (layerState.contentsRectChanged)
-        layer-&gt;setContentsRect(layerState.contentsRect);
-
-    if (layerState.contentsTilingChanged) {
-        layer-&gt;setContentsTilePhase(layerState.contentsTilePhase);
-        layer-&gt;setContentsTileSize(layerState.contentsTileSize);
-    }
-
-    if (layerState.opacityChanged)
-        layer-&gt;setOpacity(layerState.opacity);
-
-    if (layerState.solidColorChanged)
-        layer-&gt;setSolidColor(layerState.solidColor);
-
-    if (layerState.debugBorderColorChanged || layerState.debugBorderWidthChanged)
-        layer-&gt;setDebugVisuals(layerState.showDebugBorders, layerState.debugBorderColor, layerState.debugBorderWidth, layerState.showRepaintCounter);
-
-    if (layerState.replicaChanged)
-        layer-&gt;setReplicaLayer(getLayerByIDIfExists(layerState.replica));
-
-    if (layerState.maskChanged)
-        layer-&gt;setMaskLayer(getLayerByIDIfExists(layerState.mask));
-
-    if (layerState.imageChanged)
-        assignImageBackingToLayer(layer, layerState.imageID);
-
-    if (layerState.flagsChanged) {
-        layer-&gt;setContentsOpaque(layerState.contentsOpaque);
-        layer-&gt;setDrawsContent(layerState.drawsContent);
-        layer-&gt;setContentsVisible(layerState.contentsVisible);
-        layer-&gt;setBackfaceVisibility(layerState.backfaceVisible);
-
-        // Never clip the root layer.
-        layer-&gt;setMasksToBounds(id == m_rootLayerID ? false : layerState.masksToBounds);
-        layer-&gt;setPreserves3D(layerState.preserves3D);
-
-        bool fixedToViewportChanged = layer-&gt;fixedToViewport() != layerState.fixedToViewport;
-        layer-&gt;setFixedToViewport(layerState.fixedToViewport);
-        if (fixedToViewportChanged) {
-            if (layerState.fixedToViewport)
-                m_fixedLayers.add(id, layer);
-            else
-                m_fixedLayers.remove(id);
-        }
-
-        layer-&gt;setIsScrollable(layerState.isScrollable);
-    }
-
-    if (layerState.committedScrollOffsetChanged)
-        layer-&gt;didCommitScrollOffset(layerState.committedScrollOffset);
-
-    prepareContentBackingStore(layer);
-
-    // Apply Operations.
-    setLayerChildrenIfNeeded(layer, layerState);
-    createTilesIfNeeded(layer, layerState);
-    removeTilesIfNeeded(layer, layerState);
-    updateTilesIfNeeded(layer, layerState);
-    setLayerFiltersIfNeeded(layer, layerState);
-    setLayerAnimationsIfNeeded(layer, layerState);
-#if USE(GRAPHICS_SURFACE)
-    syncPlatformLayerIfNeeded(layer, layerState);
-#endif
-    setLayerRepaintCountIfNeeded(layer, layerState);
-}
-
-TextureMapperLayer* CoordinatedGraphicsScene::getLayerByIDIfExists(CoordinatedLayerID id)
-{
-    return (id != InvalidCoordinatedLayerID) ? layerByID(id) : 0;
-}
-
-void CoordinatedGraphicsScene::createLayers(const Vector&lt;CoordinatedLayerID&gt;&amp; layerIDs)
-{
-    for (auto&amp; layerID : layerIDs)
-        createLayer(layerID);
-}
-
-void CoordinatedGraphicsScene::createLayer(CoordinatedLayerID id)
-{
-    std::unique_ptr&lt;TextureMapperLayer&gt; newLayer = std::make_unique&lt;TextureMapperLayer&gt;();
-    newLayer-&gt;setID(id);
-    newLayer-&gt;setScrollClient(this);
-    m_layers.add(id, WTF::move(newLayer));
-}
-
-void CoordinatedGraphicsScene::deleteLayers(const Vector&lt;CoordinatedLayerID&gt;&amp; layerIDs)
-{
-    for (auto&amp; layerID : layerIDs)
-        deleteLayer(layerID);
-}
-
-void CoordinatedGraphicsScene::deleteLayer(CoordinatedLayerID layerID)
-{
-    std::unique_ptr&lt;TextureMapperLayer&gt; layer = m_layers.take(layerID);
-    ASSERT(layer);
-
-    m_backingStores.remove(layer.get());
-    m_fixedLayers.remove(layerID);
-#if USE(GRAPHICS_SURFACE)
-    m_surfaceBackingStores.remove(layer.get());
-#endif
-}
-
-void CoordinatedGraphicsScene::setRootLayerID(CoordinatedLayerID layerID)
-{
-    ASSERT(layerID != InvalidCoordinatedLayerID);
-    ASSERT(m_rootLayerID == InvalidCoordinatedLayerID);
-
-    m_rootLayerID = layerID;
-
-    TextureMapperLayer* layer = layerByID(layerID);
-    ASSERT(m_rootLayer-&gt;children().isEmpty());
-    m_rootLayer-&gt;addChild(layer);
-}
-
-void CoordinatedGraphicsScene::prepareContentBackingStore(TextureMapperLayer* layer)
-{
-    if (!layerShouldHaveBackingStore(layer)) {
-        removeBackingStoreIfNeeded(layer);
-        return;
-    }
-
-    createBackingStoreIfNeeded(layer);
-    resetBackingStoreSizeToLayerSize(layer);
-}
-
-void CoordinatedGraphicsScene::createBackingStoreIfNeeded(TextureMapperLayer* layer)
-{
-    if (m_backingStores.contains(layer))
-        return;
-
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore(CoordinatedBackingStore::create());
-    m_backingStores.add(layer, backingStore);
-    layer-&gt;setBackingStore(backingStore);
-}
-
-void CoordinatedGraphicsScene::removeBackingStoreIfNeeded(TextureMapperLayer* layer)
-{
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.take(layer);
-    if (!backingStore)
-        return;
-
-    layer-&gt;setBackingStore(0);
-}
-
-void CoordinatedGraphicsScene::resetBackingStoreSizeToLayerSize(TextureMapperLayer* layer)
-{
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
-    ASSERT(backingStore);
-    backingStore-&gt;setSize(layer-&gt;size());
-    m_backingStoresWithPendingBuffers.add(backingStore);
-}
-
-void CoordinatedGraphicsScene::createTilesIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (state.tilesToCreate.isEmpty())
-        return;
-
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
-    ASSERT(backingStore);
-
-    for (auto&amp; tile : state.tilesToCreate)
-        backingStore-&gt;createTile(tile.tileID, tile.scale);
-}
-
-void CoordinatedGraphicsScene::removeTilesIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (state.tilesToRemove.isEmpty())
-        return;
-
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
-    if (!backingStore)
-        return;
-
-    for (auto&amp; tile : state.tilesToRemove)
-        backingStore-&gt;removeTile(tile);
-
-    m_backingStoresWithPendingBuffers.add(backingStore);
-}
-
-void CoordinatedGraphicsScene::updateTilesIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (state.tilesToUpdate.isEmpty())
-        return;
-
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = m_backingStores.get(layer);
-    ASSERT(backingStore);
-
-    for (auto&amp; tile : state.tilesToUpdate) {
-        const SurfaceUpdateInfo&amp; surfaceUpdateInfo = tile.updateInfo;
-
-        SurfaceMap::iterator surfaceIt = m_surfaces.find(surfaceUpdateInfo.atlasID);
-        ASSERT(surfaceIt != m_surfaces.end());
-
-        backingStore-&gt;updateTile(tile.tileID, surfaceUpdateInfo.updateRect, tile.tileRect, surfaceIt-&gt;value, surfaceUpdateInfo.surfaceOffset);
-        m_backingStoresWithPendingBuffers.add(backingStore);
-    }
-}
-
-void CoordinatedGraphicsScene::syncUpdateAtlases(const CoordinatedGraphicsState&amp; state)
-{
-    for (auto&amp; atlas : state.updateAtlasesToCreate)
-        createUpdateAtlas(atlas.first, atlas.second);
-
-    for (auto&amp; atlas : state.updateAtlasesToRemove)
-        removeUpdateAtlas(atlas);
-}
-
-void CoordinatedGraphicsScene::createUpdateAtlas(uint32_t atlasID, PassRefPtr&lt;CoordinatedSurface&gt; surface)
-{
-    ASSERT(!m_surfaces.contains(atlasID));
-    m_surfaces.add(atlasID, surface);
-}
-
-void CoordinatedGraphicsScene::removeUpdateAtlas(uint32_t atlasID)
-{
-    ASSERT(m_surfaces.contains(atlasID));
-    m_surfaces.remove(atlasID);
-}
-
-void CoordinatedGraphicsScene::syncImageBackings(const CoordinatedGraphicsState&amp; state)
-{
-    for (auto&amp; image : state.imagesToRemove)
-        removeImageBacking(image);
-
-    for (auto&amp; image : state.imagesToCreate)
-        createImageBacking(image);
-
-    for (auto&amp; image : state.imagesToUpdate)
-        updateImageBacking(image.first, image.second);
-
-    for (auto&amp; image : state.imagesToClear)
-        clearImageBackingContents(image);
-}
-
-void CoordinatedGraphicsScene::createImageBacking(CoordinatedImageBackingID imageID)
-{
-    ASSERT(!m_imageBackings.contains(imageID));
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore(CoordinatedBackingStore::create());
-    m_imageBackings.add(imageID, backingStore.release());
-}
-
-void CoordinatedGraphicsScene::updateImageBacking(CoordinatedImageBackingID imageID, PassRefPtr&lt;CoordinatedSurface&gt; surface)
-{
-    ASSERT(m_imageBackings.contains(imageID));
-    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = it-&gt;value;
-
-    // CoordinatedImageBacking is realized to CoordinatedBackingStore with only one tile in UI Process.
-    backingStore-&gt;createTile(1 /* id */, 1 /* scale */);
-    IntRect rect(IntPoint::zero(), surface-&gt;size());
-    // See CoordinatedGraphicsLayer::shouldDirectlyCompositeImage()
-    ASSERT(2000 &gt;= std::max(rect.width(), rect.height()));
-    backingStore-&gt;setSize(rect.size());
-    backingStore-&gt;updateTile(1 /* id */, rect, rect, surface, rect.location());
-
-    m_backingStoresWithPendingBuffers.add(backingStore);
-}
-
-void CoordinatedGraphicsScene::clearImageBackingContents(CoordinatedImageBackingID imageID)
-{
-    ASSERT(m_imageBackings.contains(imageID));
-    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
-    RefPtr&lt;CoordinatedBackingStore&gt; backingStore = it-&gt;value;
-    backingStore-&gt;removeAllTiles();
-    m_backingStoresWithPendingBuffers.add(backingStore);
-}
-
-void CoordinatedGraphicsScene::removeImageBacking(CoordinatedImageBackingID imageID)
-{
-    ASSERT(m_imageBackings.contains(imageID));
-
-    // We don't want TextureMapperLayer refers a dangling pointer.
-    m_releasedImageBackings.append(m_imageBackings.take(imageID));
-}
-
-void CoordinatedGraphicsScene::assignImageBackingToLayer(TextureMapperLayer* layer, CoordinatedImageBackingID imageID)
-{
-#if USE(GRAPHICS_SURFACE)
-    if (m_surfaceBackingStores.contains(layer))
-        return;
-#endif
-
-    if (imageID == InvalidCoordinatedImageBackingID) {
-        layer-&gt;setContentsLayer(0);
-        return;
-    }
-
-    ImageBackingMap::iterator it = m_imageBackings.find(imageID);
-    ASSERT(it != m_imageBackings.end());
-    layer-&gt;setContentsLayer(it-&gt;value.get());
-}
-
-void CoordinatedGraphicsScene::removeReleasedImageBackingsIfNeeded()
-{
-    m_releasedImageBackings.clear();
-}
-
-void CoordinatedGraphicsScene::commitPendingBackingStoreOperations()
-{
-    for (auto&amp; backingStore : m_backingStoresWithPendingBuffers)
-        backingStore-&gt;commitTileOperations(m_textureMapper.get());
-
-    m_backingStoresWithPendingBuffers.clear();
-}
-
-void CoordinatedGraphicsScene::commitSceneState(const CoordinatedGraphicsState&amp; state)
-{
-    m_renderedContentsScrollPosition = state.scrollPosition;
-
-    createLayers(state.layersToCreate);
-    deleteLayers(state.layersToRemove);
-
-    if (state.rootCompositingLayer != m_rootLayerID)
-        setRootLayerID(state.rootCompositingLayer);
-
-    syncImageBackings(state);
-    syncUpdateAtlases(state);
-
-    for (auto&amp; layer : state.layersToUpdate)
-        setLayerState(layer.first, layer.second);
-
-    commitPendingBackingStoreOperations();
-    removeReleasedImageBackingsIfNeeded();
-
-    // The pending tiles state is on its way for the screen, tell the web process to render the next one.
-    RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
-    dispatchOnMainThread([=] {
-        protector-&gt;renderNextFrame();
-    });
-}
-
-void CoordinatedGraphicsScene::renderNextFrame()
-{
-    if (m_client)
-        m_client-&gt;renderNextFrame();
-}
-
-void CoordinatedGraphicsScene::ensureRootLayer()
-{
-    if (m_rootLayer)
-        return;
-
-    m_rootLayer = std::make_unique&lt;TextureMapperLayer&gt;();
-    m_rootLayer-&gt;setMasksToBounds(false);
-    m_rootLayer-&gt;setDrawsContent(false);
-    m_rootLayer-&gt;setAnchorPoint(FloatPoint3D(0, 0, 0));
-
-    // The root layer should not have zero size, or it would be optimized out.
-    m_rootLayer-&gt;setSize(FloatSize(1.0, 1.0));
-
-    ASSERT(m_textureMapper);
-    m_rootLayer-&gt;setTextureMapper(m_textureMapper.get());
-}
-
-void CoordinatedGraphicsScene::syncRemoteContent()
-{
-    // We enqueue messages and execute them during paint, as they require an active GL context.
-    ensureRootLayer();
-
-    Vector&lt;std::function&lt;void()&gt;&gt; renderQueue;
-    bool calledOnMainThread = WTF::isMainThread();
-    if (!calledOnMainThread)
-        m_renderQueueMutex.lock();
-    renderQueue = WTF::move(m_renderQueue);
-    if (!calledOnMainThread)
-        m_renderQueueMutex.unlock();
-
-    for (auto&amp; function : renderQueue)
-        function();
-}
-
-void CoordinatedGraphicsScene::purgeGLResources()
-{
-    m_imageBackings.clear();
-    m_releasedImageBackings.clear();
-#if USE(GRAPHICS_SURFACE)
-    m_surfaceBackingStores.clear();
-#endif
-    m_surfaces.clear();
-
-    m_rootLayer = nullptr;
-    m_rootLayerID = InvalidCoordinatedLayerID;
-    m_layers.clear();
-    m_fixedLayers.clear();
-    m_textureMapper = nullptr;
-    m_backingStores.clear();
-    m_backingStoresWithPendingBuffers.clear();
-
-    setActive(false);
-
-    RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
-    dispatchOnMainThread([=] {
-        protector-&gt;purgeBackingStores();
-    });
-}
-
-void CoordinatedGraphicsScene::dispatchCommitScrollOffset(uint32_t layerID, const IntSize&amp; offset)
-{
-    m_client-&gt;commitScrollOffset(layerID, offset);
-}
-
-void CoordinatedGraphicsScene::commitScrollOffset(uint32_t layerID, const IntSize&amp; offset)
-{
-    RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
-    dispatchOnMainThread([=] {
-        protector-&gt;dispatchCommitScrollOffset(layerID, offset);
-    });
-}
-
-void CoordinatedGraphicsScene::purgeBackingStores()
-{
-    if (m_client)
-        m_client-&gt;purgeBackingStores();
-}
-
-void CoordinatedGraphicsScene::setLayerAnimationsIfNeeded(TextureMapperLayer* layer, const CoordinatedGraphicsLayerState&amp; state)
-{
-    if (!state.animationsChanged)
-        return;
-
-    layer-&gt;setAnimations(state.animations);
-}
-
-void CoordinatedGraphicsScene::detach()
-{
-    ASSERT(isMainThread());
-    m_renderQueue.clear();
-    m_client = 0;
-}
-
-void CoordinatedGraphicsScene::appendUpdate(std::function&lt;void()&gt; function)
-{
-    if (!m_isActive)
-        return;
-
-    ASSERT(isMainThread());
-    MutexLocker locker(m_renderQueueMutex);
-    m_renderQueue.append(WTF::move(function));
-}
-
-void CoordinatedGraphicsScene::setActive(bool active)
-{
-    if (m_isActive == active)
-        return;
-
-    // Have to clear render queue in both cases.
-    // If there are some updates in queue during activation then those updates are from previous instance of paint node
-    // and cannot be applied to the newly created instance.
-    m_renderQueue.clear();
-    m_isActive = active;
-    if (m_isActive) {
-        RefPtr&lt;CoordinatedGraphicsScene&gt; protector(this);
-        dispatchOnMainThread([=] {
-            protector-&gt;renderNextFrame();
-        });
-    }
-}
-
-TextureMapperLayer* CoordinatedGraphicsScene::findScrollableContentsLayerAt(const FloatPoint&amp; point)
-{
-    return rootLayer() ? rootLayer()-&gt;findScrollableContentsLayerAt(point) : 0;
-}
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
</del></span></pre></div>
<a id="trunkSourceWebKit2UIProcessCoordinatedGraphicsCoordinatedGraphicsSceneh"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h (176945 => 176946)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h        2014-12-08 11:34:48 UTC (rev 176945)
+++ trunk/Source/WebKit2/UIProcess/CoordinatedGraphics/CoordinatedGraphicsScene.h        2014-12-08 12:09:30 UTC (rev 176946)
</span><span class="lines">@@ -1,192 +0,0 @@
</span><del>-/*
-    Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies)
-    Copyright (C) 2013 Company 100, Inc.
-
-    This library is free software; you can redistribute it and/or
-    modify it under the terms of the GNU Library General Public
-    License as published by the Free Software Foundation; either
-    version 2 of the License, or (at your option) any later version.
-
-    This library is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-    Library General Public License for more details.
-
-    You should have received a copy of the GNU Library General Public License
-    along with this library; see the file COPYING.LIB.  If not, write to
-    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
-    Boston, MA 02110-1301, USA.
-*/
-
-#ifndef CoordinatedGraphicsScene_h
-#define CoordinatedGraphicsScene_h
-
-#if USE(COORDINATED_GRAPHICS)
-#include &lt;WebCore/CoordinatedGraphicsState.h&gt;
-#include &lt;WebCore/CoordinatedSurface.h&gt;
-#include &lt;WebCore/GraphicsContext.h&gt;
-#include &lt;WebCore/GraphicsLayer.h&gt;
-#include &lt;WebCore/GraphicsLayerAnimation.h&gt;
-#include &lt;WebCore/IntRect.h&gt;
-#include &lt;WebCore/IntSize.h&gt;
-#include &lt;WebCore/TextureMapper.h&gt;
-#include &lt;WebCore/TextureMapperBackingStore.h&gt;
-#include &lt;WebCore/TextureMapperFPSCounter.h&gt;
-#include &lt;WebCore/TextureMapperLayer.h&gt;
-#include &lt;WebCore/Timer.h&gt;
-#include &lt;functional&gt;
-#include &lt;wtf/HashSet.h&gt;
-#include &lt;wtf/ThreadingPrimitives.h&gt;
-#include &lt;wtf/Vector.h&gt;
-
-#if USE(GRAPHICS_SURFACE)
-#include &lt;WebCore/GraphicsSurface.h&gt;
-#include &lt;WebCore/TextureMapperSurfaceBackingStore.h&gt;
-#endif
-
-namespace WebKit {
-
-class CoordinatedBackingStore;
-
-class CoordinatedGraphicsSceneClient {
-public:
-    virtual ~CoordinatedGraphicsSceneClient() { }
-    virtual void purgeBackingStores() = 0;
-    virtual void renderNextFrame() = 0;
-    virtual void updateViewport() = 0;
-    virtual void commitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset) = 0;
-};
-
-class CoordinatedGraphicsScene : public ThreadSafeRefCounted&lt;CoordinatedGraphicsScene&gt;, public WebCore::TextureMapperLayer::ScrollingClient {
-public:
-    explicit CoordinatedGraphicsScene(CoordinatedGraphicsSceneClient*);
-    virtual ~CoordinatedGraphicsScene();
-    void paintToCurrentGLContext(const WebCore::TransformationMatrix&amp;, float, const WebCore::FloatRect&amp;, const WebCore::Color&amp; backgroundColor, bool drawsBackground, const WebCore::FloatPoint&amp;, WebCore::TextureMapper::PaintFlags = 0);
-    void paintToGraphicsContext(PlatformGraphicsContext*, const WebCore::Color&amp; backgroundColor, bool drawsBackground);
-    void detach();
-    void appendUpdate(std::function&lt;void()&gt;);
-
-    WebCore::TextureMapperLayer* findScrollableContentsLayerAt(const WebCore::FloatPoint&amp;);
-
-    virtual void commitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset);
-
-    // The painting thread must lock the main thread to use below two methods, because two methods access members that the main thread manages. See m_client.
-    // Currently, QQuickWebPage::updatePaintNode() locks the main thread before calling both methods.
-    void purgeGLResources();
-
-    bool isActive() const { return m_isActive; }
-    void setActive(bool);
-
-    void commitSceneState(const WebCore::CoordinatedGraphicsState&amp;);
-
-    void setViewBackgroundColor(const WebCore::Color&amp; color) { m_viewBackgroundColor = color; }
-    WebCore::Color viewBackgroundColor() const { return m_viewBackgroundColor; }
-
-private:
-    void setRootLayerID(WebCore::CoordinatedLayerID);
-    void createLayers(const Vector&lt;WebCore::CoordinatedLayerID&gt;&amp;);
-    void deleteLayers(const Vector&lt;WebCore::CoordinatedLayerID&gt;&amp;);
-    void setLayerState(WebCore::CoordinatedLayerID, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void setLayerChildrenIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void updateTilesIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void createTilesIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void removeTilesIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void setLayerFiltersIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void setLayerAnimationsIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-#if USE(GRAPHICS_SURFACE)
-    void createPlatformLayerIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void syncPlatformLayerIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-    void destroyPlatformLayerIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-#endif
-    void setLayerRepaintCountIfNeeded(WebCore::TextureMapperLayer*, const WebCore::CoordinatedGraphicsLayerState&amp;);
-
-    void syncUpdateAtlases(const WebCore::CoordinatedGraphicsState&amp;);
-    void createUpdateAtlas(uint32_t atlasID, PassRefPtr&lt;WebCore::CoordinatedSurface&gt;);
-    void removeUpdateAtlas(uint32_t atlasID);
-
-    void syncImageBackings(const WebCore::CoordinatedGraphicsState&amp;);
-    void createImageBacking(WebCore::CoordinatedImageBackingID);
-    void updateImageBacking(WebCore::CoordinatedImageBackingID, PassRefPtr&lt;WebCore::CoordinatedSurface&gt;);
-    void clearImageBackingContents(WebCore::CoordinatedImageBackingID);
-    void removeImageBacking(WebCore::CoordinatedImageBackingID);
-
-    WebCore::TextureMapperLayer* layerByID(WebCore::CoordinatedLayerID id)
-    {
-        ASSERT(m_layers.contains(id));
-        ASSERT(id != WebCore::InvalidCoordinatedLayerID);
-        return m_layers.get(id);
-    }
-    WebCore::TextureMapperLayer* getLayerByIDIfExists(WebCore::CoordinatedLayerID);
-    WebCore::TextureMapperLayer* rootLayer() { return m_rootLayer.get(); }
-
-    void syncRemoteContent();
-    void adjustPositionForFixedLayers(const WebCore::FloatPoint&amp; contentPosition);
-
-    void dispatchOnMainThread(std::function&lt;void()&gt;);
-    void updateViewport();
-    void renderNextFrame();
-    void purgeBackingStores();
-
-    void createLayer(WebCore::CoordinatedLayerID);
-    void deleteLayer(WebCore::CoordinatedLayerID);
-
-    void assignImageBackingToLayer(WebCore::TextureMapperLayer*, WebCore::CoordinatedImageBackingID);
-    void removeReleasedImageBackingsIfNeeded();
-    void ensureRootLayer();
-    void commitPendingBackingStoreOperations();
-
-    void prepareContentBackingStore(WebCore::TextureMapperLayer*);
-    void createBackingStoreIfNeeded(WebCore::TextureMapperLayer*);
-    void removeBackingStoreIfNeeded(WebCore::TextureMapperLayer*);
-    void resetBackingStoreSizeToLayerSize(WebCore::TextureMapperLayer*);
-
-    void dispatchCommitScrollOffset(uint32_t layerID, const WebCore::IntSize&amp; offset);
-
-    // Render queue can be accessed ony from main thread or updatePaintNode call stack!
-    Vector&lt;std::function&lt;void()&gt;&gt; m_renderQueue;
-    Mutex m_renderQueueMutex;
-
-    std::unique_ptr&lt;WebCore::TextureMapper&gt; m_textureMapper;
-
-    typedef HashMap&lt;WebCore::CoordinatedImageBackingID, RefPtr&lt;CoordinatedBackingStore&gt;&gt; ImageBackingMap;
-    ImageBackingMap m_imageBackings;
-    Vector&lt;RefPtr&lt;CoordinatedBackingStore&gt;&gt; m_releasedImageBackings;
-
-    typedef HashMap&lt;WebCore::TextureMapperLayer*, RefPtr&lt;CoordinatedBackingStore&gt;&gt; BackingStoreMap;
-    BackingStoreMap m_backingStores;
-
-    HashSet&lt;RefPtr&lt;CoordinatedBackingStore&gt;&gt; m_backingStoresWithPendingBuffers;
-
-#if USE(GRAPHICS_SURFACE)
-    typedef HashMap&lt;WebCore::TextureMapperLayer*, RefPtr&lt;WebCore::TextureMapperSurfaceBackingStore&gt;&gt; SurfaceBackingStoreMap;
-    SurfaceBackingStoreMap m_surfaceBackingStores;
-#endif
-
-    typedef HashMap&lt;uint32_t /* atlasID */, RefPtr&lt;WebCore::CoordinatedSurface&gt;&gt; SurfaceMap;
-    SurfaceMap m_surfaces;
-
-    // Below two members are accessed by only the main thread. The painting thread must lock the main thread to access both members.
-    CoordinatedGraphicsSceneClient* m_client;
-    bool m_isActive;
-
-    std::unique_ptr&lt;WebCore::TextureMapperLayer&gt; m_rootLayer;
-
-    typedef HashMap&lt;WebCore::CoordinatedLayerID, std::unique_ptr&lt;WebCore::TextureMapperLayer&gt;&gt; LayerMap;
-    LayerMap m_layers;
-    typedef HashMap&lt;WebCore::CoordinatedLayerID, WebCore::TextureMapperLayer*&gt; LayerRawPtrMap;
-    LayerRawPtrMap m_fixedLayers;
-    WebCore::CoordinatedLayerID m_rootLayerID;
-    WebCore::FloatPoint m_scrollPosition;
-    WebCore::FloatPoint m_renderedContentsScrollPosition;
-    WebCore::Color m_viewBackgroundColor;
-
-    WebCore::TextureMapperFPSCounter m_fpsCounter;
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
-
-#endif // CoordinatedGraphicsScene_h
-
-
</del></span></pre>
</div>
</div>

</body>
</html>