[CoordinatedGraphics] Unify all LayerTreeHost classes
authorcarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2019 13:17:41 +0000 (13:17 +0000)
committercarlosgc@webkit.org <carlosgc@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 28 Feb 2019 13:17:41 +0000 (13:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=195094

Reviewed by Žan Doberšek.

There's no reason to have 3 classes, since currently LayerTreeHost is only used by coordinated graphics based
ports.

* PlatformWin.cmake:
* SourcesGTK.txt:
* SourcesWPE.txt:
* WebProcess/WebPage/AcceleratedDrawingArea.cpp:
(WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
(WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
* WebProcess/WebPage/AcceleratedDrawingArea.h:
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: Removed.
* WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: Removed.
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp.
(WebKit::LayerTreeHost::LayerTreeHost):
(WebKit::LayerTreeHost::~LayerTreeHost):
(WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled):
(WebKit::LayerTreeHost::scheduleLayerFlush):
(WebKit::LayerTreeHost::cancelPendingLayerFlush):
(WebKit::LayerTreeHost::layerFlushTimerFired):
(WebKit::LayerTreeHost::setRootCompositingLayer):
(WebKit::LayerTreeHost::setViewOverlayRootLayer):
(WebKit::LayerTreeHost::invalidate):
(WebKit::LayerTreeHost::scrollNonCompositedContents):
(WebKit::LayerTreeHost::forceRepaint):
(WebKit::LayerTreeHost::forceRepaintAsync):
(WebKit::LayerTreeHost::sizeDidChange):
(WebKit::LayerTreeHost::pauseRendering):
(WebKit::LayerTreeHost::resumeRendering):
(WebKit::LayerTreeHost::graphicsLayerFactory):
(WebKit::LayerTreeHost::contentsSizeChanged):
(WebKit::LayerTreeHost::didChangeViewportAttributes):
(WebKit::LayerTreeHost::didChangeViewport):
(WebKit::LayerTreeHost::setIsDiscardable):
(WebKit::LayerTreeHost::setNativeSurfaceHandleForCompositing):
(WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged):
(WebKit::LayerTreeHost::createDisplayRefreshMonitor):
(WebKit::LayerTreeHost::didFlushRootLayer):
(WebKit::LayerTreeHost::commitSceneState):
(WebKit::LayerTreeHost::frameComplete):
(WebKit::LayerTreeHost::nativeSurfaceHandleForCompositing):
(WebKit::LayerTreeHost::didDestroyGLContext):
(WebKit::LayerTreeHost::willRenderFrame):
(WebKit::LayerTreeHost::didRenderFrame):
(WebKit::LayerTreeHost::requestDisplayRefreshMonitorUpdate):
(WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
(WebKit::LayerTreeHost::renderNextFrame):
* WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h.
* WebProcess/WebPage/DrawingAreaImpl.cpp:
(WebKit::DrawingAreaImpl::setNeedsDisplay):
(WebKit::DrawingAreaImpl::setNeedsDisplayInRect):
* WebProcess/WebPage/LayerTreeHost.cpp: Removed.
* WebProcess/WebPage/LayerTreeHost.h: Removed.
* WebPage/win/LayerTreeHost.h: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242199 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebKit/ChangeLog
Source/WebKit/PlatformWin.cmake
Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h
Source/WebKit/SourcesGTK.txt
Source/WebKit/SourcesWPE.txt
Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp
Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp [deleted file]
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h [deleted file]
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp [moved from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp with 53% similarity]
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h [new file with mode: 0644]
Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h [deleted file]
Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp
Source/WebKit/WebProcess/WebPage/LayerTreeHost.cpp [deleted file]
Source/WebKit/WebProcess/WebPage/LayerTreeHost.h [deleted file]

index 875e419..86dbc90 100644 (file)
@@ -1,3 +1,64 @@
+2019-02-28  Carlos Garcia Campos  <cgarcia@igalia.com>
+
+        [CoordinatedGraphics] Unify all LayerTreeHost classes
+        https://bugs.webkit.org/show_bug.cgi?id=195094
+
+        Reviewed by Žan Doberšek.
+
+        There's no reason to have 3 classes, since currently LayerTreeHost is only used by coordinated graphics based
+        ports.
+
+        * PlatformWin.cmake:
+        * SourcesGTK.txt:
+        * SourcesWPE.txt:
+        * WebProcess/WebPage/AcceleratedDrawingArea.cpp:
+        (WebKit::AcceleratedDrawingArea::enterAcceleratedCompositingMode):
+        (WebKit::AcceleratedDrawingArea::exitAcceleratedCompositingModeNow):
+        * WebProcess/WebPage/AcceleratedDrawingArea.h:
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp: Removed.
+        * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h: Removed.
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp.
+        (WebKit::LayerTreeHost::LayerTreeHost):
+        (WebKit::LayerTreeHost::~LayerTreeHost):
+        (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled):
+        (WebKit::LayerTreeHost::scheduleLayerFlush):
+        (WebKit::LayerTreeHost::cancelPendingLayerFlush):
+        (WebKit::LayerTreeHost::layerFlushTimerFired):
+        (WebKit::LayerTreeHost::setRootCompositingLayer):
+        (WebKit::LayerTreeHost::setViewOverlayRootLayer):
+        (WebKit::LayerTreeHost::invalidate):
+        (WebKit::LayerTreeHost::scrollNonCompositedContents):
+        (WebKit::LayerTreeHost::forceRepaint):
+        (WebKit::LayerTreeHost::forceRepaintAsync):
+        (WebKit::LayerTreeHost::sizeDidChange):
+        (WebKit::LayerTreeHost::pauseRendering):
+        (WebKit::LayerTreeHost::resumeRendering):
+        (WebKit::LayerTreeHost::graphicsLayerFactory):
+        (WebKit::LayerTreeHost::contentsSizeChanged):
+        (WebKit::LayerTreeHost::didChangeViewportAttributes):
+        (WebKit::LayerTreeHost::didChangeViewport):
+        (WebKit::LayerTreeHost::setIsDiscardable):
+        (WebKit::LayerTreeHost::setNativeSurfaceHandleForCompositing):
+        (WebKit::LayerTreeHost::deviceOrPageScaleFactorChanged):
+        (WebKit::LayerTreeHost::createDisplayRefreshMonitor):
+        (WebKit::LayerTreeHost::didFlushRootLayer):
+        (WebKit::LayerTreeHost::commitSceneState):
+        (WebKit::LayerTreeHost::frameComplete):
+        (WebKit::LayerTreeHost::nativeSurfaceHandleForCompositing):
+        (WebKit::LayerTreeHost::didDestroyGLContext):
+        (WebKit::LayerTreeHost::willRenderFrame):
+        (WebKit::LayerTreeHost::didRenderFrame):
+        (WebKit::LayerTreeHost::requestDisplayRefreshMonitorUpdate):
+        (WebKit::LayerTreeHost::handleDisplayRefreshMonitorUpdate):
+        (WebKit::LayerTreeHost::renderNextFrame):
+        * WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h: Renamed from Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h.
+        * WebProcess/WebPage/DrawingAreaImpl.cpp:
+        (WebKit::DrawingAreaImpl::setNeedsDisplay):
+        (WebKit::DrawingAreaImpl::setNeedsDisplayInRect):
+        * WebProcess/WebPage/LayerTreeHost.cpp: Removed.
+        * WebProcess/WebPage/LayerTreeHost.h: Removed.
+        * WebPage/win/LayerTreeHost.h: Added.
+
 2019-02-28  Justin Fan  <justin_fan@apple.com>
 
         [Web GPU] Enable Web GPU only on 64-bit
index 0a5335a..4cb804d 100644 (file)
@@ -81,11 +81,9 @@ list(APPEND WebKit_SOURCES
     WebProcess/WebPage/AcceleratedDrawingArea.cpp
     WebProcess/WebPage/AcceleratedSurface.cpp
     WebProcess/WebPage/DrawingAreaImpl.cpp
-    WebProcess/WebPage/LayerTreeHost.cpp
 
     WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
-    WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
-    WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
+    WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
 
     WebProcess/WebPage/win/WebInspectorUIWin.cpp
     WebProcess/WebPage/win/WebPageWin.cpp
index 487e660..5b22bbf 100644 (file)
@@ -25,9 +25,9 @@
 
 #pragma once
 
-#if USE(COORDINATED_GRAPHICS_THREADED) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-
 #include <WebCore/DisplayRefreshMonitor.h>
+
+#if USE(COORDINATED_GRAPHICS_THREADED) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
 #include <wtf/RunLoop.h>
 
 namespace WebKit {
index ea1bf97..91f8c49 100644 (file)
@@ -403,12 +403,10 @@ WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
 
 WebProcess/WebPage/AcceleratedDrawingArea.cpp
 WebProcess/WebPage/AcceleratedSurface.cpp
-WebProcess/WebPage/LayerTreeHost.cpp
 WebProcess/WebPage/ViewGestureGeometryCollector.cpp
 
 WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
-WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
-WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
+WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
 
 WebProcess/WebPage/DrawingAreaImpl.cpp
 
index 9c958bf..5405f24 100644 (file)
@@ -243,11 +243,9 @@ WebProcess/WebCoreSupport/wpe/WebPopupMenuWPE.cpp
 
 WebProcess/WebPage/AcceleratedDrawingArea.cpp
 WebProcess/WebPage/AcceleratedSurface.cpp
-WebProcess/WebPage/LayerTreeHost.cpp
 
 WebProcess/WebPage/CoordinatedGraphics/CompositingCoordinator.cpp
-WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
-WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
+WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp
 
 WebProcess/WebPage/gstreamer/WebPageGStreamer.cpp
 
index 304db88..6475be0 100644 (file)
@@ -66,24 +66,6 @@ AcceleratedDrawingArea::AcceleratedDrawingArea(WebPage& webPage, const WebPageCr
     m_webPage.corePage()->setDeviceScaleFactor(parameters.deviceScaleFactor);
 }
 
-void AcceleratedDrawingArea::setNeedsDisplay()
-{
-    if (!m_isPaintingEnabled)
-        return;
-
-    if (m_layerTreeHost)
-        m_layerTreeHost->setNonCompositedContentsNeedDisplay();
-}
-
-void AcceleratedDrawingArea::setNeedsDisplayInRect(const IntRect& rect)
-{
-    if (!m_isPaintingEnabled)
-        return;
-
-    if (m_layerTreeHost)
-        m_layerTreeHost->setNonCompositedContentsNeedDisplayInRect(rect);
-}
-
 void AcceleratedDrawingArea::scroll(const IntRect& scrollRect, const IntSize& scrollDelta)
 {
     if (!m_isPaintingEnabled)
@@ -343,19 +325,19 @@ void AcceleratedDrawingArea::enterAcceleratedCompositingMode(GraphicsLayer* grap
 
     ASSERT(!m_layerTreeHost);
     if (m_previousLayerTreeHost) {
-#if USE(COORDINATED_GRAPHICS)
         m_layerTreeHost = WTFMove(m_previousLayerTreeHost);
         m_layerTreeHost->setIsDiscardable(false);
         if (!m_isPaintingSuspended)
             m_layerTreeHost->resumeRendering();
         if (!m_layerTreeStateIsFrozen)
             m_layerTreeHost->setLayerFlushSchedulingEnabled(true);
+    } else {
+#if USE(COORDINATED_GRAPHICS_THREADED)
+        m_layerTreeHost = std::make_unique<LayerTreeHost>(m_webPage);
 #else
-        ASSERT_NOT_REACHED();
+        m_layerTreeHost = nullptr;
 #endif
-    } else {
-        m_layerTreeHost = LayerTreeHost::create(m_webPage);
-
+        
         if (!m_layerTreeHost)
             return;
 
@@ -393,16 +375,12 @@ void AcceleratedDrawingArea::exitAcceleratedCompositingModeNow()
     m_exitCompositingTimer.stop();
     m_wantsToExitAcceleratedCompositingMode = false;
 
-#if USE(COORDINATED_GRAPHICS)
     ASSERT(m_layerTreeHost);
     m_previousLayerTreeHost = WTFMove(m_layerTreeHost);
     m_previousLayerTreeHost->setIsDiscardable(true);
     m_previousLayerTreeHost->pauseRendering();
     m_previousLayerTreeHost->setLayerFlushSchedulingEnabled(false);
     m_discardPreviousLayerTreeHostTimer.startOneShot(5_s);
-#else
-    m_layerTreeHost = nullptr;
-#endif
 }
 
 void AcceleratedDrawingArea::discardPreviousLayerTreeHost()
index f7ef9f6..4337170 100644 (file)
@@ -40,8 +40,8 @@ public:
 
 protected:
     // DrawingArea
-    void setNeedsDisplay() override;
-    void setNeedsDisplayInRect(const WebCore::IntRect&) override;
+    void setNeedsDisplay() override { };
+    void setNeedsDisplayInRect(const WebCore::IntRect&) override { };
     void scroll(const WebCore::IntRect& scrollRect, const WebCore::IntSize& scrollDelta) override;
     void setLayerTreeStateIsFrozen(bool) override;
     bool layerTreeStateIsFrozen() const override { return m_layerTreeStateIsFrozen; }
@@ -128,9 +128,9 @@ protected:
     RunLoop::Timer<AcceleratedDrawingArea> m_exitCompositingTimer;
 
     // The layer tree host that handles accelerated compositing.
-    RefPtr<LayerTreeHost> m_layerTreeHost;
+    std::unique_ptr<LayerTreeHost> m_layerTreeHost;
 
-    RefPtr<LayerTreeHost> m_previousLayerTreeHost;
+    std::unique_ptr<LayerTreeHost> m_previousLayerTreeHost;
     RunLoop::Timer<AcceleratedDrawingArea> m_discardPreviousLayerTreeHostTimer;
 };
 
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
deleted file mode 100644 (file)
index 93b7a2d..0000000
+++ /dev/null
@@ -1,245 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
- * Copyright (C) 2012 Company 100, Inc.
- *
- * 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 "config.h"
-
-#if USE(COORDINATED_GRAPHICS)
-#include "CoordinatedLayerTreeHost.h"
-
-#include "DrawingArea.h"
-#include "WebPage.h"
-#include "WebPageProxyMessages.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-#include <WebCore/PageOverlayController.h>
-
-#if USE(GLIB_EVENT_LOOP)
-#include <wtf/glib/RunLoopSourcePriority.h>
-#endif
-
-namespace WebKit {
-using namespace WebCore;
-
-Ref<CoordinatedLayerTreeHost> CoordinatedLayerTreeHost::create(WebPage& webPage)
-{
-    return adoptRef(*new CoordinatedLayerTreeHost(webPage));
-}
-
-CoordinatedLayerTreeHost::~CoordinatedLayerTreeHost()
-{
-}
-
-CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage& webPage)
-    : LayerTreeHost(webPage)
-    , m_coordinator(webPage.corePage(), *this)
-    , m_layerFlushTimer(RunLoop::main(), this, &CoordinatedLayerTreeHost::layerFlushTimerFired)
-{
-#if USE(GLIB_EVENT_LOOP)
-    m_layerFlushTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer);
-    m_layerFlushTimer.setName("[WebKit] CoordinatedLayerTreeHost");
-#endif
-    m_coordinator.createRootLayer(m_webPage.size());
-
-    scheduleLayerFlush();
-}
-
-void CoordinatedLayerTreeHost::scheduleLayerFlush()
-{
-    if (!m_layerFlushSchedulingEnabled)
-        return;
-
-    if (m_isWaitingForRenderer) {
-        m_scheduledWhileWaitingForRenderer = true;
-        return;
-    }
-
-    if (!m_layerFlushTimer.isActive())
-        m_layerFlushTimer.startOneShot(0_s);
-}
-
-void CoordinatedLayerTreeHost::cancelPendingLayerFlush()
-{
-    m_layerFlushTimer.stop();
-}
-
-void CoordinatedLayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
-{
-    LayerTreeHost::setViewOverlayRootLayer(viewOverlayRootLayer);
-    m_coordinator.setViewOverlayRootLayer(viewOverlayRootLayer);
-}
-
-void CoordinatedLayerTreeHost::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
-{
-    m_coordinator.setRootCompositingLayer(graphicsLayer);
-}
-
-void CoordinatedLayerTreeHost::invalidate()
-{
-    cancelPendingLayerFlush();
-
-    m_coordinator.invalidate();
-    LayerTreeHost::invalidate();
-}
-
-void CoordinatedLayerTreeHost::forceRepaint()
-{
-    // This is necessary for running layout tests. Since in this case we are not waiting for a UIProcess to reply nicely.
-    // Instead we are just triggering forceRepaint. But we still want to have the scripted animation callbacks being executed.
-    m_coordinator.syncDisplayState();
-
-    // We need to schedule another flush, otherwise the forced paint might cancel a later expected flush.
-    // This is aligned with LayerTreeHostCA.
-    scheduleLayerFlush();
-
-    if (m_isWaitingForRenderer)
-        return;
-
-    m_coordinator.flushPendingLayerChanges();
-}
-
-bool CoordinatedLayerTreeHost::forceRepaintAsync(CallbackID callbackID)
-{
-    scheduleLayerFlush();
-
-    // We want a clean repaint, meaning that if we're currently waiting for the renderer
-    // to finish an update, we'll have to schedule another flush when it's done.
-    ASSERT(!m_forceRepaintAsync.callbackID);
-    m_forceRepaintAsync.callbackID = OptionalCallbackID(callbackID);
-    m_forceRepaintAsync.needsFreshFlush = m_scheduledWhileWaitingForRenderer;
-    return true;
-}
-
-void CoordinatedLayerTreeHost::sizeDidChange(const IntSize& newSize)
-{
-    m_coordinator.sizeDidChange(newSize);
-    scheduleLayerFlush();
-}
-
-void CoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect)
-{
-    m_coordinator.setVisibleContentsRect(rect);
-    scheduleLayerFlush();
-}
-
-void CoordinatedLayerTreeHost::renderNextFrame(bool forceRepaint)
-{
-    m_isWaitingForRenderer = false;
-    bool scheduledWhileWaitingForRenderer = std::exchange(m_scheduledWhileWaitingForRenderer, false);
-    m_coordinator.renderNextFrame();
-
-    if (m_forceRepaintAsync.callbackID) {
-        // If the asynchronous force-repaint needs a separate fresh flush, it was due to
-        // the force-repaint request being registered while CoordinatedLayerTreeHost was
-        // waiting for the renderer to finish an update.
-        ASSERT(!m_forceRepaintAsync.needsFreshFlush || scheduledWhileWaitingForRenderer);
-
-        // Execute the callback if another layer flush and the subsequent state update
-        // aren't needed. If they are, the callback will be executed when this function
-        // is called after the next update.
-        if (!m_forceRepaintAsync.needsFreshFlush) {
-            m_webPage.send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsync.callbackID.callbackID()));
-            m_forceRepaintAsync.callbackID = OptionalCallbackID();
-        }
-        m_forceRepaintAsync.needsFreshFlush = false;
-    }
-
-    if (scheduledWhileWaitingForRenderer || m_layerFlushTimer.isActive() || forceRepaint) {
-        m_layerFlushTimer.stop();
-        if (forceRepaint)
-            m_coordinator.forceFrameSync();
-        layerFlushTimerFired();
-    }
-}
-
-void CoordinatedLayerTreeHost::didFlushRootLayer(const FloatRect& visibleContentRect)
-{
-    // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually.
-    if (m_viewOverlayRootLayer)
-        m_viewOverlayRootLayer->flushCompositingState(visibleContentRect);
-}
-
-void CoordinatedLayerTreeHost::layerFlushTimerFired()
-{
-    if (m_isSuspended || m_isWaitingForRenderer)
-        return;
-
-    m_coordinator.syncDisplayState();
-    m_webPage.flushPendingEditorStateUpdate();
-    m_webPage.willDisplayPage();
-
-    if (!m_isValid || !m_coordinator.rootCompositingLayer())
-        return;
-
-    // If a force-repaint callback was registered, we should force a 'frame sync' that
-    // will guarantee us a call to renderNextFrame() once the update is complete.
-    if (m_forceRepaintAsync.callbackID)
-        m_coordinator.forceFrameSync();
-
-    bool didSync = m_coordinator.flushPendingLayerChanges();
-
-    if (m_notifyAfterScheduledLayerFlush && didSync) {
-        m_webPage.drawingArea()->layerHostDidFlushLayers();
-        m_notifyAfterScheduledLayerFlush = false;
-    }
-}
-
-void CoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
-{
-    m_isWaitingForRenderer = true;
-}
-
-void CoordinatedLayerTreeHost::flushLayersAndForceRepaint()
-{
-    m_coordinator.forceFrameSync();
-    scheduleLayerFlush();
-}
-
-void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
-{
-    m_coordinator.deviceOrPageScaleFactorChanged();
-    m_webPage.corePage()->pageOverlayController().didChangeDeviceScaleFactor();
-}
-
-GraphicsLayerFactory* CoordinatedLayerTreeHost::graphicsLayerFactory()
-{
-    return &m_coordinator;
-}
-
-void CoordinatedLayerTreeHost::scheduleAnimation()
-{
-    if (m_isWaitingForRenderer)
-        return;
-
-    if (m_layerFlushTimer.isActive())
-        return;
-
-    scheduleLayerFlush();
-    m_layerFlushTimer.startOneShot(1_s * m_coordinator.nextAnimationServiceTime());
-}
-
-} // namespace WebKit
-#endif // USE(COORDINATED_GRAPHICS)
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h
deleted file mode 100644 (file)
index ea97453..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
-    Copyright (C) 2011 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 CoordinatedLayerTreeHost_h
-#define CoordinatedLayerTreeHost_h
-
-#if USE(COORDINATED_GRAPHICS)
-
-#include "CompositingCoordinator.h"
-#include "LayerTreeHost.h"
-#include "OptionalCallbackID.h"
-#include <wtf/RunLoop.h>
-
-namespace WebCore {
-class GraphicsLayerFactory;
-}
-
-namespace WebKit {
-
-class WebPage;
-
-class CoordinatedLayerTreeHost : public LayerTreeHost, public CompositingCoordinator::Client
-{
-public:
-    static Ref<CoordinatedLayerTreeHost> create(WebPage&);
-    virtual ~CoordinatedLayerTreeHost();
-
-protected:
-    explicit CoordinatedLayerTreeHost(WebPage&);
-
-    void scheduleLayerFlush() override;
-    void cancelPendingLayerFlush() override;
-    void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
-    void invalidate() override;
-
-    void forceRepaint() override;
-    bool forceRepaintAsync(CallbackID) override;
-    void sizeDidChange(const WebCore::IntSize& newSize) override;
-
-    void deviceOrPageScaleFactorChanged() override;
-
-    void setVisibleContentsRect(const WebCore::FloatRect&);
-    void renderNextFrame(bool);
-
-    WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
-
-    void scheduleAnimation() override;
-
-    void setViewOverlayRootLayer(WebCore::GraphicsLayer*) override;
-
-    // CompositingCoordinator::Client
-    void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) override;
-    void notifyFlushRequired() override { scheduleLayerFlush(); };
-    void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
-
-    void flushLayersAndForceRepaint();
-
-private:
-    void layerFlushTimerFired();
-
-    CompositingCoordinator m_coordinator;
-    bool m_isWaitingForRenderer { false };
-    bool m_scheduledWhileWaitingForRenderer { false };
-    struct {
-        OptionalCallbackID callbackID;
-        bool needsFreshFlush { false };
-    } m_forceRepaintAsync;
-    RunLoop::Timer<CoordinatedLayerTreeHost> m_layerFlushTimer;
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
-
-#endif // CoordinatedLayerTreeHost_h
@@ -2,7 +2,7 @@
  * Copyright (C) 2011 Apple Inc. All rights reserved.
  * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
  * Copyright (C) 2012 Company 100, Inc.
- * Copyright (C) 2014 Igalia S.L.
+ * Copyright (C) 2014-2019 Igalia S.L.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  */
 
 #include "config.h"
-#include "ThreadedCoordinatedLayerTreeHost.h"
+#include "LayerTreeHost.h"
 
 #if USE(COORDINATED_GRAPHICS_THREADED)
 
-#include "AcceleratedSurface.h"
+#include "DrawingArea.h"
 #include "WebPage.h"
+#include "WebPageProxyMessages.h"
 #include <WebCore/Frame.h>
 #include <WebCore/FrameView.h>
+#include <WebCore/PageOverlayController.h>
+
+#if USE(GLIB_EVENT_LOOP)
+#include <wtf/glib/RunLoopSourcePriority.h>
+#endif
 
 namespace WebKit {
 using namespace WebCore;
@@ -46,21 +52,21 @@ static const PlatformDisplayID compositingDisplayID = 1;
 static const PlatformDisplayID compositingDisplayID = primaryDisplayID;
 #endif
 
-Ref<ThreadedCoordinatedLayerTreeHost> ThreadedCoordinatedLayerTreeHost::create(WebPage& webPage)
-{
-    return adoptRef(*new ThreadedCoordinatedLayerTreeHost(webPage));
-}
-
-ThreadedCoordinatedLayerTreeHost::~ThreadedCoordinatedLayerTreeHost()
-{
-}
-
-ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webPage)
-    : CoordinatedLayerTreeHost(webPage)
+LayerTreeHost::LayerTreeHost(WebPage& webPage)
+    : m_webPage(webPage)
+    , m_coordinator(webPage.corePage(), *this)
     , m_compositorClient(*this)
     , m_surface(AcceleratedSurface::create(webPage, *this))
     , m_viewportController(webPage.size())
+    , m_layerFlushTimer(RunLoop::main(), this, &LayerTreeHost::layerFlushTimerFired)
 {
+#if USE(GLIB_EVENT_LOOP)
+    m_layerFlushTimer.setPriority(RunLoopSourcePriority::LayerFlushTimer);
+    m_layerFlushTimer.setName("[WebKit] LayerTreeHost");
+#endif
+    m_coordinator.createRootLayer(m_webPage.size());
+    scheduleLayerFlush();
+
     if (FrameView* frameView = m_webPage.mainFrameView()) {
         auto contentsSize = frameView->contentsSize();
         if (!contentsSize.isEmpty())
@@ -87,70 +93,101 @@ ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webP
     didChangeViewport();
 }
 
-void ThreadedCoordinatedLayerTreeHost::invalidate()
+LayerTreeHost::~LayerTreeHost()
 {
-    m_compositor->invalidate();
-    CoordinatedLayerTreeHost::invalidate();
-    m_surface = nullptr;
+    ASSERT(!m_isValid);
 }
 
-void ThreadedCoordinatedLayerTreeHost::forceRepaint()
+void LayerTreeHost::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
 {
-    CoordinatedLayerTreeHost::forceRepaint();
-    m_compositor->forceRepaint();
+    if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
+        return;
+
+    m_layerFlushSchedulingEnabled = layerFlushingEnabled;
+
+    if (m_layerFlushSchedulingEnabled) {
+        scheduleLayerFlush();
+        return;
+    }
+
+    cancelPendingLayerFlush();
 }
 
-void ThreadedCoordinatedLayerTreeHost::frameComplete()
+void LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
 {
-    m_compositor->frameComplete();
+    m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
 }
 
-void ThreadedCoordinatedLayerTreeHost::requestDisplayRefreshMonitorUpdate()
+void LayerTreeHost::scheduleLayerFlush()
 {
-    // Flush layers to cause a repaint. If m_isWaitingForRenderer was true at this point, the layer
-    // flush won't do anything, but that means there's a painting ongoing that will send the
-    // display refresh notification when it's done.
-    flushLayersAndForceRepaint();
+    if (!m_layerFlushSchedulingEnabled)
+        return;
+
+    if (m_isWaitingForRenderer) {
+        m_scheduledWhileWaitingForRenderer = true;
+        return;
+    }
+
+    if (!m_layerFlushTimer.isActive())
+        m_layerFlushTimer.startOneShot(0_s);
 }
 
-void ThreadedCoordinatedLayerTreeHost::handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
+void LayerTreeHost::cancelPendingLayerFlush()
 {
-    // Call renderNextFrame. If hasBeenRescheduled is true, the layer flush will force a repaint
-    // that will cause the display refresh notification to come.
-    renderNextFrame(hasBeenRescheduled);
-    m_compositor->handleDisplayRefreshMonitorUpdate();
+    m_layerFlushTimer.stop();
 }
 
-uint64_t ThreadedCoordinatedLayerTreeHost::nativeSurfaceHandleForCompositing()
+void LayerTreeHost::layerFlushTimerFired()
 {
-    if (!m_surface)
-        return m_layerTreeContext.contextID;
+    if (m_isSuspended || m_isWaitingForRenderer)
+        return;
 
-    m_surface->initialize();
-    return m_surface->window();
+    m_coordinator.syncDisplayState();
+    m_webPage.flushPendingEditorStateUpdate();
+    m_webPage.willDisplayPage();
+
+    if (!m_isValid || !m_coordinator.rootCompositingLayer())
+        return;
+
+    // If a force-repaint callback was registered, we should force a 'frame sync' that
+    // will guarantee us a call to renderNextFrame() once the update is complete.
+    if (m_forceRepaintAsync.callbackID)
+        m_coordinator.forceFrameSync();
+
+    bool didSync = m_coordinator.flushPendingLayerChanges();
+
+    if (m_notifyAfterScheduledLayerFlush && didSync) {
+        m_webPage.drawingArea()->layerHostDidFlushLayers();
+        m_notifyAfterScheduledLayerFlush = false;
+    }
 }
 
-void ThreadedCoordinatedLayerTreeHost::didDestroyGLContext()
+void LayerTreeHost::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
 {
-    if (m_surface)
-        m_surface->finalize();
+    m_coordinator.setRootCompositingLayer(graphicsLayer);
 }
 
-void ThreadedCoordinatedLayerTreeHost::willRenderFrame()
+void LayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
 {
-    if (m_surface)
-        m_surface->willRenderFrame();
+    m_viewOverlayRootLayer = viewOverlayRootLayer;
+    m_coordinator.setViewOverlayRootLayer(viewOverlayRootLayer);
 }
 
-void ThreadedCoordinatedLayerTreeHost::didRenderFrame()
+void LayerTreeHost::invalidate()
 {
-    if (m_surface)
-        m_surface->didRenderFrame();
+    ASSERT(m_isValid);
+    m_isValid = false;
+
+    cancelPendingLayerFlush();
+
+    m_coordinator.invalidate();
+    m_compositor->invalidate();
+    m_surface = nullptr;
 }
 
-void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const IntRect& rect)
+void LayerTreeHost::scrollNonCompositedContents(const IntRect& rect)
 {
-    FrameView* frameView = m_webPage.mainFrameView();
+    auto* frameView = m_webPage.mainFrameView();
     if (!frameView || !frameView->delegatesScrolling())
         return;
 
@@ -161,30 +198,33 @@ void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const IntRect
         didChangeViewport();
 }
 
-void ThreadedCoordinatedLayerTreeHost::contentsSizeChanged(const IntSize& newSize)
+void LayerTreeHost::forceRepaint()
 {
-    m_viewportController.didChangeContentsSize(newSize);
-    if (m_isDiscardable)
-        m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
-    else
-        didChangeViewport();
+    // This is necessary for running layout tests. Since in this case we are not waiting for a UIProcess to reply nicely.
+    // Instead we are just triggering forceRepaint. But we still want to have the scripted animation callbacks being executed.
+    m_coordinator.syncDisplayState();
+
+    // We need to schedule another flush, otherwise the forced paint might cancel a later expected flush.
+    scheduleLayerFlush();
+
+    if (!m_isWaitingForRenderer)
+        m_coordinator.flushPendingLayerChanges();
+    m_compositor->forceRepaint();
 }
 
-void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
+bool LayerTreeHost::forceRepaintAsync(CallbackID callbackID)
 {
-    if (m_isDiscardable) {
-        m_discardableSyncActions.add(DiscardableSyncActions::UpdateScale);
-        return;
-    }
-
-    if (m_surface && m_surface->hostResize(m_webPage.size()))
-        m_layerTreeContext.contextID = m_surface->surfaceID();
+    scheduleLayerFlush();
 
-    CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged();
-    m_compositor->setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
+    // We want a clean repaint, meaning that if we're currently waiting for the renderer
+    // to finish an update, we'll have to schedule another flush when it's done.
+    ASSERT(!m_forceRepaintAsync.callbackID);
+    m_forceRepaintAsync.callbackID = OptionalCallbackID(callbackID);
+    m_forceRepaintAsync.needsFreshFlush = m_scheduledWhileWaitingForRenderer;
+    return true;
 }
 
-void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size)
+void LayerTreeHost::sizeDidChange(const IntSize& size)
 {
     if (m_isDiscardable) {
         m_discardableSyncActions.add(DiscardableSyncActions::UpdateSize);
@@ -195,7 +235,9 @@ void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size)
     if (m_surface && m_surface->hostResize(size))
         m_layerTreeContext.contextID = m_surface->surfaceID();
 
-    CoordinatedLayerTreeHost::sizeDidChange(size);
+    m_coordinator.sizeDidChange(size);
+    scheduleLayerFlush();
+
     m_viewportController.didChangeViewportSize(size);
     IntSize scaledSize(size);
     scaledSize.scale(m_webPage.deviceScaleFactor());
@@ -203,25 +245,41 @@ void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size)
     didChangeViewport();
 }
 
-void ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr)
+void LayerTreeHost::pauseRendering()
 {
-    m_viewportController.didChangeViewportAttributes(WTFMove(attr));
+    m_isSuspended = true;
+}
+
+void LayerTreeHost::resumeRendering()
+{
+    m_isSuspended = false;
+    scheduleLayerFlush();
+}
+
+GraphicsLayerFactory* LayerTreeHost::graphicsLayerFactory()
+{
+    return &m_coordinator;
+}
+
+void LayerTreeHost::contentsSizeChanged(const IntSize& newSize)
+{
+    m_viewportController.didChangeContentsSize(newSize);
     if (m_isDiscardable)
         m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
     else
         didChangeViewport();
 }
 
