Diff
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/ChangeLog 2019-04-08 10:14:39 UTC (rev 243980)
@@ -1,3 +1,64 @@
+2019-02-28 Carlos Garcia Campos <[email protected]>
+
+ [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-03-01 Carlos Garcia Campos <[email protected]>
[ThreadedCompositor] Simply the compositing run loop worker thread
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/PlatformWin.cmake (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/PlatformWin.cmake 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/PlatformWin.cmake 2019-04-08 10:14:39 UTC (rev 243980)
@@ -81,11 +81,9 @@
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
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/Shared/CoordinatedGraphics/threadedcompositor/ThreadedDisplayRefreshMonitor.h 2019-04-08 10:14:39 UTC (rev 243980)
@@ -25,9 +25,9 @@
#pragma once
+#include <WebCore/DisplayRefreshMonitor.h>
+
#if USE(COORDINATED_GRAPHICS_THREADED) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-
-#include <WebCore/DisplayRefreshMonitor.h>
#include <wtf/RunLoop.h>
namespace WebKit {
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/SourcesGTK.txt (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/SourcesGTK.txt 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/SourcesGTK.txt 2019-04-08 10:14:39 UTC (rev 243980)
@@ -401,12 +401,10 @@
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
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/SourcesWPE.txt (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/SourcesWPE.txt 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/SourcesWPE.txt 2019-04-08 10:14:39 UTC (rev 243980)
@@ -241,11 +241,9 @@
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
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.cpp 2019-04-08 10:14:39 UTC (rev 243980)
@@ -66,24 +66,6 @@
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,7 +325,6 @@
ASSERT(!m_layerTreeHost);
if (m_previousLayerTreeHost) {
-#if USE(COORDINATED_GRAPHICS)
m_layerTreeHost = WTFMove(m_previousLayerTreeHost);
m_layerTreeHost->setIsDiscardable(false);
if (!m_isPaintingSuspended)
@@ -350,12 +331,13 @@
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,7 +375,6 @@
m_exitCompositingTimer.stop();
m_wantsToExitAcceleratedCompositingMode = false;
-#if USE(COORDINATED_GRAPHICS)
ASSERT(m_layerTreeHost);
m_previousLayerTreeHost = WTFMove(m_layerTreeHost);
m_previousLayerTreeHost->setIsDiscardable(true);
@@ -400,9 +381,6 @@
m_previousLayerTreeHost->pauseRendering();
m_previousLayerTreeHost->setLayerFlushSchedulingEnabled(false);
m_discardPreviousLayerTreeHostTimer.startOneShot(5_s);
-#else
- m_layerTreeHost = nullptr;
-#endif
}
void AcceleratedDrawingArea::discardPreviousLayerTreeHost()
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/AcceleratedDrawingArea.h 2019-04-08 10:14:39 UTC (rev 243980)
@@ -40,8 +40,8 @@
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 @@
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;
};
Deleted: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2019-04-08 10:14:39 UTC (rev 243980)
@@ -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)
Deleted: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2019-04-08 10:14:39 UTC (rev 243980)
@@ -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
Copied: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp (from rev 243979, releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp) (0 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp (rev 0)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.cpp 2019-04-08 10:14:39 UTC (rev 243980)
@@ -0,0 +1,469 @@
+/*
+ * 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-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.
+ */
+
+#include "config.h"
+#include "LayerTreeHost.h"
+
+#if USE(COORDINATED_GRAPHICS_THREADED)
+
+#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;
+
+static const PlatformDisplayID primaryDisplayID = 0;
+#if PLATFORM(GTK)
+static const PlatformDisplayID compositingDisplayID = 1;
+#else
+static const PlatformDisplayID compositingDisplayID = primaryDisplayID;
+#endif
+
+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())
+ m_viewportController.didChangeContentsSize(contentsSize);
+ }
+
+ IntSize scaledSize(m_webPage.size());
+ scaledSize.scale(m_webPage.deviceScaleFactor());
+ float scaleFactor = m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor();
+
+ if (m_surface) {
+ TextureMapper::PaintFlags paintFlags = 0;
+
+ if (m_surface->shouldPaintMirrored())
+ paintFlags |= TextureMapper::PaintingMirrored;
+
+ m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, compositingDisplayID, scaledSize, scaleFactor, ThreadedCompositor::ShouldDoFrameSync::Yes, paintFlags);
+ m_layerTreeContext.contextID = m_surface->surfaceID();
+ } else
+ m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, compositingDisplayID, scaledSize, scaleFactor);
+
+ m_webPage.windowScreenDidChange(compositingDisplayID);
+
+ didChangeViewport();
+}
+
+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::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
+{
+ m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
+}
+
+void LayerTreeHost::scheduleLayerFlush()
+{
+ if (!m_layerFlushSchedulingEnabled)
+ return;
+
+ if (m_isWaitingForRenderer) {
+ m_scheduledWhileWaitingForRenderer = true;
+ return;
+ }
+
+ if (!m_layerFlushTimer.isActive())
+ m_layerFlushTimer.startOneShot(0_s);
+}
+
+void LayerTreeHost::cancelPendingLayerFlush()
+{
+ m_layerFlushTimer.stop();
+}
+
+void LayerTreeHost::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 LayerTreeHost::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
+{
+ m_coordinator.setRootCompositingLayer(graphicsLayer);
+}
+
+void LayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
+{
+ m_viewOverlayRootLayer = viewOverlayRootLayer;
+ m_coordinator.setViewOverlayRootLayer(viewOverlayRootLayer);
+}
+
+void LayerTreeHost::invalidate()
+{
+ ASSERT(m_isValid);
+ m_isValid = false;
+
+ cancelPendingLayerFlush();
+
+ m_coordinator.invalidate();
+ m_compositor->invalidate();
+ m_surface = nullptr;
+}
+
+void LayerTreeHost::scrollNonCompositedContents(const IntRect& rect)
+{
+ auto* frameView = m_webPage.mainFrameView();
+ if (!frameView || !frameView->delegatesScrolling())
+ return;
+
+ m_viewportController.didScroll(rect.location());
+ if (m_isDiscardable)
+ m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
+ else
+ didChangeViewport();
+}
+
+void LayerTreeHost::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.
+ scheduleLayerFlush();
+
+ if (!m_isWaitingForRenderer)
+ m_coordinator.flushPendingLayerChanges();
+ m_compositor->forceRepaint();
+}
+
+bool LayerTreeHost::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 LayerTreeHost::sizeDidChange(const IntSize& size)
+{
+ if (m_isDiscardable) {
+ m_discardableSyncActions.add(DiscardableSyncActions::UpdateSize);
+ m_viewportController.didChangeViewportSize(size);
+ return;
+ }
+
+ if (m_surface && m_surface->hostResize(size))
+ m_layerTreeContext.contextID = m_surface->surfaceID();
+
+ m_coordinator.sizeDidChange(size);
+ scheduleLayerFlush();
+
+ m_viewportController.didChangeViewportSize(size);
+ IntSize scaledSize(size);
+ scaledSize.scale(m_webPage.deviceScaleFactor());
+ m_compositor->setViewportSize(scaledSize, m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
+ didChangeViewport();
+}
+
+void LayerTreeHost::pauseRendering()
+{
+ 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();
+}
+
+void LayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr)
+{
+ m_viewportController.didChangeViewportAttributes(WTFMove(attr));
+ if (m_isDiscardable)
+ m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
+ else
+ didChangeViewport();
+}
+
+void LayerTreeHost::didChangeViewport()
+{
+ FloatRect visibleRect(m_viewportController.visibleContentsRect());
+ if (visibleRect.isEmpty())
+ return;
+
+ // When using non overlay scrollbars, the contents size doesn't include the scrollbars, but we need to include them
+ // in the visible area used by the compositor to ensure that the scrollbar layers are also updated.
+ // See https://bugs.webkit.org/show_bug.cgi?id=160450.
+ FrameView* view = m_webPage.corePage()->mainFrame().view();
+ Scrollbar* scrollbar = view->verticalScrollbar();
+ if (scrollbar && !scrollbar->isOverlayScrollbar())
+ visibleRect.expand(scrollbar->width(), 0);
+ scrollbar = view->horizontalScrollbar();
+ if (scrollbar && !scrollbar->isOverlayScrollbar())
+ visibleRect.expand(0, scrollbar->height());
+
+ m_coordinator.setVisibleContentsRect(visibleRect);
+ scheduleLayerFlush();
+
+ float pageScale = m_viewportController.pageScaleFactor();
+ IntPoint scrollPosition = roundedIntPoint(visibleRect.location());
+ if (m_lastScrollPosition != scrollPosition) {
+ m_lastScrollPosition = scrollPosition;
+ m_compositor->setScrollPosition(m_lastScrollPosition, m_webPage.deviceScaleFactor() * pageScale);
+
+ if (!view->useFixedLayout())
+ view->notifyScrollPositionChanged(m_lastScrollPosition);
+ }
+
+ if (m_lastPageScaleFactor != pageScale) {
+ m_lastPageScaleFactor = pageScale;
+ m_webPage.scalePage(pageScale, m_lastScrollPosition);
+ }
+}
+
+void LayerTreeHost::setIsDiscardable(bool discardable)
+{
+ m_isDiscardable = discardable;
+ if (m_isDiscardable) {
+ m_discardableSyncActions = OptionSet<DiscardableSyncActions>();
+ m_webPage.windowScreenDidChange(primaryDisplayID);
+ return;
+ }
+ m_webPage.windowScreenDidChange(compositingDisplayID);
+
+ if (m_discardableSyncActions.isEmpty())
+ return;
+
+ if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateSize)) {
+ // Size changes already sets the scale factor and updates the viewport.
+ sizeDidChange(m_webPage.size());
+ return;
+ }
+
+ if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateScale))
+ deviceOrPageScaleFactorChanged();
+
+ if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateViewport))
+ 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<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)
Added: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h (0 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h (rev 0)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/LayerTreeHost.h 2019-04-08 10:14:39 UTC (rev 243980)
@@ -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
Deleted: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 2019-04-08 10:14:39 UTC (rev 243980)
@@ -1,300 +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.
- * 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.
- */
-
-#include "config.h"
-#include "ThreadedCoordinatedLayerTreeHost.h"
-
-#if USE(COORDINATED_GRAPHICS_THREADED)
-
-#include "AcceleratedSurface.h"
-#include "WebPage.h"
-#include <WebCore/Frame.h>
-#include <WebCore/FrameView.h>
-
-namespace WebKit {
-using namespace WebCore;
-
-static const PlatformDisplayID primaryDisplayID = 0;
-#if PLATFORM(GTK)
-static const PlatformDisplayID compositingDisplayID = 1;
-#else
-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)
- , m_compositorClient(*this)
- , m_surface(AcceleratedSurface::create(webPage, *this))
- , m_viewportController(webPage.size())
-{
- if (FrameView* frameView = m_webPage.mainFrameView()) {
- auto contentsSize = frameView->contentsSize();
- if (!contentsSize.isEmpty())
- m_viewportController.didChangeContentsSize(contentsSize);
- }
-
- IntSize scaledSize(m_webPage.size());
- scaledSize.scale(m_webPage.deviceScaleFactor());
- float scaleFactor = m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor();
-
- if (m_surface) {
- TextureMapper::PaintFlags paintFlags = 0;
-
- if (m_surface->shouldPaintMirrored())
- paintFlags |= TextureMapper::PaintingMirrored;
-
- m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, compositingDisplayID, scaledSize, scaleFactor, ThreadedCompositor::ShouldDoFrameSync::Yes, paintFlags);
- m_layerTreeContext.contextID = m_surface->surfaceID();
- } else
- m_compositor = ThreadedCompositor::create(m_compositorClient, m_compositorClient, compositingDisplayID, scaledSize, scaleFactor);
-
- m_webPage.windowScreenDidChange(compositingDisplayID);
-
- didChangeViewport();
-}
-
-void ThreadedCoordinatedLayerTreeHost::invalidate()
-{
- m_compositor->invalidate();
- CoordinatedLayerTreeHost::invalidate();
- m_surface = nullptr;
-}
-
-void ThreadedCoordinatedLayerTreeHost::forceRepaint()
-{
- CoordinatedLayerTreeHost::forceRepaint();
- m_compositor->forceRepaint();
-}
-
-void ThreadedCoordinatedLayerTreeHost::frameComplete()
-{
- m_compositor->frameComplete();
-}
-
-void ThreadedCoordinatedLayerTreeHost::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.
- flushLayersAndForceRepaint();
-}
-
-void ThreadedCoordinatedLayerTreeHost::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();
-}
-
-uint64_t ThreadedCoordinatedLayerTreeHost::nativeSurfaceHandleForCompositing()
-{
- if (!m_surface)
- return m_layerTreeContext.contextID;
-
- m_surface->initialize();
- return m_surface->window();
-}
-
-void ThreadedCoordinatedLayerTreeHost::didDestroyGLContext()
-{
- if (m_surface)
- m_surface->finalize();
-}
-
-void ThreadedCoordinatedLayerTreeHost::willRenderFrame()
-{
- if (m_surface)
- m_surface->willRenderFrame();
-}
-
-void ThreadedCoordinatedLayerTreeHost::didRenderFrame()
-{
- if (m_surface)
- m_surface->didRenderFrame();
-}
-
-void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const IntRect& rect)
-{
- FrameView* frameView = m_webPage.mainFrameView();
- if (!frameView || !frameView->delegatesScrolling())
- return;
-
- m_viewportController.didScroll(rect.location());
- if (m_isDiscardable)
- m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
- else
- didChangeViewport();
-}
-
-void ThreadedCoordinatedLayerTreeHost::contentsSizeChanged(const IntSize& newSize)
-{
- m_viewportController.didChangeContentsSize(newSize);
- if (m_isDiscardable)
- m_discardableSyncActions.add(DiscardableSyncActions::UpdateViewport);
- else
- didChangeViewport();
-}
-
-void ThreadedCoordinatedLayerTreeHost::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();
-
- CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged();
- m_compositor->setScaleFactor(m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
-}
-
-void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size)
-{
- if (m_isDiscardable) {
- m_discardableSyncActions.add(DiscardableSyncActions::UpdateSize);
- m_viewportController.didChangeViewportSize(size);
- return;
- }
-
- if (m_surface && m_surface->hostResize(size))
- m_layerTreeContext.contextID = m_surface->surfaceID();
-
- CoordinatedLayerTreeHost::sizeDidChange(size);
- m_viewportController.didChangeViewportSize(size);
- IntSize scaledSize(size);
- scaledSize.scale(m_webPage.deviceScaleFactor());
- m_compositor->setViewportSize(scaledSize, m_webPage.deviceScaleFactor() * m_viewportController.pageScaleFactor());
- didChangeViewport();
-}
-
-void ThreadedCoordinatedLayerTreeHost::didChangeViewportAttributes(ViewportAttributes&& attr)
-{
- m_viewportController.didChangeViewportAttributes(WTFMove(attr));
- 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)
-{
- m_layerTreeContext.contextID = handle;
- m_compositor->setNativeSurfaceHandleForCompositing(handle);
- scheduleLayerFlush();
-}
-#endif
-
-void ThreadedCoordinatedLayerTreeHost::didChangeViewport()
-{
- FloatRect visibleRect(m_viewportController.visibleContentsRect());
- if (visibleRect.isEmpty())
- return;
-
- // When using non overlay scrollbars, the contents size doesn't include the scrollbars, but we need to include them
- // in the visible area used by the compositor to ensure that the scrollbar layers are also updated.
- // See https://bugs.webkit.org/show_bug.cgi?id=160450.
- FrameView* view = m_webPage.corePage()->mainFrame().view();
- Scrollbar* scrollbar = view->verticalScrollbar();
- if (scrollbar && !scrollbar->isOverlayScrollbar())
- visibleRect.expand(scrollbar->width(), 0);
- scrollbar = view->horizontalScrollbar();
- if (scrollbar && !scrollbar->isOverlayScrollbar())
- visibleRect.expand(0, scrollbar->height());
-
- CoordinatedLayerTreeHost::setVisibleContentsRect(visibleRect);
-
- float pageScale = m_viewportController.pageScaleFactor();
- IntPoint scrollPosition = roundedIntPoint(visibleRect.location());
- if (m_lastScrollPosition != scrollPosition) {
- m_lastScrollPosition = scrollPosition;
- m_compositor->setScrollPosition(m_lastScrollPosition, m_webPage.deviceScaleFactor() * pageScale);
-
- if (!view->useFixedLayout())
- view->notifyScrollPositionChanged(m_lastScrollPosition);
- }
-
- if (m_lastPageScaleFactor != pageScale) {
- m_lastPageScaleFactor = pageScale;
- m_webPage.scalePage(pageScale, m_lastScrollPosition);
- }
-}
-
-void ThreadedCoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
-{
- CoordinatedLayerTreeHost::commitSceneState(state);
- m_compositor->updateSceneState(state);
-}
-
-void ThreadedCoordinatedLayerTreeHost::setIsDiscardable(bool discardable)
-{
- m_isDiscardable = discardable;
- if (m_isDiscardable) {
- m_discardableSyncActions = OptionSet<DiscardableSyncActions>();
- m_webPage.windowScreenDidChange(primaryDisplayID);
- return;
- }
- m_webPage.windowScreenDidChange(compositingDisplayID);
-
- if (m_discardableSyncActions.isEmpty())
- return;
-
- if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateSize)) {
- // Size changes already sets the scale factor and updates the viewport.
- sizeDidChange(m_webPage.size());
- return;
- }
-
- if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateScale))
- deviceOrPageScaleFactorChanged();
-
- if (m_discardableSyncActions.contains(DiscardableSyncActions::UpdateViewport))
- didChangeViewport();
-}
-
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-RefPtr<WebCore::DisplayRefreshMonitor> ThreadedCoordinatedLayerTreeHost::createDisplayRefreshMonitor(PlatformDisplayID displayID)
-{
- return m_compositor->displayRefreshMonitor(displayID);
-}
-#endif
-
-} // namespace WebKit
-
-#endif // USE(COORDINATED_GRAPHICS)
Deleted: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h 2019-04-08 10:14:39 UTC (rev 243980)
@@ -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)
Modified: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/DrawingAreaImpl.cpp 2019-04-08 10:14:39 UTC (rev 243980)
@@ -61,7 +61,6 @@
{
if (m_layerTreeHost) {
ASSERT(m_dirtyRegion.isEmpty());
- AcceleratedDrawingArea::setNeedsDisplay();
return;
}
@@ -72,7 +71,6 @@
{
if (m_layerTreeHost) {
ASSERT(m_dirtyRegion.isEmpty());
- AcceleratedDrawingArea::setNeedsDisplayInRect(rect);
return;
}
Deleted: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/LayerTreeHost.cpp (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/LayerTreeHost.cpp 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/LayerTreeHost.cpp 2019-04-08 10:14:39 UTC (rev 243980)
@@ -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)
Deleted: releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h (243979 => 243980)
--- releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h 2019-04-08 10:14:32 UTC (rev 243979)
+++ releases/WebKitGTK/webkit-2.24/Source/WebKit/WebProcess/WebPage/LayerTreeHost.h 2019-04-08 10:14:39 UTC (rev 243980)
@@ -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