<!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>[202855] 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/202855">202855</a></dd>
<dt>Author</dt> <dd>carlosgc@webkit.org</dd>
<dt>Date</dt> <dd>2016-07-06 04:32:07 -0700 (Wed, 06 Jul 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Duplicated code in DrawingAreaImpl and CoordinatedDrawingArea
https://bugs.webkit.org/show_bug.cgi?id=159259

Reviewed by Žan Doberšek.

It seems that CoordinatedDrawingArea is just a copy paste of DrawingAreaImpl with non-accelerated code path
removed. There's actually nothing (or very little) specific to coordinated graphics in the
CoordinatedDrawingArea implementation. This patch renames CoordinatedDrawingArea as AcceleratedDrawingArea and
makes DrawingAreaImpl inherit from it, so that in case of accelerated compositing the parent class is used, and
DrawingAreaImpl only adds the non accelerated code path.

* PlatformEfl.cmake:
* PlatformGTK.cmake:
* WebProcess/WebPage/AcceleratedDrawingArea.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp.
(WebKit::AcceleratedDrawingArea::~AcceleratedDrawingArea):
(WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
(WebKit::AcceleratedDrawingArea::setNeedsDisplay):
(WebKit::AcceleratedDrawingArea::setNeedsDisplayInRect):
(WebKit::AcceleratedDrawingArea::scroll):
(WebKit::AcceleratedDrawingArea::pageBackgroundTransparencyChanged):
(WebKit::AcceleratedDrawingArea::setLayerTreeStateIsFrozen):
(WebKit::AcceleratedDrawingArea::forceRepaint):
(WebKit::AcceleratedDrawingArea::forceRepaintAsync):
(WebKit::AcceleratedDrawingArea::setPaintingEnabled):
(WebKit::AcceleratedDrawingArea::updatePreferences):
(WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged):
(WebKit::AcceleratedDrawingArea::layerHostDidFlushLayers):
(WebKit::AcceleratedDrawingArea::graphicsLayerFactory):
(WebKit::AcceleratedDrawingArea::setRootCompositingLayer):
(WebKit::AcceleratedDrawingArea::scheduleCompositingLayerFlush):
(WebKit::AcceleratedDrawingArea::scheduleCompositingLayerFlushImmediately):
(WebKit::AcceleratedDrawingArea::updateBackingStoreState):
(WebKit::AcceleratedDrawingArea::sendDidUpdateBackingStoreState):
(WebKit::AcceleratedDrawingArea::suspendPainting):
(WebKit::AcceleratedDrawingArea::resumePainting):
(WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
(WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeSoon):
(WebKit::AcceleratedDrawingArea::didReceiveCoordinatedLayerTreeHostMessage):
(WebKit::AcceleratedDrawingArea::viewStateDidChange):
(WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer):
* WebProcess/WebPage/AcceleratedDrawingArea.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h.
(WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModePending):
(WebKit::AcceleratedDrawingArea::didUpdateBackingStoreState):
(WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingMode):
* WebProcess/WebPage/DrawingArea.cpp:
(WebKit::DrawingArea::create):
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::DrawingAreaImpl):
(WebKit::DrawingAreaImpl::setNeedsDisplay):
(WebKit::DrawingAreaImpl::setNeedsDisplayInRect):
(WebKit::DrawingAreaImpl::scroll):
(WebKit::DrawingAreaImpl::forceRepaint):
(WebKit::DrawingAreaImpl::setRootCompositingLayer):
(WebKit::DrawingAreaImpl::updateBackingStoreState):
(WebKit::DrawingAreaImpl::didUpdateBackingStoreState):
(WebKit::DrawingAreaImpl::sendDidUpdateBackingStoreState):
(WebKit::DrawingAreaImpl::suspendPainting):
(WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
(WebKit::DrawingAreaImpl::~DrawingAreaImpl): Deleted.
(WebKit::DrawingAreaImpl::mainFrameContentSizeChanged): Deleted.
(WebKit::DrawingAreaImpl::updatePreferences): Deleted.
(WebKit::DrawingAreaImpl::didUpdate): Deleted.
(WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Deleted.
(WebKit::DrawingAreaImpl::scheduleDisplay): Deleted.
(WebKit::DrawingAreaImpl::displayTimerFired): Deleted.
(WebKit::DrawingAreaImpl::display): Deleted.
(WebKit::shouldPaintBoundsRect): Deleted.
(WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing): Deleted.
* WebProcess/WebPage/DrawingAreaImpl.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>
<li><a href="#trunkSourceWebKit2PlatformGTKcmake">trunk/Source/WebKit2/PlatformGTK.cmake</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreacpp">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreaImplcpp">trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageDrawingAreaImplh">trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessWebPageAcceleratedDrawingAreacpp">trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageAcceleratedDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h</a></li>
</ul>

<h3>Removed Paths</h3>
<ul>
<li><a href="#trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsCoordinatedDrawingAreacpp">trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp</a></li>
<li><a href="#trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsCoordinatedDrawingAreah">trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceWebKit2ChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/ChangeLog (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/ChangeLog        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/ChangeLog        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -1,3 +1,75 @@
</span><ins>+2016-07-06  Carlos Garcia Campos  &lt;cgarcia@igalia.com&gt;
+
+        Duplicated code in DrawingAreaImpl and CoordinatedDrawingArea
+        https://bugs.webkit.org/show_bug.cgi?id=159259
+
+        Reviewed by Žan Doberšek.
+
+        It seems that CoordinatedDrawingArea is just a copy paste of DrawingAreaImpl with non-accelerated code path
+        removed. There's actually nothing (or very little) specific to coordinated graphics in the
+        CoordinatedDrawingArea implementation. This patch renames CoordinatedDrawingArea as AcceleratedDrawingArea and
+        makes DrawingAreaImpl inherit from it, so that in case of accelerated compositing the parent class is used, and
+        DrawingAreaImpl only adds the non accelerated code path.
+
+        * PlatformEfl.cmake:
+        * PlatformGTK.cmake:
+        * WebProcess/WebPage/AcceleratedDrawingArea.cpp: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp.
+        (WebKit::AcceleratedDrawingArea::~AcceleratedDrawingArea):
+        (WebKit::AcceleratedDrawingArea::AcceleratedDrawingArea):
+        (WebKit::AcceleratedDrawingArea::setNeedsDisplay):
+        (WebKit::AcceleratedDrawingArea::setNeedsDisplayInRect):
+        (WebKit::AcceleratedDrawingArea::scroll):
+        (WebKit::AcceleratedDrawingArea::pageBackgroundTransparencyChanged):
+        (WebKit::AcceleratedDrawingArea::setLayerTreeStateIsFrozen):
+        (WebKit::AcceleratedDrawingArea::forceRepaint):
+        (WebKit::AcceleratedDrawingArea::forceRepaintAsync):
+        (WebKit::AcceleratedDrawingArea::setPaintingEnabled):
+        (WebKit::AcceleratedDrawingArea::updatePreferences):
+        (WebKit::AcceleratedDrawingArea::mainFrameContentSizeChanged):
+        (WebKit::AcceleratedDrawingArea::layerHostDidFlushLayers):
+        (WebKit::AcceleratedDrawingArea::graphicsLayerFactory):
+        (WebKit::AcceleratedDrawingArea::setRootCompositingLayer):
+        (WebKit::AcceleratedDrawingArea::scheduleCompositingLayerFlush):
+        (WebKit::AcceleratedDrawingArea::scheduleCompositingLayerFlushImmediately):
+        (WebKit::AcceleratedDrawingArea::updateBackingStoreState):
+        (WebKit::AcceleratedDrawingArea::sendDidUpdateBackingStoreState):
+        (WebKit::AcceleratedDrawingArea::suspendPainting):
+        (WebKit::AcceleratedDrawingArea::resumePainting):
+        (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
+        (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeSoon):
+        (WebKit::AcceleratedDrawingArea::didReceiveCoordinatedLayerTreeHostMessage):
+        (WebKit::AcceleratedDrawingArea::viewStateDidChange):
+        (WebKit::AcceleratedDrawingArea::attachViewOverlayGraphicsLayer):
+        * WebProcess/WebPage/AcceleratedDrawingArea.h: Renamed from Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h.
+        (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModePending):
+        (WebKit::AcceleratedDrawingArea::didUpdateBackingStoreState):
+        (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingMode):
+        * WebProcess/WebPage/DrawingArea.cpp:
+        (WebKit::DrawingArea::create):
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::DrawingAreaImpl):
+        (WebKit::DrawingAreaImpl::setNeedsDisplay):
+        (WebKit::DrawingAreaImpl::setNeedsDisplayInRect):
+        (WebKit::DrawingAreaImpl::scroll):
+        (WebKit::DrawingAreaImpl::forceRepaint):
+        (WebKit::DrawingAreaImpl::setRootCompositingLayer):
+        (WebKit::DrawingAreaImpl::updateBackingStoreState):
+        (WebKit::DrawingAreaImpl::didUpdateBackingStoreState):
+        (WebKit::DrawingAreaImpl::sendDidUpdateBackingStoreState):
+        (WebKit::DrawingAreaImpl::suspendPainting):
+        (WebKit::DrawingAreaImpl::enterAcceleratedCompositingMode):
+        (WebKit::DrawingAreaImpl::~DrawingAreaImpl): Deleted.
+        (WebKit::DrawingAreaImpl::mainFrameContentSizeChanged): Deleted.
+        (WebKit::DrawingAreaImpl::updatePreferences): Deleted.
+        (WebKit::DrawingAreaImpl::didUpdate): Deleted.
+        (WebKit::DrawingAreaImpl::exitAcceleratedCompositingMode): Deleted.
+        (WebKit::DrawingAreaImpl::scheduleDisplay): Deleted.
+        (WebKit::DrawingAreaImpl::displayTimerFired): Deleted.
+        (WebKit::DrawingAreaImpl::display): Deleted.
+        (WebKit::shouldPaintBoundsRect): Deleted.
+        (WebKit::DrawingAreaImpl::setNativeSurfaceHandleForCompositing): Deleted.
+        * WebProcess/WebPage/DrawingAreaImpl.h:
+
</ins><span class="cx"> 2016-07-06  Youenn Fablet  &lt;youenn@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Refactor NetworkResourceLoadParameters
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformEflcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformEfl.cmake (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformEfl.cmake        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/PlatformEfl.cmake        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -196,11 +196,11 @@
</span><span class="cx"> 
</span><span class="cx">     WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
</span><span class="cx"> 
</span><ins>+    WebProcess/WebPage/AcceleratedDrawingArea.cpp
</ins><span class="cx">     WebProcess/WebPage/DrawingAreaImpl.cpp
</span><span class="cx"> 
</span><span class="cx">     WebProcess/WebPage/CoordinatedGraphics/AreaAllocator.cpp
</span><span class="cx">     WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
</span><del>-    WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp
</del><span class="cx">     WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
</span><span class="cx">     WebProcess/WebPage/CoordinatedGraphics/UpdateAtlas.cpp
</span><span class="cx">     WebProcess/WebPage/CoordinatedGraphics/WebPageCoordinatedGraphics.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2PlatformGTKcmake"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/PlatformGTK.cmake (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/PlatformGTK.cmake        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/PlatformGTK.cmake        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -339,6 +339,7 @@
</span><span class="cx"> 
</span><span class="cx">     WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
</span><span class="cx"> 
</span><ins>+    WebProcess/WebPage/AcceleratedDrawingArea.cpp
</ins><span class="cx">     WebProcess/WebPage/DrawingAreaImpl.cpp
</span><span class="cx"> 
</span><span class="cx">     WebProcess/WebPage/atk/WebPageAccessibilityObjectAtk.cpp
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageAcceleratedDrawingAreacppfromrev202854trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsCoordinatedDrawingAreacpp"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp (from rev 202854, trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp) (0 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.cpp        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -0,0 +1,393 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include &quot;config.h&quot;
+#include &quot;AcceleratedDrawingArea.h&quot;
+
+#include &quot;DrawingAreaProxyMessages.h&quot;
+#include &quot;LayerTreeHost.h&quot;
+#include &quot;UpdateInfo.h&quot;
+#include &quot;WebPage.h&quot;
+#include &quot;WebPageCreationParameters.h&quot;
+#include &quot;WebPreferencesKeys.h&quot;
+#include &lt;WebCore/MainFrame.h&gt;
+#include &lt;WebCore/Page.h&gt;
+#include &lt;WebCore/PageOverlayController.h&gt;
+#include &lt;WebCore/Settings.h&gt;
+
+using namespace WebCore;
+
+namespace WebKit {
+
+AcceleratedDrawingArea::~AcceleratedDrawingArea()
+{
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;invalidate();
+}
+
+AcceleratedDrawingArea::AcceleratedDrawingArea(WebPage&amp; webPage, const WebPageCreationParameters&amp; parameters)
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
+    : DrawingArea(DrawingAreaTypeCoordinated, webPage)
+#else
+    : DrawingArea(DrawingAreaTypeImpl, webPage)
+#endif
+    , m_exitCompositingTimer(RunLoop::main(), this, &amp;AcceleratedDrawingArea::exitAcceleratedCompositingMode)
+{
+    if (!m_webPage.isVisible())
+        suspendPainting();
+}
+
+void AcceleratedDrawingArea::setNeedsDisplay()
+{
+    if (!m_isPaintingEnabled)
+        return;
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;setNonCompositedContentsNeedDisplay();
+}
+
+void AcceleratedDrawingArea::setNeedsDisplayInRect(const IntRect&amp; rect)
+{
+    if (!m_isPaintingEnabled)
+        return;
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;setNonCompositedContentsNeedDisplayInRect(rect);
+}
+
+void AcceleratedDrawingArea::scroll(const IntRect&amp; scrollRect, const IntSize&amp; scrollDelta)
+{
+    if (!m_isPaintingEnabled)
+        return;
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;scrollNonCompositedContents(scrollRect);
+}
+
+void AcceleratedDrawingArea::pageBackgroundTransparencyChanged()
+{
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;pageBackgroundTransparencyChanged();
+}
+
+void AcceleratedDrawingArea::setLayerTreeStateIsFrozen(bool isFrozen)
+{
+    if (m_layerTreeStateIsFrozen == isFrozen)
+        return;
+
+    m_layerTreeStateIsFrozen = isFrozen;
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;setLayerFlushSchedulingEnabled(!isFrozen);
+
+    if (isFrozen)
+        m_exitCompositingTimer.stop();
+    else if (m_wantsToExitAcceleratedCompositingMode)
+        exitAcceleratedCompositingModeSoon();
+}
+
+void AcceleratedDrawingArea::forceRepaint()
+{
+    setNeedsDisplay();
+
+    m_webPage.layoutIfNeeded();
+
+    if (!m_layerTreeHost)
+        return;
+
+    // FIXME: We need to do the same work as the layerHostDidFlushLayers function here,
+    // but clearly it doesn't make sense to call the function with that name.
+    // Consider refactoring and renaming it.
+    if (m_compositingAccordingToProxyMessages)
+        m_layerTreeHost-&gt;forceRepaint();
+    else {
+        // Call setShouldNotifyAfterNextScheduledLayerFlush(false) here to
+        // prevent layerHostDidFlushLayers() from being called a second time.
+        m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(false);
+        layerHostDidFlushLayers();
+    }
+}
+
+bool AcceleratedDrawingArea::forceRepaintAsync(uint64_t callbackID)
+{
+    return m_layerTreeHost &amp;&amp; m_layerTreeHost-&gt;forceRepaintAsync(callbackID);
+}
+
+void AcceleratedDrawingArea::setPaintingEnabled(bool paintingEnabled)
+{
+    m_isPaintingEnabled = paintingEnabled;
+}
+
+void AcceleratedDrawingArea::updatePreferences(const WebPreferencesStore&amp; store)
+{
+    m_webPage.corePage()-&gt;settings().setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()));
+    if (!m_layerTreeHost)
+        enterAcceleratedCompositingMode(nullptr);
+}
+
+void AcceleratedDrawingArea::mainFrameContentSizeChanged(const IntSize&amp; size)
+{
+    if (m_webPage.useFixedLayout() &amp;&amp; m_layerTreeHost)
+        m_layerTreeHost-&gt;sizeDidChange(size);
+    m_webPage.mainFrame()-&gt;pageOverlayController().didChangeDocumentSize();
+}
+
+void AcceleratedDrawingArea::layerHostDidFlushLayers()
+{
+    ASSERT(m_layerTreeHost);
+    m_layerTreeHost-&gt;forceRepaint();
+
+    if (m_shouldSendDidUpdateBackingStoreState &amp;&amp; !exitAcceleratedCompositingModePending()) {
+        sendDidUpdateBackingStoreState();
+        return;
+    }
+
+    ASSERT(!m_compositingAccordingToProxyMessages);
+    if (!exitAcceleratedCompositingModePending()) {
+        m_webPage.send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(m_backingStoreStateID, m_layerTreeHost-&gt;layerTreeContext()));
+        m_compositingAccordingToProxyMessages = true;
+    }
+}
+
+GraphicsLayerFactory* AcceleratedDrawingArea::graphicsLayerFactory()
+{
+    return m_layerTreeHost ? m_layerTreeHost-&gt;graphicsLayerFactory() : nullptr;
+}
+
+void AcceleratedDrawingArea::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+    ASSERT(m_layerTreeHost);
+
+    // FIXME: Instead of using nested if statements, we should keep a compositing state
+    // enum in the AcceleratedDrawingArea object and have a changeAcceleratedCompositingState function
+    // that takes the new state.
+
+    if (graphicsLayer) {
+        // We're already in accelerated compositing mode, but the root compositing layer changed.
+
+        m_exitCompositingTimer.stop();
+        m_wantsToExitAcceleratedCompositingMode = false;
+
+        // If we haven't sent the EnterAcceleratedCompositingMode message, make sure that the
+        // layer tree host calls us back after the next layer flush so we can send it then.
+        if (!m_compositingAccordingToProxyMessages)
+            m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(true);
+    }
+    m_layerTreeHost-&gt;setRootCompositingLayer(graphicsLayer);
+}
+
+void AcceleratedDrawingArea::scheduleCompositingLayerFlush()
+{
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;scheduleLayerFlush();
+}
+
+void AcceleratedDrawingArea::scheduleCompositingLayerFlushImmediately()
+{
+    scheduleCompositingLayerFlush();
+}
+
+void AcceleratedDrawingArea::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const IntSize&amp; size, const IntSize&amp; scrollOffset)
+{
+    ASSERT(!m_inUpdateBackingStoreState);
+    m_inUpdateBackingStoreState = true;
+
+    ASSERT_ARG(stateID, stateID &gt;= m_backingStoreStateID);
+    if (stateID != m_backingStoreStateID) {
+        m_backingStoreStateID = stateID;
+        m_shouldSendDidUpdateBackingStoreState = true;
+
+        m_webPage.setDeviceScaleFactor(deviceScaleFactor);
+        m_webPage.setSize(size);
+        m_webPage.layoutIfNeeded();
+        m_webPage.scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
+
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
+        // Coordinated Graphics sets the size of the root layer to contents size.
+        if (!m_webPage.useFixedLayout())
+            m_layerTreeHost-&gt;sizeDidChange(m_webPage.size());
+#else
+        if (m_layerTreeHost)
+            m_layerTreeHost-&gt;sizeDidChange(m_webPage.size());
+#endif
+    } else {
+        ASSERT(size == m_webPage.size());
+        if (!m_shouldSendDidUpdateBackingStoreState) {
+            // We've already sent a DidUpdateBackingStoreState message for this state. We have nothing more to do.
+            m_inUpdateBackingStoreState = false;
+            return;
+        }
+    }
+
+    didUpdateBackingStoreState();
+
+    if (respondImmediately) {
+        // Make sure to resume painting if we're supposed to respond immediately, otherwise we'll just
+        // send back an empty UpdateInfo struct.
+        if (m_isPaintingSuspended)
+            resumePainting();
+
+        sendDidUpdateBackingStoreState();
+    }
+
+    m_inUpdateBackingStoreState = false;
+}
+
+void AcceleratedDrawingArea::sendDidUpdateBackingStoreState()
+{
+    ASSERT(m_shouldSendDidUpdateBackingStoreState);
+
+    m_shouldSendDidUpdateBackingStoreState = false;
+
+    UpdateInfo updateInfo;
+    updateInfo.viewSize = m_webPage.size();
+    updateInfo.deviceScaleFactor = m_webPage.corePage()-&gt;deviceScaleFactor();
+
+    LayerTreeContext layerTreeContext;
+    if (m_layerTreeHost) {
+        layerTreeContext = m_layerTreeHost-&gt;layerTreeContext();
+
+        // We don't want the layer tree host to notify after the next scheduled
+        // layer flush because that might end up sending an EnterAcceleratedCompositingMode
+        // message back to the UI process, but the updated layer tree context
+        // will be sent back in the DidUpdateBackingStoreState message.
+        m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(false);
+        m_layerTreeHost-&gt;forceRepaint();
+    }
+
+    m_webPage.send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext));
+    m_compositingAccordingToProxyMessages = !layerTreeContext.isEmpty();
+}
+
+void AcceleratedDrawingArea::suspendPainting()
+{
+    ASSERT(!m_isPaintingSuspended);
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;pauseRendering();
+
+    m_isPaintingSuspended = true;
+
+    m_webPage.corePage()-&gt;suspendScriptedAnimations();
+}
+
+void AcceleratedDrawingArea::resumePainting()
+{
+    if (!m_isPaintingSuspended) {
+        // FIXME: We can get a call to resumePainting when painting is not suspended.
+        // This happens when sending a synchronous message to create a new page. See &lt;rdar://problem/8976531&gt;.
+        return;
+    }
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;resumeRendering();
+
+    m_isPaintingSuspended = false;
+
+    // FIXME: We shouldn't always repaint everything here.
+    setNeedsDisplay();
+
+    m_webPage.corePage()-&gt;resumeScriptedAnimations();
+}
+
+void AcceleratedDrawingArea::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
+{
+    m_exitCompositingTimer.stop();
+    m_wantsToExitAcceleratedCompositingMode = false;
+
+    m_webPage.send(Messages::DrawingAreaProxy::WillEnterAcceleratedCompositingMode(m_backingStoreStateID));
+
+    ASSERT(!m_layerTreeHost);
+    m_layerTreeHost = LayerTreeHost::create(m_webPage);
+#if PLATFORM(GTK) &amp;&amp; USE(TEXTURE_MAPPER)
+    if (m_nativeSurfaceHandleForCompositing)
+        m_layerTreeHost-&gt;setNativeSurfaceHandleForCompositing(m_nativeSurfaceHandleForCompositing);
+#endif
+    if (!m_inUpdateBackingStoreState)
+        m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(true);
+    if (m_isPaintingSuspended)
+        m_layerTreeHost-&gt;pauseRendering();
+
+    m_layerTreeHost-&gt;setRootCompositingLayer(graphicsLayer);
+}
+
+void AcceleratedDrawingArea::exitAcceleratedCompositingModeSoon()
+{
+    if (m_layerTreeStateIsFrozen) {
+        m_wantsToExitAcceleratedCompositingMode = true;
+        return;
+    }
+
+    if (exitAcceleratedCompositingModePending())
+        return;
+
+    m_exitCompositingTimer.startOneShot(0);
+}
+
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
+void AcceleratedDrawingArea::didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&amp; connection, IPC::MessageDecoder&amp; decoder)
+{
+    m_layerTreeHost-&gt;didReceiveCoordinatedLayerTreeHostMessage(connection, decoder);
+}
+#endif
+
+#if PLATFORM(GTK) &amp;&amp; USE(TEXTURE_MAPPER)
+void AcceleratedDrawingArea::setNativeSurfaceHandleForCompositing(uint64_t handle)
+{
+    m_nativeSurfaceHandleForCompositing = handle;
+    if (m_layerTreeHost) {
+        m_webPage.corePage()-&gt;settings().setAcceleratedCompositingEnabled(true);
+        m_layerTreeHost-&gt;setNativeSurfaceHandleForCompositing(handle);
+    }
+}
+
+void AcceleratedDrawingArea::destroyNativeSurfaceHandleForCompositing(bool&amp; handled)
+{
+    handled = true;
+    setNativeSurfaceHandleForCompositing(0);
+}
+#endif
+
+void AcceleratedDrawingArea::viewStateDidChange(ViewState::Flags changed, bool, const Vector&lt;uint64_t&gt;&amp;)
+{
+    if (changed &amp; ViewState::IsVisible) {
+        if (m_webPage.isVisible())
+            resumePainting();
+        else
+            suspendPainting();
+    }
+}
+
+void AcceleratedDrawingArea::attachViewOverlayGraphicsLayer(Frame* frame, GraphicsLayer* viewOverlayRootLayer)
+{
+    if (!frame-&gt;isMainFrame())
+        return;
+
+    if (m_layerTreeHost)
+        m_layerTreeHost-&gt;setViewOverlayRootLayer(viewOverlayRootLayer);
+}
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageAcceleratedDrawingAreahfromrev202854trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsCoordinatedDrawingAreah"></a>
<div class="copfile"><h4>Copied: trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h (from rev 202854, trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h) (0 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h                                (rev 0)
+++ trunk/Source/WebKit2/WebProcess/WebPage/AcceleratedDrawingArea.h        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -0,0 +1,124 @@
</span><ins>+/*
+ * Copyright (C) 2011 Apple Inc. All rights reserved.
+ * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+ * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+ * THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#pragma once
+
+#include &quot;DrawingArea.h&quot;
+#include &lt;wtf/RunLoop.h&gt;
+
+namespace WebKit {
+
+class LayerTreeHost;
+
+class AcceleratedDrawingArea : public DrawingArea {
+public:
+    AcceleratedDrawingArea(WebPage&amp;, const WebPageCreationParameters&amp;);
+    virtual ~AcceleratedDrawingArea();
+
+protected:
+    // DrawingArea
+    void setNeedsDisplay() override;
+    void setNeedsDisplayInRect(const WebCore::IntRect&amp;) override;
+    void scroll(const WebCore::IntRect&amp; scrollRect, const WebCore::IntSize&amp; scrollDelta) override;
+    void pageBackgroundTransparencyChanged() override;
+    void setLayerTreeStateIsFrozen(bool) override;
+    bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; }
+    LayerTreeHost* layerTreeHost() const override { return m_layerTreeHost.get(); }
+    void forceRepaint() override;
+    bool forceRepaintAsync(uint64_t callbackID) override;
+
+    void setPaintingEnabled(bool) override;
+    void updatePreferences(const WebPreferencesStore&amp;) override;
+    void mainFrameContentSizeChanged(const WebCore::IntSize&amp;) override;
+
+    WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
+    void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
+    void scheduleCompositingLayerFlush() override;
+    void scheduleCompositingLayerFlushImmediately() override;
+
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
+    void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
+#endif
+
+#if PLATFORM(GTK) &amp;&amp; USE(TEXTURE_MAPPER)
+    void setNativeSurfaceHandleForCompositing(uint64_t) override;
+    void destroyNativeSurfaceHandleForCompositing(bool&amp;) override;
+#endif
+
+    void viewStateDidChange(WebCore::ViewState::Flags, bool /* wantsDidUpdateViewState */, const Vector&lt;uint64_t&gt;&amp; /* callbackIDs */) override;
+    void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
+
+    void layerHostDidFlushLayers() override;
+
+    // IPC message handlers.
+    void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&amp;, const WebCore::IntSize&amp; scrollOffset) override;
+
+    void exitAcceleratedCompositingModeSoon();
+    bool exitAcceleratedCompositingModePending() const { return m_exitCompositingTimer.isActive(); }
+
+    virtual void suspendPainting();
+    virtual void resumePainting();
+
+    virtual void sendDidUpdateBackingStoreState();
+    virtual void didUpdateBackingStoreState() { }
+
+    virtual void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
+    virtual void exitAcceleratedCompositingMode() { }
+
+    uint64_t m_backingStoreStateID { 0 };
+
+    // Whether painting is enabled. If painting is disabled, any calls to setNeedsDisplay and scroll are ignored.
+    bool m_isPaintingEnabled { true };
+
+    // Whether we're currently processing an UpdateBackingStoreState message.
+    bool m_inUpdateBackingStoreState { false };
+
+    // When true, we should send an UpdateBackingStoreState message instead of any other messages
+    // we normally send to the UI process.
+    bool m_shouldSendDidUpdateBackingStoreState { false };
+
+    // True between sending the 'enter compositing' messages, and the 'exit compositing' message.
+    bool m_compositingAccordingToProxyMessages { false };
+
+    // When true, we maintain the layer tree in its current state by not leaving accelerated compositing mode
+    // and not scheduling layer flushes.
+    bool m_layerTreeStateIsFrozen { false };
+
+    // True when we were asked to exit accelerated compositing mode but couldn't because layer tree
+    // state was frozen.
+    bool m_wantsToExitAcceleratedCompositingMode { false };
+
+    // Whether painting is suspended. We'll still keep track of the dirty region but we
+    // won't paint until painting has resumed again.
+    bool m_isPaintingSuspended { false };
+
+    RunLoop::Timer&lt;AcceleratedDrawingArea&gt; m_exitCompositingTimer;
+
+    // The layer tree host that handles accelerated compositing.
+    RefPtr&lt;LayerTreeHost&gt; m_layerTreeHost;
+};
+
+} // namespace WebKit
</ins></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsCoordinatedDrawingAreacpp"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -1,355 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include &quot;config.h&quot;
-
-#if USE(COORDINATED_GRAPHICS)
-#include &quot;CoordinatedDrawingArea.h&quot;
-
-#include &quot;CoordinatedLayerTreeHost.h&quot;
-#include &quot;DrawingAreaProxyMessages.h&quot;
-#include &quot;LayerTreeContext.h&quot;
-#include &quot;PageOverlayController.h&quot;
-#include &quot;ShareableBitmap.h&quot;
-#include &quot;UpdateInfo.h&quot;
-#include &quot;WebPage.h&quot;
-#include &quot;WebPageCreationParameters.h&quot;
-#include &quot;WebPreferencesKeys.h&quot;
-#include &quot;WebProcess.h&quot;
-#include &lt;WebCore/GraphicsContext.h&gt;
-#include &lt;WebCore/MainFrame.h&gt;
-#include &lt;WebCore/Page.h&gt;
-#include &lt;WebCore/PageOverlayController.h&gt;
-#include &lt;WebCore/Settings.h&gt;
-
-using namespace WebCore;
-
-namespace WebKit {
-
-CoordinatedDrawingArea::~CoordinatedDrawingArea()
-{
-    m_layerTreeHost-&gt;invalidate();
-}
-
-CoordinatedDrawingArea::CoordinatedDrawingArea(WebPage&amp; webPage, const WebPageCreationParameters&amp; parameters)
-    : DrawingArea(DrawingAreaTypeCoordinated, webPage)
-    , m_backingStoreStateID(0)
-    , m_isPaintingEnabled(true)
-    , m_inUpdateBackingStoreState(false)
-    , m_shouldSendDidUpdateBackingStoreState(false)
-    , m_compositingAccordingToProxyMessages(false)
-    , m_layerTreeStateIsFrozen(false)
-    , m_wantsToExitAcceleratedCompositingMode(false)
-    , m_isPaintingSuspended(false)
-    , m_exitCompositingTimer(RunLoop::main(), this, &amp;CoordinatedDrawingArea::exitAcceleratedCompositingMode)
-{
-    // Always use compositing in CoordinatedGraphics
-    enterAcceleratedCompositingMode(0);
-
-    if (!(parameters.viewState &amp; ViewState::IsVisible))
-        suspendPainting();
-}
-
-void CoordinatedDrawingArea::setNeedsDisplay()
-{
-    if (!m_isPaintingEnabled)
-        return;
-
-    m_layerTreeHost-&gt;setNonCompositedContentsNeedDisplay();
-}
-
-void CoordinatedDrawingArea::setNeedsDisplayInRect(const IntRect&amp; rect)
-{
-    if (!m_isPaintingEnabled)
-        return;
-
-    m_layerTreeHost-&gt;setNonCompositedContentsNeedDisplayInRect(rect);
-}
-
-void CoordinatedDrawingArea::scroll(const IntRect&amp; scrollRect, const IntSize&amp; scrollDelta)
-{
-    if (!m_isPaintingEnabled)
-        return;
-
-    m_layerTreeHost-&gt;scrollNonCompositedContents(scrollRect);
-}
-
-void CoordinatedDrawingArea::pageBackgroundTransparencyChanged()
-{
-    m_layerTreeHost-&gt;pageBackgroundTransparencyChanged();
-}
-
-void CoordinatedDrawingArea::setLayerTreeStateIsFrozen(bool isFrozen)
-{
-    if (m_layerTreeStateIsFrozen == isFrozen)
-        return;
-
-    m_layerTreeStateIsFrozen = isFrozen;
-
-    m_layerTreeHost-&gt;setLayerFlushSchedulingEnabled(!isFrozen);
-
-    if (isFrozen)
-        m_exitCompositingTimer.stop();
-    else if (m_wantsToExitAcceleratedCompositingMode)
-        exitAcceleratedCompositingModeSoon();
-}
-
-void CoordinatedDrawingArea::forceRepaint()
-{
-    setNeedsDisplay();
-
-    m_webPage.layoutIfNeeded();
-
-    // FIXME: We need to do the same work as the layerHostDidFlushLayers function here,
-    // but clearly it doesn't make sense to call the function with that name.
-    // Consider refactoring and renaming it.
-    if (m_compositingAccordingToProxyMessages)
-        m_layerTreeHost-&gt;forceRepaint();
-    else {
-        // Call setShouldNotifyAfterNextScheduledLayerFlush(false) here to
-        // prevent layerHostDidFlushLayers() from being called a second time.
-        m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(false);
-        layerHostDidFlushLayers();
-    }
-}
-
-bool CoordinatedDrawingArea::forceRepaintAsync(uint64_t callbackID)
-{
-    return m_layerTreeHost-&gt;forceRepaintAsync(callbackID);
-}
-
-void CoordinatedDrawingArea::setPaintingEnabled(bool paintingEnabled)
-{
-    m_isPaintingEnabled = paintingEnabled;
-}
-
-void CoordinatedDrawingArea::updatePreferences(const WebPreferencesStore&amp; store)
-{
-    m_webPage.corePage()-&gt;settings().setForceCompositingMode(store.getBoolValueForKey(WebPreferencesKey::forceCompositingModeKey()));
-}
-
-void CoordinatedDrawingArea::mainFrameContentSizeChanged(const WebCore::IntSize&amp; size)
-{
-    if (m_webPage.useFixedLayout())
-        m_layerTreeHost-&gt;sizeDidChange(size);
-    m_webPage.mainFrame()-&gt;pageOverlayController().didChangeDocumentSize();
-}
-
-void CoordinatedDrawingArea::layerHostDidFlushLayers()
-{
-    m_layerTreeHost-&gt;forceRepaint();
-
-    if (m_shouldSendDidUpdateBackingStoreState &amp;&amp; !exitAcceleratedCompositingModePending()) {
-        sendDidUpdateBackingStoreState();
-        return;
-    }
-
-    ASSERT(!m_compositingAccordingToProxyMessages);
-    if (!exitAcceleratedCompositingModePending()) {
-        m_webPage.send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(m_backingStoreStateID, m_layerTreeHost-&gt;layerTreeContext()));
-        m_compositingAccordingToProxyMessages = true;
-    }
-}
-
-GraphicsLayerFactory* CoordinatedDrawingArea::graphicsLayerFactory()
-{
-    return m_layerTreeHost-&gt;graphicsLayerFactory();
-}
-
-void CoordinatedDrawingArea::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
-{
-    // FIXME: Instead of using nested if statements, we should keep a compositing state
-    // enum in the CoordinatedDrawingArea object and have a changeAcceleratedCompositingState function
-    // that takes the new state.
-
-    if (graphicsLayer) {
-        // We're already in accelerated compositing mode, but the root compositing layer changed.
-
-        m_exitCompositingTimer.stop();
-        m_wantsToExitAcceleratedCompositingMode = false;
-
-        // If we haven't sent the EnterAcceleratedCompositingMode message, make sure that the
-        // layer tree host calls us back after the next layer flush so we can send it then.
-        if (!m_compositingAccordingToProxyMessages)
-            m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(true);
-    }
-    m_layerTreeHost-&gt;setRootCompositingLayer(graphicsLayer);
-}
-
-void CoordinatedDrawingArea::scheduleCompositingLayerFlush()
-{
-    m_layerTreeHost-&gt;scheduleLayerFlush();
-}
-
-void CoordinatedDrawingArea::scheduleCompositingLayerFlushImmediately()
-{
-    scheduleCompositingLayerFlush();
-}
-
-void CoordinatedDrawingArea::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&amp; size, const WebCore::IntSize&amp; scrollOffset)
-{
-    ASSERT(!m_inUpdateBackingStoreState);
-    m_inUpdateBackingStoreState = true;
-
-    ASSERT_ARG(stateID, stateID &gt;= m_backingStoreStateID);
-    if (stateID != m_backingStoreStateID) {
-        m_backingStoreStateID = stateID;
-        m_shouldSendDidUpdateBackingStoreState = true;
-
-        m_webPage.setDeviceScaleFactor(deviceScaleFactor);
-        m_webPage.setSize(size);
-        m_webPage.layoutIfNeeded();
-        m_webPage.scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
-
-        // Coordinated Graphics sets the size of the root layer to contents size.
-        if (!m_webPage.useFixedLayout())
-            m_layerTreeHost-&gt;sizeDidChange(m_webPage.size());
-    } else {
-        ASSERT(size == m_webPage.size());
-        if (!m_shouldSendDidUpdateBackingStoreState) {
-            // We've already sent a DidUpdateBackingStoreState message for this state. We have nothing more to do.
-            m_inUpdateBackingStoreState = false;
-            return;
-        }
-    }
-
-    if (respondImmediately) {
-        // Make sure to resume painting if we're supposed to respond immediately, otherwise we'll just
-        // send back an empty UpdateInfo struct.
-        if (m_isPaintingSuspended)
-            resumePainting();
-
-        sendDidUpdateBackingStoreState();
-    }
-
-    m_inUpdateBackingStoreState = false;
-}
-
-void CoordinatedDrawingArea::sendDidUpdateBackingStoreState()
-{
-    ASSERT(m_shouldSendDidUpdateBackingStoreState);
-
-    m_shouldSendDidUpdateBackingStoreState = false;
-
-    UpdateInfo updateInfo;
-
-    LayerTreeContext layerTreeContext;
-
-    updateInfo.viewSize = m_webPage.size();
-    updateInfo.deviceScaleFactor = m_webPage.corePage()-&gt;deviceScaleFactor();
-
-    layerTreeContext = m_layerTreeHost-&gt;layerTreeContext();
-
-    // We don't want the layer tree host to notify after the next scheduled
-    // layer flush because that might end up sending an EnterAcceleratedCompositingMode
-    // message back to the UI process, but the updated layer tree context
-    // will be sent back in the DidUpdateBackingStoreState message.
-    m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(false);
-    m_layerTreeHost-&gt;forceRepaint();
-
-    m_webPage.send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext));
-    m_compositingAccordingToProxyMessages = !layerTreeContext.isEmpty();
-}
-
-void CoordinatedDrawingArea::suspendPainting()
-{
-    ASSERT(!m_isPaintingSuspended);
-
-    m_layerTreeHost-&gt;pauseRendering();
-
-    m_isPaintingSuspended = true;
-
-    m_webPage.corePage()-&gt;suspendScriptedAnimations();
-}
-
-void CoordinatedDrawingArea::resumePainting()
-{
-    if (!m_isPaintingSuspended) {
-        // FIXME: We can get a call to resumePainting when painting is not suspended.
-        // This happens when sending a synchronous message to create a new page. See &lt;rdar://problem/8976531&gt;.
-        return;
-    }
-
-    m_layerTreeHost-&gt;resumeRendering();
-
-    m_isPaintingSuspended = false;
-
-    // FIXME: We shouldn't always repaint everything here.
-    setNeedsDisplay();
-
-    m_webPage.corePage()-&gt;resumeScriptedAnimations();
-}
-
-void CoordinatedDrawingArea::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
-{
-    m_exitCompositingTimer.stop();
-    m_wantsToExitAcceleratedCompositingMode = false;
-
-    m_layerTreeHost = LayerTreeHost::create(m_webPage);
-    if (!m_inUpdateBackingStoreState)
-        m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(true);
-
-    m_layerTreeHost-&gt;setRootCompositingLayer(graphicsLayer);
-}
-
-void CoordinatedDrawingArea::exitAcceleratedCompositingModeSoon()
-{
-    if (m_layerTreeStateIsFrozen) {
-        m_wantsToExitAcceleratedCompositingMode = true;
-        return;
-    }
-
-    if (exitAcceleratedCompositingModePending())
-        return;
-
-    m_exitCompositingTimer.startOneShot(0);
-}
-
-void CoordinatedDrawingArea::didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&amp; connection, IPC::MessageDecoder&amp; decoder)
-{
-    m_layerTreeHost-&gt;didReceiveCoordinatedLayerTreeHostMessage(connection, decoder);
-}
-
-void CoordinatedDrawingArea::viewStateDidChange(ViewState::Flags changed, bool, const Vector&lt;uint64_t&gt;&amp;)
-{
-    if (changed &amp; ViewState::IsVisible) {
-        if (m_webPage.isVisible())
-            resumePainting();
-        else
-            suspendPainting();
-    }
-}
-
-void CoordinatedDrawingArea::attachViewOverlayGraphicsLayer(WebCore::Frame* frame, WebCore::GraphicsLayer* viewOverlayRootLayer)
-{
-    if (!frame-&gt;isMainFrame())
-        return;
-
-    m_layerTreeHost-&gt;setViewOverlayRootLayer(viewOverlayRootLayer);
-}
-
-} // namespace WebKit
-#endif // USE(COORDINATED_GRAPHICS)
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageCoordinatedGraphicsCoordinatedDrawingAreah"></a>
<div class="delfile"><h4>Deleted: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -1,121 +0,0 @@
</span><del>-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2013 Nokia Corporation and/or its subsidiary(-ies).
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
- * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
- * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
- * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
- * THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef CoordinatedDrawingArea_h
-#define CoordinatedDrawingArea_h
-
-#if USE(COORDINATED_GRAPHICS)
-
-#include &quot;DrawingArea.h&quot;
-#include &quot;LayerTreeHost.h&quot;
-#include &lt;WebCore/Region.h&gt;
-#include &lt;wtf/RunLoop.h&gt;
-
-namespace WebKit {
-
-class CoordinatedDrawingArea : public DrawingArea {
-public:
-    CoordinatedDrawingArea(WebPage&amp;, const WebPageCreationParameters&amp;);
-    virtual ~CoordinatedDrawingArea();
-
-private:
-    // DrawingArea
-    void setNeedsDisplay() override;
-    void setNeedsDisplayInRect(const WebCore::IntRect&amp;) override;
-    void scroll(const WebCore::IntRect&amp; scrollRect, const WebCore::IntSize&amp; scrollDelta) override;
-    void pageBackgroundTransparencyChanged() override;
-    void setLayerTreeStateIsFrozen(bool) override;
-    bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; }
-    LayerTreeHost* layerTreeHost() const override { return m_layerTreeHost.get(); }
-    void forceRepaint() override;
-    bool forceRepaintAsync(uint64_t callbackID) override;
-
-    void setPaintingEnabled(bool) override;
-    void updatePreferences(const WebPreferencesStore&amp;) override;
-    void mainFrameContentSizeChanged(const WebCore::IntSize&amp;) override;
-
-    WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
-    void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
-    void scheduleCompositingLayerFlush() override;
-    void scheduleCompositingLayerFlushImmediately() override;
-
-    void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&amp;, IPC::MessageDecoder&amp;) override;
-
-    void viewStateDidChange(WebCore::ViewState::Flags, bool /* wantsDidUpdateViewState */, const Vector&lt;uint64_t&gt;&amp; /* callbackIDs */) override;
-    void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
-
-    void layerHostDidFlushLayers() override;
-
-    // IPC message handlers.
-    void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&amp;, const WebCore::IntSize&amp; scrollOffset) override;
-    virtual void suspendPainting();
-    virtual void resumePainting();
-
-    void sendDidUpdateBackingStoreState();
-
-    void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
-    void exitAcceleratedCompositingModeSoon();
-    bool exitAcceleratedCompositingModePending() const { return m_exitCompositingTimer.isActive(); }
-    void exitAcceleratedCompositingMode() { }
-
-    uint64_t m_backingStoreStateID;
-
-    // Whether painting is enabled. If painting is disabled, any calls to setNeedsDisplay and scroll are ignored.
-    bool m_isPaintingEnabled;
-
-    // Whether we're currently processing an UpdateBackingStoreState message.
-    bool m_inUpdateBackingStoreState;
-
-    // When true, we should send an UpdateBackingStoreState message instead of any other messages
-    // we normally send to the UI process.
-    bool m_shouldSendDidUpdateBackingStoreState;
-
-    // True between sending the 'enter compositing' messages, and the 'exit compositing' message.
-    bool m_compositingAccordingToProxyMessages;
-
-    // When true, we maintain the layer tree in its current state by not leaving accelerated compositing mode
-    // and not scheduling layer flushes.
-    bool m_layerTreeStateIsFrozen;
-
-    // True when we were asked to exit accelerated compositing mode but couldn't because layer tree
-    // state was frozen.
-    bool m_wantsToExitAcceleratedCompositingMode;
-
-    // Whether painting is suspended. We'll still keep track of the dirty region but we
-    // won't paint until painting has resumed again.
-    bool m_isPaintingSuspended;
-
-    RunLoop::Timer&lt;CoordinatedDrawingArea&gt; m_exitCompositingTimer;
-
-    // The layer tree host that handles accelerated compositing.
-    RefPtr&lt;LayerTreeHost&gt; m_layerTreeHost;
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
-
-#endif // CoordinatedDrawingArea_h
</del></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreacpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.cpp        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -39,7 +39,7 @@
</span><span class="cx"> #include &quot;TiledCoreAnimationDrawingArea.h&quot;
</span><span class="cx"> #else
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
</span><del>-#include &quot;CoordinatedDrawingArea.h&quot;
</del><ins>+#include &quot;AcceleratedDrawingArea.h&quot;
</ins><span class="cx"> #else
</span><span class="cx"> #include &quot;DrawingAreaImpl.h&quot;
</span><span class="cx"> #endif
</span><span class="lines">@@ -62,7 +62,7 @@
</span><span class="cx"> #else
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
</span><span class="cx">     case DrawingAreaTypeCoordinated:
</span><del>-        return std::make_unique&lt;CoordinatedDrawingArea&gt;(webPage, parameters);
</del><ins>+        return std::make_unique&lt;AcceleratedDrawingArea&gt;(webPage, parameters);
</ins><span class="cx"> #else
</span><span class="cx">     case DrawingAreaTypeImpl:
</span><span class="cx">         return std::make_unique&lt;DrawingAreaImpl&gt;(webPage, parameters);
</span><span class="lines">@@ -76,9 +76,6 @@
</span><span class="cx"> DrawingArea::DrawingArea(DrawingAreaType type, WebPage&amp; webPage)
</span><span class="cx">     : m_type(type)
</span><span class="cx">     , m_webPage(webPage)
</span><del>-#if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
-    , m_nativeSurfaceHandleForCompositing(0)
-#endif
</del><span class="cx"> {
</span><span class="cx">     WebProcess::singleton().addMessageReceiver(Messages::DrawingArea::messageReceiverName(), m_webPage.pageID(), *this);
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreah"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -146,8 +146,8 @@
</span><span class="cx">     DrawingAreaType m_type;
</span><span class="cx">     WebPage&amp; m_webPage;
</span><span class="cx"> 
</span><del>-#if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
-    uint64_t m_nativeSurfaceHandleForCompositing;
</del><ins>+#if PLATFORM(GTK) &amp;&amp; USE(TEXTURE_MAPPER)
+    uint64_t m_nativeSurfaceHandleForCompositing { 0 };
</ins><span class="cx"> #endif
</span><span class="cx"> 
</span><span class="cx"> private:
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreaImplcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.cpp        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -27,15 +27,13 @@
</span><span class="cx"> #include &quot;DrawingAreaImpl.h&quot;
</span><span class="cx"> 
</span><span class="cx"> #include &quot;DrawingAreaProxyMessages.h&quot;
</span><del>-#include &quot;LayerTreeContext.h&quot;
</del><ins>+#include &quot;LayerTreeHost.h&quot;
</ins><span class="cx"> #include &quot;ShareableBitmap.h&quot;
</span><span class="cx"> #include &quot;UpdateInfo.h&quot;
</span><span class="cx"> #include &quot;WebPage.h&quot;
</span><span class="cx"> #include &quot;WebPageCreationParameters.h&quot;
</span><span class="cx"> #include &quot;WebPreferencesKeys.h&quot;
</span><del>-#include &quot;WebProcess.h&quot;
</del><span class="cx"> #include &lt;WebCore/GraphicsContext.h&gt;
</span><del>-#include &lt;WebCore/MainFrame.h&gt;
</del><span class="cx"> #include &lt;WebCore/Page.h&gt;
</span><span class="cx"> #include &lt;WebCore/Settings.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -45,39 +43,19 @@
</span><span class="cx"> 
</span><span class="cx"> DrawingAreaImpl::~DrawingAreaImpl()
</span><span class="cx"> {
</span><del>-    if (m_layerTreeHost)
-        m_layerTreeHost-&gt;invalidate();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> DrawingAreaImpl::DrawingAreaImpl(WebPage&amp; webPage, const WebPageCreationParameters&amp; parameters)
</span><del>-#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
-    : DrawingArea(DrawingAreaTypeCoordinated, webPage)
-#else
-    : DrawingArea(DrawingAreaTypeImpl, webPage)
-#endif
-    , m_backingStoreStateID(0)
-    , m_isPaintingEnabled(true)
-    , m_inUpdateBackingStoreState(false)
-    , m_shouldSendDidUpdateBackingStoreState(false)
-    , m_isWaitingForDidUpdate(false)
-    , m_compositingAccordingToProxyMessages(false)
-    , m_layerTreeStateIsFrozen(false)
-    , m_wantsToExitAcceleratedCompositingMode(false)
-    , m_isPaintingSuspended(!(parameters.viewState &amp; ViewState::IsVisible))
-    , m_alwaysUseCompositing(false)
</del><ins>+    : AcceleratedDrawingArea(webPage, parameters)
</ins><span class="cx">     , m_displayTimer(RunLoop::main(), this, &amp;DrawingAreaImpl::displayTimerFired)
</span><del>-    , m_exitCompositingTimer(RunLoop::main(), this, &amp;DrawingAreaImpl::exitAcceleratedCompositingMode)
</del><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaImpl::setNeedsDisplay()
</span><span class="cx"> {
</span><del>-    if (!m_isPaintingEnabled)
-        return;
-
</del><span class="cx">     if (m_layerTreeHost) {
</span><span class="cx">         ASSERT(m_dirtyRegion.isEmpty());
</span><del>-        m_layerTreeHost-&gt;setNonCompositedContentsNeedDisplay();
</del><ins>+        AcceleratedDrawingArea::setNeedsDisplay();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -86,18 +64,17 @@
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaImpl::setNeedsDisplayInRect(const IntRect&amp; rect)
</span><span class="cx"> {
</span><del>-    if (!m_isPaintingEnabled)
-        return;
-
</del><span class="cx">     if (m_layerTreeHost) {
</span><span class="cx">         ASSERT(m_dirtyRegion.isEmpty());
</span><del>-        m_layerTreeHost-&gt;setNonCompositedContentsNeedDisplayInRect(rect);
</del><ins>+        AcceleratedDrawingArea::setNeedsDisplayInRect(rect);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><del>-    
</del><ins>+
+    if (!m_isPaintingEnabled)
+        return;
+
</ins><span class="cx">     IntRect dirtyRect = rect;
</span><span class="cx">     dirtyRect.intersect(m_webPage.bounds());
</span><del>-
</del><span class="cx">     if (dirtyRect.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -107,18 +84,17 @@
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaImpl::scroll(const IntRect&amp; scrollRect, const IntSize&amp; scrollDelta)
</span><span class="cx"> {
</span><del>-    if (!m_isPaintingEnabled)
-        return;
-
</del><span class="cx">     if (m_layerTreeHost) {
</span><span class="cx">         ASSERT(m_scrollRect.isEmpty());
</span><span class="cx">         ASSERT(m_scrollOffset.isEmpty());
</span><span class="cx">         ASSERT(m_dirtyRegion.isEmpty());
</span><del>-
-        m_layerTreeHost-&gt;scrollNonCompositedContents(scrollRect);
</del><ins>+        AcceleratedDrawingArea::scroll(scrollRect, scrollDelta);
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    if (!m_isPaintingEnabled)
+        return;
+
</ins><span class="cx">     if (scrollRect.isEmpty())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><span class="lines">@@ -151,8 +127,8 @@
</span><span class="cx"> 
</span><span class="cx">         // And add them back.
</span><span class="cx">         m_dirtyRegion.unite(movedDirtyRegionInScrollRect);
</span><del>-    } 
-    
</del><ins>+    }
+
</ins><span class="cx">     // Compute the scroll repaint region.
</span><span class="cx">     Region scrollRepaintRegion = subtract(scrollRect, translate(scrollRect, scrollDelta));
</span><span class="cx"> 
</span><span class="lines">@@ -163,28 +139,6 @@
</span><span class="cx">     m_scrollOffset += scrollDelta;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DrawingAreaImpl::pageBackgroundTransparencyChanged()
-{
-    if (m_layerTreeHost)
-        m_layerTreeHost-&gt;pageBackgroundTransparencyChanged();
-}
-
-void DrawingAreaImpl::setLayerTreeStateIsFrozen(bool isFrozen)
-{
-    if (m_layerTreeStateIsFrozen == isFrozen)
-        return;
-
-    m_layerTreeStateIsFrozen = isFrozen;
-
-    if (m_layerTreeHost)
-        m_layerTreeHost-&gt;setLayerFlushSchedulingEnabled(!isFrozen);
-
-    if (isFrozen)
-        m_exitCompositingTimer.stop();
-    else if (m_wantsToExitAcceleratedCompositingMode)
-        exitAcceleratedCompositingModeSoon();
-}
-
</del><span class="cx"> void DrawingAreaImpl::forceRepaint()
</span><span class="cx"> {
</span><span class="cx">     if (m_inUpdateBackingStoreState) {
</span><span class="lines">@@ -191,41 +145,19 @@
</span><span class="cx">         m_forceRepaintAfterBackingStoreStateUpdate = true;
</span><span class="cx">         return;
</span><span class="cx">     }
</span><del>-
</del><span class="cx">     m_forceRepaintAfterBackingStoreStateUpdate = false;
</span><del>-    setNeedsDisplay();
</del><span class="cx"> 
</span><del>-    m_webPage.layoutIfNeeded();
-
</del><span class="cx">     if (m_layerTreeHost) {
</span><del>-        // FIXME: We need to do the same work as the layerHostDidFlushLayers function here,
-        // but clearly it doesn't make sense to call the function with that name.
-        // Consider refactoring and renaming it.
-        if (m_compositingAccordingToProxyMessages)
-            m_layerTreeHost-&gt;forceRepaint();
-        else {
-            // Call setShouldNotifyAfterNextScheduledLayerFlush(false) here to 
-            // prevent layerHostDidFlushLayers() from being called a second time.
-            m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(false);
-            layerHostDidFlushLayers();
-        }
</del><ins>+        AcceleratedDrawingArea::forceRepaint();
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    setNeedsDisplay();
+    m_webPage.layoutIfNeeded();
</ins><span class="cx">     m_isWaitingForDidUpdate = false;
</span><span class="cx">     display();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-bool DrawingAreaImpl::forceRepaintAsync(uint64_t callbackID)
-{
-    return m_layerTreeHost &amp;&amp; m_layerTreeHost-&gt;forceRepaintAsync(callbackID);
-}
-
-void DrawingAreaImpl::setPaintingEnabled(bool paintingEnabled)
-{
-    m_isPaintingEnabled = paintingEnabled;
-}
-
</del><span class="cx"> void DrawingAreaImpl::mainFrameContentSizeChanged(const WebCore::IntSize&amp; newSize)
</span><span class="cx"> {
</span><span class="cx"> #if USE(COORDINATED_GRAPHICS_THREADED)
</span><span class="lines">@@ -253,115 +185,44 @@
</span><span class="cx">         enterAcceleratedCompositingMode(nullptr);
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DrawingAreaImpl::layerHostDidFlushLayers()
</del><ins>+void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
</ins><span class="cx"> {
</span><del>-    ASSERT(m_layerTreeHost);
</del><ins>+    if (m_layerTreeHost) {
+        AcceleratedDrawingArea::setRootCompositingLayer(graphicsLayer);
</ins><span class="cx"> 
</span><del>-    m_layerTreeHost-&gt;forceRepaint();
-
-    if (m_shouldSendDidUpdateBackingStoreState &amp;&amp; !exitAcceleratedCompositingModePending()) {
-        sendDidUpdateBackingStoreState();
</del><ins>+        if (!graphicsLayer &amp;&amp; !m_alwaysUseCompositing) {
+            // We'll exit accelerated compositing mode on a timer, to avoid re-entering
+            // compositing code via display() and layout.
+            // If we're leaving compositing mode because of a setSize, it is safe to
+            // exit accelerated compositing mode right away.
+            if (m_inUpdateBackingStoreState)
+                exitAcceleratedCompositingMode();
+            else
+                exitAcceleratedCompositingModeSoon();
+        }
</ins><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (!m_layerTreeHost)
</del><ins>+    if (!graphicsLayer)
</ins><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    ASSERT(!m_compositingAccordingToProxyMessages);
-    if (!exitAcceleratedCompositingModePending()) {
-        m_webPage.send(Messages::DrawingAreaProxy::EnterAcceleratedCompositingMode(m_backingStoreStateID, m_layerTreeHost-&gt;layerTreeContext()));
-        m_compositingAccordingToProxyMessages = true;
-    }
</del><ins>+    // We're actually entering accelerated compositing mode.
+    enterAcceleratedCompositingMode(graphicsLayer);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-GraphicsLayerFactory* DrawingAreaImpl::graphicsLayerFactory()
</del><ins>+void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&amp; size, const WebCore::IntSize&amp; scrollOffset)
</ins><span class="cx"> {
</span><del>-    if (m_layerTreeHost)
-        return m_layerTreeHost-&gt;graphicsLayerFactory();
</del><ins>+    bool shouldUpdateDirtyRegion = stateID != m_backingStoreStateID &amp;&amp; !m_layerTreeHost;
+    AcceleratedDrawingArea::updateBackingStoreState(stateID, respondImmediately, deviceScaleFactor, size, scrollOffset);
+    if (shouldUpdateDirtyRegion)
+        m_dirtyRegion = m_webPage.bounds();
</ins><span class="cx"> 
</span><del>-    return 0;
</del><ins>+    if (m_forceRepaintAfterBackingStoreStateUpdate)
+        forceRepaint();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DrawingAreaImpl::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
</del><ins>+void DrawingAreaImpl::didUpdateBackingStoreState()
</ins><span class="cx"> {
</span><del>-    // FIXME: Instead of using nested if statements, we should keep a compositing state
-    // enum in the DrawingAreaImpl object and have a changeAcceleratedCompositingState function
-    // that takes the new state.
-
-    if (graphicsLayer) {
-        if (!m_layerTreeHost) {
-            // We're actually entering accelerated compositing mode.
-            enterAcceleratedCompositingMode(graphicsLayer);
-        } else {
-            // We're already in accelerated compositing mode, but the root compositing layer changed.
-
-            m_exitCompositingTimer.stop();
-            m_wantsToExitAcceleratedCompositingMode = false;
-
-            // If we haven't sent the EnterAcceleratedCompositingMode message, make sure that the
-            // layer tree host calls us back after the next layer flush so we can send it then.
-            if (!m_compositingAccordingToProxyMessages)
-                m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(true);
-
-            m_layerTreeHost-&gt;setRootCompositingLayer(graphicsLayer);
-        }
-    } else {
-        if (m_layerTreeHost) {
-            m_layerTreeHost-&gt;setRootCompositingLayer(0);
-            if (!m_alwaysUseCompositing) {
-                // We'll exit accelerated compositing mode on a timer, to avoid re-entering
-                // compositing code via display() and layout.
-                // If we're leaving compositing mode because of a setSize, it is safe to
-                // exit accelerated compositing mode right away.
-                if (m_inUpdateBackingStoreState)
-                    exitAcceleratedCompositingMode();
-                else
-                    exitAcceleratedCompositingModeSoon();
-            }
-        }
-    }
-}
-
-void DrawingAreaImpl::scheduleCompositingLayerFlush()
-{
-    if (!m_layerTreeHost)
-        return;
-    m_layerTreeHost-&gt;scheduleLayerFlush();
-}
-
-void DrawingAreaImpl::scheduleCompositingLayerFlushImmediately()
-{
-    scheduleCompositingLayerFlush();
-}
-
-void DrawingAreaImpl::updateBackingStoreState(uint64_t stateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&amp; size, const WebCore::IntSize&amp; scrollOffset)
-{
-    ASSERT(!m_inUpdateBackingStoreState);
-    m_inUpdateBackingStoreState = true;
-
-    ASSERT_ARG(stateID, stateID &gt;= m_backingStoreStateID);
-    if (stateID != m_backingStoreStateID) {
-        m_backingStoreStateID = stateID;
-        m_shouldSendDidUpdateBackingStoreState = true;
-
-        m_webPage.setDeviceScaleFactor(deviceScaleFactor);
-        m_webPage.setSize(size);
-        m_webPage.layoutIfNeeded();
-        m_webPage.scrollMainFrameIfNotAtMaxScrollPosition(scrollOffset);
-
-        if (m_layerTreeHost)
-            m_layerTreeHost-&gt;sizeDidChange(m_webPage.size());
-        else
-            m_dirtyRegion = m_webPage.bounds();
-    } else {
-        ASSERT(size == m_webPage.size());
-        if (!m_shouldSendDidUpdateBackingStoreState) {
-            // We've already sent a DidUpdateBackingStoreState message for this state. We have nothing more to do.
-            m_inUpdateBackingStoreState = false;
-            return;
-        }
-    }
-
</del><span class="cx">     // The UI process has updated to a new backing store state. Any Update messages we sent before
</span><span class="cx">     // this point will be ignored. We wait to set this to false until after updating the page's
</span><span class="cx">     // size so that any displays triggered by the relayout will be ignored. If we're supposed to
</span><span class="lines">@@ -368,19 +229,6 @@
</span><span class="cx">     // respond to the UpdateBackingStoreState message immediately, we'll do a display anyway in
</span><span class="cx">     // sendDidUpdateBackingStoreState; otherwise we shouldn't do one right now.
</span><span class="cx">     m_isWaitingForDidUpdate = false;
</span><del>-
-    if (respondImmediately) {
-        // Make sure to resume painting if we're supposed to respond immediately, otherwise we'll just
-        // send back an empty UpdateInfo struct.
-        if (m_isPaintingSuspended)
-            resumePainting();
-
-        sendDidUpdateBackingStoreState();
-    }
-
-    m_inUpdateBackingStoreState = false;
-    if (m_forceRepaintAfterBackingStoreStateUpdate)
-        forceRepaint();
</del><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaImpl::sendDidUpdateBackingStoreState()
</span><span class="lines">@@ -388,33 +236,20 @@
</span><span class="cx">     ASSERT(!m_isWaitingForDidUpdate);
</span><span class="cx">     ASSERT(m_shouldSendDidUpdateBackingStoreState);
</span><span class="cx"> 
</span><del>-    m_shouldSendDidUpdateBackingStoreState = false;
-
-    UpdateInfo updateInfo;
-
-    if (!m_isPaintingSuspended &amp;&amp; !m_layerTreeHost)
</del><ins>+    if (!m_isPaintingSuspended &amp;&amp; !m_layerTreeHost) {
+        UpdateInfo updateInfo;
</ins><span class="cx">         display(updateInfo);
</span><ins>+        if (!m_layerTreeHost) {
+            m_shouldSendDidUpdateBackingStoreState = false;
</ins><span class="cx"> 
</span><del>-    LayerTreeContext layerTreeContext;
-
-    if (m_isPaintingSuspended || m_layerTreeHost) {
-        updateInfo.viewSize = m_webPage.size();
-        updateInfo.deviceScaleFactor = m_webPage.corePage()-&gt;deviceScaleFactor();
-
-        if (m_layerTreeHost) {
-            layerTreeContext = m_layerTreeHost-&gt;layerTreeContext();
-
-            // We don't want the layer tree host to notify after the next scheduled
-            // layer flush because that might end up sending an EnterAcceleratedCompositingMode
-            // message back to the UI process, but the updated layer tree context
-            // will be sent back in the DidUpdateBackingStoreState message.
-            m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(false);
-            m_layerTreeHost-&gt;forceRepaint();
</del><ins>+            LayerTreeContext layerTreeContext;
+            m_webPage.send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext));
+            m_compositingAccordingToProxyMessages = false;
+            return;
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    m_webPage.send(Messages::DrawingAreaProxy::DidUpdateBackingStoreState(m_backingStoreStateID, updateInfo, layerTreeContext));
-    m_compositingAccordingToProxyMessages = !layerTreeContext.isEmpty();
</del><ins>+    AcceleratedDrawingArea::sendDidUpdateBackingStoreState();
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaImpl::didUpdate()
</span><span class="lines">@@ -432,51 +267,14 @@
</span><span class="cx"> 
</span><span class="cx"> void DrawingAreaImpl::suspendPainting()
</span><span class="cx"> {
</span><del>-    ASSERT(!m_isPaintingSuspended);
-
-    if (m_layerTreeHost)
-        m_layerTreeHost-&gt;pauseRendering();
-
-    m_isPaintingSuspended = true;
</del><ins>+    AcceleratedDrawingArea::suspendPainting();
</ins><span class="cx">     m_displayTimer.stop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DrawingAreaImpl::resumePainting()
-{
-    if (!m_isPaintingSuspended) {
-        // FIXME: We can get a call to resumePainting when painting is not suspended.
-        // This happens when sending a synchronous message to create a new page. See &lt;rdar://problem/8976531&gt;.
-        return;
-    }
-    
-    if (m_layerTreeHost)
-        m_layerTreeHost-&gt;resumeRendering();
-        
-    m_isPaintingSuspended = false;
-
-    // FIXME: We shouldn't always repaint everything here.
-    setNeedsDisplay();
-}
-
</del><span class="cx"> void DrawingAreaImpl::enterAcceleratedCompositingMode(GraphicsLayer* graphicsLayer)
</span><span class="cx"> {
</span><del>-    m_exitCompositingTimer.stop();
-    m_wantsToExitAcceleratedCompositingMode = false;
</del><ins>+    AcceleratedDrawingArea::enterAcceleratedCompositingMode(graphicsLayer);
</ins><span class="cx"> 
</span><del>-    m_webPage.send(Messages::DrawingAreaProxy::WillEnterAcceleratedCompositingMode(m_backingStoreStateID));
-
-    ASSERT(!m_layerTreeHost);
-
-    m_layerTreeHost = LayerTreeHost::create(m_webPage);
-#if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
-    if (m_nativeSurfaceHandleForCompositing)
-        m_layerTreeHost-&gt;setNativeSurfaceHandleForCompositing(m_nativeSurfaceHandleForCompositing);
-#endif
-    if (!m_inUpdateBackingStoreState)
-        m_layerTreeHost-&gt;setShouldNotifyAfterNextScheduledLayerFlush(true);
-
-    m_layerTreeHost-&gt;setRootCompositingLayer(graphicsLayer);
-    
</del><span class="cx">     // Non-composited content will now be handled exclusively by the layer tree host.
</span><span class="cx">     m_dirtyRegion = Region();
</span><span class="cx">     m_scrollRect = IntRect();
</span><span class="lines">@@ -528,19 +326,6 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DrawingAreaImpl::exitAcceleratedCompositingModeSoon()
-{
-    if (m_layerTreeStateIsFrozen) {
-        m_wantsToExitAcceleratedCompositingMode = true;
-        return;
-    }
-
-    if (exitAcceleratedCompositingModePending())
-        return;
-
-    m_exitCompositingTimer.startOneShot(0);
-}
-
</del><span class="cx"> void DrawingAreaImpl::scheduleDisplay()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(!m_layerTreeHost);
</span><span class="lines">@@ -681,33 +466,4 @@
</span><span class="cx">     m_displayTimer.stop();
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void DrawingAreaImpl::attachViewOverlayGraphicsLayer(WebCore::Frame* frame, WebCore::GraphicsLayer* viewOverlayRootLayer)
-{
-    if (!frame-&gt;isMainFrame())
-        return;
-
-    if (!m_layerTreeHost)
-        return;
-
-    m_layerTreeHost-&gt;setViewOverlayRootLayer(viewOverlayRootLayer);
-}
-
-#if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
-void DrawingAreaImpl::setNativeSurfaceHandleForCompositing(uint64_t handle)
-{
-    m_nativeSurfaceHandleForCompositing = handle;
-
-    if (m_layerTreeHost) {
-        m_webPage.corePage()-&gt;settings().setAcceleratedCompositingEnabled(true);
-        m_layerTreeHost-&gt;setNativeSurfaceHandleForCompositing(handle);
-    }
-}
-
-void DrawingAreaImpl::destroyNativeSurfaceHandleForCompositing(bool&amp; handled)
-{
-    handled = true;
-    setNativeSurfaceHandleForCompositing(0);
-}
-#endif
-
</del><span class="cx"> } // namespace WebKit
</span></span></pre></div>
<a id="trunkSourceWebKit2WebProcessWebPageDrawingAreaImplh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (202854 => 202855)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h        2016-07-06 09:48:01 UTC (rev 202854)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h        2016-07-06 11:32:07 UTC (rev 202855)
</span><span class="lines">@@ -23,16 +23,13 @@
</span><span class="cx">  * THE POSSIBILITY OF SUCH DAMAGE.
</span><span class="cx">  */
</span><span class="cx"> 
</span><del>-#ifndef DrawingAreaImpl_h
-#define DrawingAreaImpl_h
</del><ins>+#pragma once
</ins><span class="cx"> 
</span><del>-#include &quot;DrawingArea.h&quot;
-#include &quot;LayerTreeHost.h&quot;
</del><ins>+#include &quot;AcceleratedDrawingArea.h&quot;
</ins><span class="cx"> #include &lt;WebCore/Region.h&gt;
</span><del>-#include &lt;wtf/RunLoop.h&gt;
</del><span class="cx"> 
</span><span class="cx"> namespace WebCore {
</span><del>-    class GraphicsContext;
</del><ins>+class GraphicsContext;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> namespace WebKit {
</span><span class="lines">@@ -40,7 +37,7 @@
</span><span class="cx"> class ShareableBitmap;
</span><span class="cx"> class UpdateInfo;
</span><span class="cx"> 
</span><del>-class DrawingAreaImpl : public DrawingArea {
</del><ins>+class DrawingAreaImpl final : public AcceleratedDrawingArea {
</ins><span class="cx"> public:
</span><span class="cx">     DrawingAreaImpl(WebPage&amp;, const WebPageCreationParameters&amp;);
</span><span class="cx">     virtual ~DrawingAreaImpl();
</span><span class="lines">@@ -50,94 +47,42 @@
</span><span class="cx">     void setNeedsDisplay() override;
</span><span class="cx">     void setNeedsDisplayInRect(const WebCore::IntRect&amp;) override;
</span><span class="cx">     void scroll(const WebCore::IntRect&amp; scrollRect, const WebCore::IntSize&amp; scrollDelta) override;
</span><del>-    void pageBackgroundTransparencyChanged() override;
-    void setLayerTreeStateIsFrozen(bool) override;
-    bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; }
-    LayerTreeHost* layerTreeHost() const override { return m_layerTreeHost.get(); }
</del><span class="cx">     void forceRepaint() override;
</span><del>-    bool forceRepaintAsync(uint64_t callbackID) override;
</del><span class="cx"> 
</span><del>-    void setPaintingEnabled(bool) override;
</del><span class="cx">     void mainFrameContentSizeChanged(const WebCore::IntSize&amp;) override;
</span><span class="cx">     void updatePreferences(const WebPreferencesStore&amp;) override;
</span><span class="cx"> 
</span><del>-    WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
</del><span class="cx">     void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
</span><del>-    void scheduleCompositingLayerFlush() override;
-    void scheduleCompositingLayerFlushImmediately() override;
</del><span class="cx"> 
</span><del>-    void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
-
-#if USE(TEXTURE_MAPPER) &amp;&amp; PLATFORM(GTK)
-    void setNativeSurfaceHandleForCompositing(uint64_t) override;
-    void destroyNativeSurfaceHandleForCompositing(bool&amp;) override;
-#endif
-
-    void layerHostDidFlushLayers() override;
-
</del><span class="cx">     // IPC message handlers.
</span><span class="cx">     void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&amp;, const WebCore::IntSize&amp; scrollOffset) override;
</span><span class="cx">     void didUpdate() override;
</span><del>-    virtual void suspendPainting();
-    virtual void resumePainting();
-    
-    void sendDidUpdateBackingStoreState();
</del><span class="cx"> 
</span><del>-    void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*);
-    void exitAcceleratedCompositingModeSoon();
-    bool exitAcceleratedCompositingModePending() const { return m_exitCompositingTimer.isActive(); }
-    void exitAcceleratedCompositingMode();
</del><ins>+    // AcceleratedDrawingArea
+    void suspendPainting() override;
+    void sendDidUpdateBackingStoreState() override;
+    void didUpdateBackingStoreState() override;
</ins><span class="cx"> 
</span><ins>+    void enterAcceleratedCompositingMode(WebCore::GraphicsLayer*) override;
+    void exitAcceleratedCompositingMode() override;
+
</ins><span class="cx">     void scheduleDisplay();
</span><span class="cx">     void displayTimerFired();
</span><span class="cx">     void display();
</span><span class="cx">     void display(UpdateInfo&amp;);
</span><span class="cx"> 
</span><del>-    uint64_t m_backingStoreStateID;
-
</del><span class="cx">     WebCore::Region m_dirtyRegion;
</span><span class="cx">     WebCore::IntRect m_scrollRect;
</span><span class="cx">     WebCore::IntSize m_scrollOffset;
</span><span class="cx"> 
</span><del>-    // Whether painting is enabled. If painting is disabled, any calls to setNeedsDisplay and scroll are ignored.
-    bool m_isPaintingEnabled;
-
-    // Whether we're currently processing an UpdateBackingStoreState message.
-    bool m_inUpdateBackingStoreState;
-
-    // When true, we should send an UpdateBackingStoreState message instead of any other messages
-    // we normally send to the UI process.
-    bool m_shouldSendDidUpdateBackingStoreState;
-
</del><span class="cx">     // Whether we're waiting for a DidUpdate message. Used for throttling paints so that the 
</span><span class="cx">     // web process won't paint more frequent than the UI process can handle.
</span><del>-    bool m_isWaitingForDidUpdate;
-    
-    // True between sending the 'enter compositing' messages, and the 'exit compositing' message.
-    bool m_compositingAccordingToProxyMessages;
</del><ins>+    bool m_isWaitingForDidUpdate { false };
</ins><span class="cx"> 
</span><del>-    // When true, we maintain the layer tree in its current state by not leaving accelerated compositing mode
-    // and not scheduling layer flushes.
-    bool m_layerTreeStateIsFrozen;
-
-    // True when we were asked to exit accelerated compositing mode but couldn't because layer tree
-    // state was frozen.
-    bool m_wantsToExitAcceleratedCompositingMode;
-
-    // Whether painting is suspended. We'll still keep track of the dirty region but we 
-    // won't paint until painting has resumed again.
-    bool m_isPaintingSuspended;
-    bool m_alwaysUseCompositing;
-
</del><ins>+    bool m_alwaysUseCompositing {false };
</ins><span class="cx">     bool m_forceRepaintAfterBackingStoreStateUpdate { false };
</span><span class="cx"> 
</span><span class="cx">     RunLoop::Timer&lt;DrawingAreaImpl&gt; m_displayTimer;
</span><del>-    RunLoop::Timer&lt;DrawingAreaImpl&gt; m_exitCompositingTimer;
-
-    // The layer tree host that handles accelerated compositing.
-    RefPtr&lt;LayerTreeHost&gt; m_layerTreeHost;
</del><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace WebKit
</span><del>-
-#endif // DrawingAreaImpl_h
</del></span></pre>
</div>
</div>

</body>
</html>