-#if PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
-void ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle)
+void LayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr)
 {
-    m_layerTreeContext.contextID = handle;
-    m_compositor->setNativeSurfaceHandleForCompositing(handle);
-    scheduleLayerFlush();
+    m_viewportController.didChangeViewportAttributes(WTFMove(attr));
+    if (m_isDiscardable)
+        m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
+    else
+        didChangeViewport();
 }
-#endif
 
-void ThreadedCoordinatedLayerTreeHost::didChangeViewport()
+void LayerTreeHost::didChangeViewport()
 {
     FloatRect visibleRect(m_viewportController.visibleContentsRect());
     if (visibleRect.isEmpty())
@@ -238,7 +296,8 @@ void ThreadedCoordinatedLayerTreeHost::didChangeViewport()
     if (scrollbar && !scrollbar->isOverlayScrollbar())
         visibleRect.expand(0, scrollbar->height());
 
-    CoordinatedLayerTreeHost::setVisibleContentsRect(visibleRect);
+    m_coordinator.setVisibleContentsRect(visibleRect);
+    scheduleLayerFlush();
 
     float pageScale = m_viewportController.pageScaleFactor();
     IntPoint scrollPosition = roundedIntPoint(visibleRect.location());
@@ -256,13 +315,7 @@ void ThreadedCoordinatedLayerTreeHost::didChangeViewport()
     }
 }
 
-void ThreadedCoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
-{
-    CoordinatedLayerTreeHost::commitSceneState(state);
-    m_compositor->updateSceneState(state);
-}
-
-void ThreadedCoordinatedLayerTreeHost::setIsDiscardable(bool discardable)
+void LayerTreeHost::setIsDiscardable(bool discardable)
 {
     m_isDiscardable = discardable;
     if (m_isDiscardable) {
@@ -288,13 +341,129 @@ void ThreadedCoordinatedLayerTreeHost::setIsDiscardable(bool discardable)
         didChangeViewport();
 }
 
+#if PLATFORM(GTK) && PLATFORM(X11) && !USE(REDIRECTED_XCOMPOSITE_WINDOW)
+void LayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle)
+{
+    m_layerTreeContext.contextID = handle;
+    m_compositor->setNativeSurfaceHandleForCompositing(handle);
+    scheduleLayerFlush();
+}
+#endif
+
+void LayerTreeHost::deviceOrPageScaleFactorChanged()
+{
+    if (m_isDiscardable) {
+        m_discardableSyncActions.add(DiscardableSyncActions::UpdateScale);
+        return;
+    }
+
+    if (m_surface && m_surface->hostResize(m_webPage.size()))
+        m_layerTreeContext.contextID = m_surface->surfaceID();
+
+    m_coordinator.deviceOrPageScaleFactorChanged();
+    m_webPage.corePage()->pageOverlayController().didChangeDeviceScaleFactor();
+    m_compositor->setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
+}
+
 #if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-RefPtr<WebCore::DisplayRefreshMonitor> ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor(PlatformDisplayID displayID)
+RefPtr<DisplayRefreshMonitor> LayerTreeHost::createDisplayRefreshMonitor(PlatformDisplayID displayID)
 {
     return m_compositor->displayRefreshMonitor(displayID);
 }
 #endif
 
+void LayerTreeHost::didFlushRootLayer(const FloatRect& visibleContentRect)
+{
+    // Because our view-relative overlay root layer is not attached to the FrameView's GraphicsLayer tree, we need to flush it manually.
+    if (m_viewOverlayRootLayer)
+        m_viewOverlayRootLayer->flushCompositingState(visibleContentRect);
+}
+
+void LayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
+{
+    m_isWaitingForRenderer = true;
+    m_compositor->updateSceneState(state);
+}
+
+void LayerTreeHost::frameComplete()
+{
+    m_compositor->frameComplete();
+}
+
+uint64_t LayerTreeHost::nativeSurfaceHandleForCompositing()
+{
+    if (!m_surface)
+        return m_layerTreeContext.contextID;
+
+    m_surface->initialize();
+    return m_surface->window();
+}
+
+void LayerTreeHost::didDestroyGLContext()
+{
+    if (m_surface)
+        m_surface->finalize();
+}
+
+void LayerTreeHost::willRenderFrame()
+{
+    if (m_surface)
+        m_surface->willRenderFrame();
+}
+
+void LayerTreeHost::didRenderFrame()
+{
+    if (m_surface)
+        m_surface->didRenderFrame();
+}
+
+void LayerTreeHost::requestDisplayRefreshMonitorUpdate()
+{
+    // Flush layers to cause a repaint. If m_isWaitingForRenderer was true at this point, the layer
+    // flush won't do anything, but that means there's a painting ongoing that will send the
+    // display refresh notification when it's done.
+    m_coordinator.forceFrameSync();
+    scheduleLayerFlush();
+}
+
+void LayerTreeHost::handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
+{
+    // Call renderNextFrame. If hasBeenRescheduled is true, the layer flush will force a repaint
+    // that will cause the display refresh notification to come.
+    renderNextFrame(hasBeenRescheduled);
+    m_compositor->handleDisplayRefreshMonitorUpdate();
+}
+
+void LayerTreeHost::renderNextFrame(bool forceRepaint)
+{
+    m_isWaitingForRenderer = false;
+    bool scheduledWhileWaitingForRenderer = std::exchange(m_scheduledWhileWaitingForRenderer, false);
+    m_coordinator.renderNextFrame();
+
+    if (m_forceRepaintAsync.callbackID) {
+        // If the asynchronous force-repaint needs a separate fresh flush, it was due to
+        // the force-repaint request being registered while CoordinatedLayerTreeHost was
+        // waiting for the renderer to finish an update.
+        ASSERT(!m_forceRepaintAsync.needsFreshFlush || scheduledWhileWaitingForRenderer);
+
+        // Execute the callback if another layer flush and the subsequent state update
+        // aren't needed. If they are, the callback will be executed when this function
+        // is called after the next update.
+        if (!m_forceRepaintAsync.needsFreshFlush) {
+            m_webPage.send(Messages::WebPageProxy::VoidCallback(m_forceRepaintAsync.callbackID.callbackID()));
+            m_forceRepaintAsync.callbackID = OptionalCallbackID();
+        }
+        m_forceRepaintAsync.needsFreshFlush = false;
+    }
+
+    if (scheduledWhileWaitingForRenderer || m_layerFlushTimer.isActive() || forceRepaint) {
+        m_layerFlushTimer.stop();
+        if (forceRepaint)
+            m_coordinator.forceFrameSync();
+        layerFlushTimerFired();
+    }
+}
+
 } // namespace WebKit
 
 #endif // USE(COORDINATED_GRAPHICS)
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h
new file mode 100644 (file)
index 0000000..945a3a3
--- /dev/null
@@ -0,0 +1,229 @@
+/*
+ * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
+ * Copyright (C) 2019 Igalia S.L.
+ *
+ * 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 "AcceleratedSurface.h"
+#include "CallbackID.h"
+#include "CompositingCoordinator.h"
+#include "LayerTreeContext.h"
+#include "OptionalCallbackID.h"
+#include "SimpleViewportController.h"
+#include "ThreadedCompositor.h"
+#include "ThreadedDisplayRefreshMonitor.h"
+#include <WebCore/PlatformScreen.h>
+#include <wtf/Forward.h>
+#include <wtf/OptionSet.h>
+#include <wtf/RunLoop.h>
+
+namespace WebCore {
+class IntRect;
+class IntSize;
+class GraphicsLayer;
+class GraphicsLayerFactory;
+struct CoordinatedGraphicsState;
+struct ViewportAttributes;
+}
+
+namespace WebKit {
+
+class WebPage;
+
+class LayerTreeHost
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    final : public CompositingCoordinator::Client, public AcceleratedSurface::Client
+#endif
+{
+    WTF_MAKE_FAST_ALLOCATED;
+public:
+    explicit LayerTreeHost(WebPage&);
+    ~LayerTreeHost();
+
+    const LayerTreeContext& layerTreeContext() const { return m_layerTreeContext; }
+    void setLayerFlushSchedulingEnabled(bool);
+    void setShouldNotifyAfterNextScheduledLayerFlush(bool);
+
+    void scheduleLayerFlush();
+    void cancelPendingLayerFlush();
+    void setRootCompositingLayer(WebCore::GraphicsLayer*);
+    void setViewOverlayRootLayer(WebCore::GraphicsLayer*);
+    void invalidate();
+
+    void scrollNonCompositedContents(const WebCore::IntRect&);
+    void forceRepaint();
+    bool forceRepaintAsync(CallbackID);
+    void sizeDidChange(const WebCore::IntSize& newSize);
+
+    void pauseRendering();
+    void resumeRendering();
+
+    WebCore::GraphicsLayerFactory* graphicsLayerFactory();
+
+    void contentsSizeChanged(const WebCore::IntSize&);
+    void didChangeViewportAttributes(WebCore::ViewportAttributes&&);
+
+    void setIsDiscardable(bool);
+
+#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
+    void setNativeSurfaceHandleForCompositing(uint64_t);
+#endif
+
+    void deviceOrPageScaleFactorChanged();
+
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+    RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID);
+#endif
+
+private:
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    void layerFlushTimerFired();
+    void didChangeViewport();
+    void renderNextFrame(bool);
+
+    // CompositingCoordinator::Client
+    void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) override;
+    void notifyFlushRequired() override { scheduleLayerFlush(); };
+    void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
+
+    // AcceleratedSurface::Client
+    void frameComplete() override;
+
+    uint64_t nativeSurfaceHandleForCompositing();
+    void didDestroyGLContext();
+    void willRenderFrame();
+    void didRenderFrame();
+    void requestDisplayRefreshMonitorUpdate();
+    void handleDisplayRefreshMonitorUpdate(bool);
+
+    class CompositorClient final : public ThreadedCompositor::Client, public ThreadedDisplayRefreshMonitor::Client  {
+        WTF_MAKE_NONCOPYABLE(CompositorClient);
+    public:
+        CompositorClient(LayerTreeHost& layerTreeHost)
+            : m_layerTreeHost(layerTreeHost)
+        {
+        }
+
+    private:
+        uint64_t nativeSurfaceHandleForCompositing() override
+        {
+            return m_layerTreeHost.nativeSurfaceHandleForCompositing();
+        }
+
+        void didDestroyGLContext() override
+        {
+            m_layerTreeHost.didDestroyGLContext();
+        }
+
+        void resize(const WebCore::IntSize& size)
+        {
+            if (m_layerTreeHost.m_surface)
+                m_layerTreeHost.m_surface->clientResize(size);
+        }
+
+        void willRenderFrame() override
+        {
+            m_layerTreeHost.willRenderFrame();
+        }
+
+        void didRenderFrame() override
+        {
+            m_layerTreeHost.didRenderFrame();
+        }
+
+        void requestDisplayRefreshMonitorUpdate() override
+        {
+            m_layerTreeHost.requestDisplayRefreshMonitorUpdate();
+        }
+
+        void handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
+        {
+            m_layerTreeHost.handleDisplayRefreshMonitorUpdate(hasBeenRescheduled);
+        }
+
+        LayerTreeHost& m_layerTreeHost;
+    };
+
+    enum class DiscardableSyncActions {
+        UpdateSize = 1 << 1,
+        UpdateViewport = 1 << 2,
+        UpdateScale = 1 << 3
+    };
+#endif // USE(COORDINATED_GRAPHICS_THREADED)
+
+    WebPage& m_webPage;
+    LayerTreeContext m_layerTreeContext;
+#if USE(COORDINATED_GRAPHICS_THREADED)
+    bool m_layerFlushSchedulingEnabled { true };
+    bool m_notifyAfterScheduledLayerFlush { false };
+    bool m_isSuspended { false };
+    bool m_isValid { true };
+    bool m_isWaitingForRenderer { false };
+    bool m_scheduledWhileWaitingForRenderer { false };
+    float m_lastPageScaleFactor { 1 };
+    WebCore::IntPoint m_lastScrollPosition;
+    bool m_isDiscardable { false };
+    OptionSet<DiscardableSyncActions> m_discardableSyncActions;
+    WebCore::GraphicsLayer* m_viewOverlayRootLayer { nullptr };
+    CompositingCoordinator m_coordinator;
+    CompositorClient m_compositorClient;
+    std::unique_ptr<AcceleratedSurface> m_surface;
+    RefPtr<ThreadedCompositor> m_compositor;
+    SimpleViewportController m_viewportController;
+    struct {
+        OptionalCallbackID callbackID;
+        bool needsFreshFlush { false };
+    } m_forceRepaintAsync;
+    RunLoop::Timer<LayerTreeHost> m_layerFlushTimer;
+#endif // USE(COORDINATED_GRAPHICS_THREADED)
+};
+
+#if !USE(COORDINATED_GRAPHICS_THREADED)
+inline LayerTreeHost::LayerTreeHost(WebPage& webPage) : m_webPage(webPage) { }
+inline LayerTreeHost::~LayerTreeHost() { }
+inline void LayerTreeHost::setLayerFlushSchedulingEnabled(bool) { }
+inline void LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool) { }
+inline void LayerTreeHost::scheduleLayerFlush() { }
+inline void LayerTreeHost::cancelPendingLayerFlush() { }
+inline void LayerTreeHost::setRootCompositingLayer(WebCore::GraphicsLayer*) { }
+inline void LayerTreeHost::setViewOverlayRootLayer(WebCore::GraphicsLayer*) { }
+inline void LayerTreeHost::invalidate() { }
+inline void LayerTreeHost::scrollNonCompositedContents(const WebCore::IntRect&) { }
+inline void LayerTreeHost::forceRepaint() { }
+inline bool LayerTreeHost::forceRepaintAsync(CallbackID) { return false; }
+inline void LayerTreeHost::sizeDidChange(const WebCore::IntSize&) { }
+inline void LayerTreeHost::pauseRendering() { }
+inline void LayerTreeHost::resumeRendering() { }
+inline WebCore::GraphicsLayerFactory* LayerTreeHost::graphicsLayerFactory() { return nullptr; }
+inline void LayerTreeHost::contentsSizeChanged(const WebCore::IntSize&) { }
+inline void LayerTreeHost::didChangeViewportAttributes(WebCore::ViewportAttributes&&) { }
+inline void LayerTreeHost::setIsDiscardable(bool) { }
+inline void LayerTreeHost::deviceOrPageScaleFactorChanged() { }
+#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+inline RefPtr<WebCore::DisplayRefreshMonitor> LayerTreeHost::createDisplayRefreshMonitor(WebCore::PlatformDisplayID) { return nullptr; }
+#endif
+#endif
+
+} // namespace WebKit
diff --git a/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h
deleted file mode 100644 (file)
index 2287616..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/*
- * Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies)
- * Copyright (C) 2013 Company 100, Inc.
- * Copyright (C) 2014 Igalia S.L.
- *
- * 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
-
-#if USE(COORDINATED_GRAPHICS_THREADED)
-
-#include "AcceleratedSurface.h"
-#include "CoordinatedLayerTreeHost.h"
-#include "SimpleViewportController.h"
-#include "ThreadedCompositor.h"
-#include "ThreadedDisplayRefreshMonitor.h"
-#include <wtf/OptionSet.h>
-
-namespace WebCore {
-class GraphicsContext;
-class GraphicsLayer;
-struct CoordinatedGraphicsState;
-}
-
-namespace WebKit {
-
-class WebPage;
-
-class ThreadedCoordinatedLayerTreeHost final : public CoordinatedLayerTreeHost, public AcceleratedSurface::Client {
-public:
-    static Ref<ThreadedCoordinatedLayerTreeHost> create(WebPage&);
-    virtual ~ThreadedCoordinatedLayerTreeHost();
-
-private:
-    explicit ThreadedCoordinatedLayerTreeHost(WebPage&);
-
-    void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override;
-    void sizeDidChange(const WebCore::IntSize&) override;
-    void deviceOrPageScaleFactorChanged() override;
-
-    void contentsSizeChanged(const WebCore::IntSize&) override;
-    void didChangeViewportAttributes(WebCore::ViewportAttributes&&) override;
-
-    void invalidate() override;
-
-    void forceRepaint() override;
-
-    void setIsDiscardable(bool) override;
-
-#if PLATFORM(GTK) && PLATFORM(X11) &&  !USE(REDIRECTED_XCOMPOSITE_WINDOW)
-    void setNativeSurfaceHandleForCompositing(uint64_t) override;
-#endif
-
-    class CompositorClient final : public ThreadedCompositor::Client, public ThreadedDisplayRefreshMonitor::Client  {
-        WTF_MAKE_NONCOPYABLE(CompositorClient);
-    public:
-        CompositorClient(ThreadedCoordinatedLayerTreeHost& layerTreeHost)
-            : m_layerTreeHost(layerTreeHost)
-        {
-        }
-
-    private:
-        uint64_t nativeSurfaceHandleForCompositing() override
-        {
-            return m_layerTreeHost.nativeSurfaceHandleForCompositing();
-        }
-
-        void didDestroyGLContext() override
-        {
-            m_layerTreeHost.didDestroyGLContext();
-        }
-
-        void resize(const WebCore::IntSize& size)
-        {
-            if (m_layerTreeHost.m_surface)
-                m_layerTreeHost.m_surface->clientResize(size);
-        }
-
-        void willRenderFrame() override
-        {
-            m_layerTreeHost.willRenderFrame();
-        }
-
-        void didRenderFrame() override
-        {
-            m_layerTreeHost.didRenderFrame();
-        }
-
-        void requestDisplayRefreshMonitorUpdate() override
-        {
-            m_layerTreeHost.requestDisplayRefreshMonitorUpdate();
-        }
-
-        void handleDisplayRefreshMonitorUpdate(bool hasBeenRescheduled)
-        {
-            m_layerTreeHost.handleDisplayRefreshMonitorUpdate(hasBeenRescheduled);
-        }
-
-        ThreadedCoordinatedLayerTreeHost& m_layerTreeHost;
-    };
-
-    void didChangeViewport();
-
-    // CompositingCoordinator::Client
-    void didFlushRootLayer(const WebCore::FloatRect&) override { }
-    void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
-
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-    RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) override;
-#endif
-
-    // AcceleratedSurface::Client
-    void frameComplete() override;
-
-    uint64_t nativeSurfaceHandleForCompositing();
-    void didDestroyGLContext();
-    void willRenderFrame();
-    void didRenderFrame();
-    void requestDisplayRefreshMonitorUpdate();
-    void handleDisplayRefreshMonitorUpdate(bool);
-
-    enum class DiscardableSyncActions {
-        UpdateSize = 1 << 1,
-        UpdateViewport = 1 << 2,
-        UpdateScale = 1 << 3
-    };
-
-    CompositorClient m_compositorClient;
-    std::unique_ptr<AcceleratedSurface> m_surface;
-    RefPtr<ThreadedCompositor> m_compositor;
-    SimpleViewportController m_viewportController;
-    float m_lastPageScaleFactor { 1 };
-    WebCore::IntPoint m_lastScrollPosition;
-    bool m_isDiscardable { false };
-    OptionSet<DiscardableSyncActions> m_discardableSyncActions;
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS_THREADED)
index 44eb2db..63d515a 100644 (file)
@@ -61,7 +61,6 @@ void DrawingAreaImpl::setNeedsDisplay()
 {
     if (m_layerTreeHost) {
         ASSERT(m_dirtyRegion.isEmpty());
-        AcceleratedDrawingArea::setNeedsDisplay();
         return;
     }
 
@@ -72,7 +71,6 @@ void DrawingAreaImpl::setNeedsDisplayInRect(const IntRect& rect)
 {
     if (m_layerTreeHost) {
         ASSERT(m_dirtyRegion.isEmpty());
-        AcceleratedDrawingArea::setNeedsDisplayInRect(rect);
         return;
     }
 
diff --git a/Source/WebKit/WebProcess/WebPage/LayerTreeHost.cpp b/Source/WebKit/WebProcess/WebPage/LayerTreeHost.cpp
deleted file mode 100644 (file)
index 727fb0c..0000000
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright (C) 2011 Apple Inc. All rights reserved.
- *
- * 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 "config.h"
-
-#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-
-#include "LayerTreeHost.h"
-
-#if USE(COORDINATED_GRAPHICS_THREADED)
-#include "ThreadedCoordinatedLayerTreeHost.h"
-#endif
-
-namespace WebKit {
-using namespace WebCore;
-
-RefPtr<LayerTreeHost> LayerTreeHost::create(WebPage& webPage)
-{
-#if USE(COORDINATED_GRAPHICS_THREADED)
-    return ThreadedCoordinatedLayerTreeHost::create(webPage);
-#else
-    UNUSED_PARAM(webPage);
-    return nullptr;
-#endif
-}
-
-LayerTreeHost::LayerTreeHost(WebPage& webPage)
-    : m_webPage(webPage)
-{
-}
-
-LayerTreeHost::~LayerTreeHost()
-{
-    ASSERT(!m_isValid);
-}
-
-void LayerTreeHost::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
-{
-    if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
-        return;
-
-    m_layerFlushSchedulingEnabled = layerFlushingEnabled;
-
-    if (m_layerFlushSchedulingEnabled) {
-        scheduleLayerFlush();
-        return;
-    }
-
-    cancelPendingLayerFlush();
-}
-
-void LayerTreeHost::pauseRendering()
-{
-    m_isSuspended = true;
-}
-
-void LayerTreeHost::resumeRendering()
-{
-    m_isSuspended = false;
-    scheduleLayerFlush();
-}
-
-void LayerTreeHost::invalidate()
-{
-    ASSERT(m_isValid);
-    m_isValid = false;
-}
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
diff --git a/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h b/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h
deleted file mode 100644 (file)
index 53c3982..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- * Copyright (C) 2011, 2012 Apple Inc. All rights reserved.
- *
- * 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 LayerTreeHost_h
-#define LayerTreeHost_h
-
-#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-
-#include "CallbackID.h"
-#include "LayerTreeContext.h"
-#include <WebCore/DisplayRefreshMonitor.h>
-#include <WebCore/PlatformScreen.h>
-#include <wtf/Forward.h>
-#include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
-
-namespace IPC {
-class Connection;
-}
-
-namespace WebCore {
-class IntRect;
-class IntSize;
-class GraphicsLayer;
-class GraphicsLayerFactory;
-#if USE(COORDINATED_GRAPHICS_THREADED)
-struct ViewportAttributes;
-#endif
-}
-
-namespace WebKit {
-
-class WebPage;
-
-class LayerTreeHost : public RefCounted<LayerTreeHost> {
-public:
-    static RefPtr<LayerTreeHost> create(WebPage&);
-    virtual ~LayerTreeHost();
-
-    const LayerTreeContext& layerTreeContext() const { return m_layerTreeContext; }
-    void setLayerFlushSchedulingEnabled(bool);
-    void setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush) { m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush; }
-
-    virtual void scheduleLayerFlush() = 0;
-    virtual void cancelPendingLayerFlush() = 0;
-    virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
-    virtual void invalidate();
-
-    virtual void setNonCompositedContentsNeedDisplay() { };
-    virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) { };
-    virtual void scrollNonCompositedContents(const WebCore::IntRect&) { };
-    virtual void forceRepaint() = 0;
-    virtual bool forceRepaintAsync(CallbackID) { return false; }
-    virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
-
-    virtual void pauseRendering();
-    virtual void resumeRendering();
-
-    virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return nullptr; }
-
-#if USE(COORDINATED_GRAPHICS_THREADED)
-    virtual void contentsSizeChanged(const WebCore::IntSize&) { };
-    virtual void didChangeViewportAttributes(WebCore::ViewportAttributes&&) { };
-#endif
-
-#if USE(COORDINATED_GRAPHICS)
-    virtual void scheduleAnimation() = 0;
-    virtual void setIsDiscardable(bool) { };
-#endif
-
-#if USE(TEXTURE_MAPPER_GL) && PLATFORM(GTK)
-    virtual void setNativeSurfaceHandleForCompositing(uint64_t) { };
-#endif
-
-#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-    virtual void deviceOrPageScaleFactorChanged() = 0;
-#endif
-
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-    virtual RefPtr<WebCore::DisplayRefreshMonitor> createDisplayRefreshMonitor(WebCore::PlatformDisplayID) { return nullptr; }
-#endif
-
-    virtual void setViewOverlayRootLayer(WebCore::GraphicsLayer* viewOverlayRootLayer) { m_viewOverlayRootLayer = viewOverlayRootLayer; }
-
-protected:
-    explicit LayerTreeHost(WebPage&);
-
-    WebPage& m_webPage;
-    LayerTreeContext m_layerTreeContext;
-    bool m_layerFlushSchedulingEnabled { true };
-    bool m_notifyAfterScheduledLayerFlush { false };
-    bool m_isSuspended { false };
-    bool m_isValid { true };
-    WebCore::GraphicsLayer* m_viewOverlayRootLayer { nullptr };
-};
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
-
-#endif // LayerTreeHost_h