Diff
Modified: trunk/Source/WebKit2/ChangeLog (202620 => 202621)
--- trunk/Source/WebKit2/ChangeLog 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/ChangeLog 2016-06-29 12:16:41 UTC (rev 202621)
@@ -1,3 +1,82 @@
+2016-06-29 Carlos Garcia Campos <[email protected]>
+
+ Too much duplicated code in LayerTreeHosts implementations
+ https://bugs.webkit.org/show_bug.cgi?id=159144
+
+ Reviewed by Žan Doberšek.
+
+ There's some code common and duplicated in all current LayerTreeHosts implementations (Gtk, Coordinated, and
+ ThreadedCoordinated). The thing is even worse in the case of ThreadedCoordinated and Coordinated, where the
+ former is actually a special case of the later, and it seems like code was copy pasted and then modified to add
+ ThreadedCoordinated specific code. The problem of that approach, apart from the code duplication, is that common
+ parts end up diverging too. This patch moves the common parts to the base class LayerTreeHost and makes
+ ThreadedCoordinatedLayerTreeHost inherit from CoordinatedLayerTreeHost, to share the common code and simply add
+ the specific one.
+
+ * PlatformGTK.cmake:
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h:
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp:
+ (WebKit::CoordinatedLayerTreeHost::CoordinatedLayerTreeHost):
+ (WebKit::CoordinatedLayerTreeHost::scheduleLayerFlush):
+ (WebKit::CoordinatedLayerTreeHost::setViewOverlayRootLayer):
+ (WebKit::CoordinatedLayerTreeHost::setRootCompositingLayer):
+ (WebKit::CoordinatedLayerTreeHost::invalidate):
+ (WebKit::CoordinatedLayerTreeHost::sizeDidChange):
+ (WebKit::CoordinatedLayerTreeHost::layerFlushTimerFired):
+ (WebKit::CoordinatedLayerTreeHost::commitSceneState):
+ (WebKit::CoordinatedLayerTreeHost::createCoordinatedSurface):
+ (WebKit::CoordinatedLayerTreeHost::cancelPendingLayerFlush): Deleted.
+ (WebKit::CoordinatedLayerTreeHost::forceRepaint): Deleted.
+ (WebKit::CoordinatedLayerTreeHost::forceRepaintAsync): Deleted.
+ (WebKit::CoordinatedLayerTreeHost::didFlushRootLayer): Deleted.
+ (WebKit::CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged): Deleted.
+ (WebKit::CoordinatedLayerTreeHost::pageBackgroundTransparencyChanged): Deleted.
+ (WebKit::CoordinatedLayerTreeHost::graphicsLayerFactory): Deleted.
+ * WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h:
+ * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp:
+ (WebKit::ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost):
+ (WebKit::ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged):
+ (WebKit::ThreadedCoordinatedLayerTreeHost::sizeDidChange):
+ (WebKit::ThreadedCoordinatedLayerTreeHost::setVisibleContentsRect):
+ (WebKit::ThreadedCoordinatedLayerTreeHost::commitSceneState):
+ (WebKit::ThreadedCoordinatedLayerTreeHost::create): Deleted.
+ (WebKit::ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents): Deleted.
+ (WebKit::ThreadedCoordinatedLayerTreeHost::contentsSizeChanged): Deleted.
+ (WebKit::ThreadedCoordinatedLayerTreeHost::didChangeViewportProperties): Deleted.
+ (WebKit::ThreadedCoordinatedLayerTreeHost::didScaleFactorChanged): Deleted.
+ (WebKit::ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing): Deleted.
+ * WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h:
+ * WebProcess/WebPage/DrawingArea.h:
+ (WebKit::DrawingArea::layerHostDidFlushLayers):
+ * WebProcess/WebPage/DrawingAreaImpl.h:
+ * WebProcess/WebPage/LayerTreeHost.cpp:
+ (WebKit::LayerTreeHost::~LayerTreeHost):
+ (WebKit::LayerTreeHost::setLayerFlushSchedulingEnabled):
+ (WebKit::LayerTreeHost::pauseRendering):
+ (WebKit::LayerTreeHost::resumeRendering):
+ (WebKit::LayerTreeHost::invalidate):
+ * WebProcess/WebPage/LayerTreeHost.h:
+ (WebKit::LayerTreeHost::layerTreeContext):
+ (WebKit::LayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush):
+ (WebKit::LayerTreeHost::setNonCompositedContentsNeedDisplay):
+ (WebKit::LayerTreeHost::setNonCompositedContentsNeedDisplayInRect):
+ (WebKit::LayerTreeHost::scrollNonCompositedContents):
+ (WebKit::LayerTreeHost::graphicsLayerFactory):
+ (WebKit::LayerTreeHost::contentsSizeChanged):
+ (WebKit::LayerTreeHost::didChangeViewportProperties):
+ (WebKit::LayerTreeHost::setNativeSurfaceHandleForCompositing):
+ (WebKit::LayerTreeHost::setViewOverlayRootLayer):
+ (WebKit::LayerTreeHost::forceRepaintAsync): Deleted.
+ * WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp:
+ (WebKit::LayerTreeHostGtk::invalidate):
+ (WebKit::LayerTreeHostGtk::setViewOverlayRootLayer):
+ (WebKit::LayerTreeHostGtk::LayerTreeHostGtk): Deleted.
+ (WebKit::LayerTreeHostGtk::setRootCompositingLayer): Deleted.
+ (WebKit::LayerTreeHostGtk::setNonCompositedContentsNeedDisplay): Deleted.
+ (WebKit::LayerTreeHostGtk::scrollNonCompositedContents): Deleted.
+ (WebKit::LayerTreeHostGtk::setNativeSurfaceHandleForCompositing): Deleted.
+ * WebProcess/WebPage/gtk/LayerTreeHostGtk.h:
+
2016-06-28 Commit Queue <[email protected]>
Unreviewed, rolling out r202586 and r202595.
Modified: trunk/Source/WebKit2/PlatformGTK.cmake (202620 => 202621)
--- trunk/Source/WebKit2/PlatformGTK.cmake 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/PlatformGTK.cmake 2016-06-29 12:16:41 UTC (rev 202621)
@@ -826,6 +826,7 @@
Shared/CoordinatedGraphics/threadedcompositor/ThreadSafeCoordinatedSurface.cpp
Shared/CoordinatedGraphics/threadedcompositor/ThreadedCompositor.cpp
+ WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp
WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp
)
list(APPEND WebKit2_INCLUDE_DIRECTORIES
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.cpp 2016-06-29 12:16:41 UTC (rev 202621)
@@ -348,8 +348,7 @@
if (!frame->isMainFrame())
return;
- CoordinatedLayerTreeHost* coordinatedLayerTreeHost = static_cast<CoordinatedLayerTreeHost*>(m_layerTreeHost.get());
- coordinatedLayerTreeHost->setViewOverlayRootLayer(viewOverlayRootLayer);
+ m_layerTreeHost->setViewOverlayRootLayer(viewOverlayRootLayer);
}
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedDrawingArea.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -41,8 +41,6 @@
CoordinatedDrawingArea(WebPage&, const WebPageCreationParameters&);
virtual ~CoordinatedDrawingArea();
- void layerHostDidFlushLayers();
-
private:
// DrawingArea
void setNeedsDisplay() override;
@@ -69,6 +67,8 @@
void viewStateDidChange(WebCore::ViewState::Flags, bool /* wantsDidUpdateViewState */, const Vector<uint64_t>& /* callbackIDs */) override;
void attachViewOverlayGraphicsLayer(WebCore::Frame*, WebCore::GraphicsLayer*) override;
+ void layerHostDidFlushLayers() override;
+
// IPC message handlers.
void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset) override;
virtual void suspendPainting();
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.cpp 2016-06-29 12:16:41 UTC (rev 202621)
@@ -30,21 +30,22 @@
#if USE(COORDINATED_GRAPHICS)
#include "CoordinatedLayerTreeHost.h"
-#include "CoordinatedDrawingArea.h"
-#include "CoordinatedGraphicsArgumentCoders.h"
-#include "CoordinatedLayerTreeHostProxyMessages.h"
-#include "GraphicsContext.h"
+#include "DrawingArea.h"
#include "WebCoordinatedSurface.h"
-#include "WebCoreArgumentCoders.h"
#include "WebPage.h"
#include "WebPageProxyMessages.h"
-#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
#include <WebCore/MainFrame.h>
#include <WebCore/PageOverlayController.h>
-#include <WebCore/Settings.h>
-#include <wtf/CurrentTime.h>
+#if USE(COORDINATED_GRAPHICS_THREADED)
+#include "ThreadSafeCoordinatedSurface.h"
+#elif USE(COORDINATED_GRAPHICS_MULTIPROCESS)
+#include "CoordinatedGraphicsArgumentCoders.h"
+#include "CoordinatedLayerTreeHostProxyMessages.h"
+#include "WebCoreArgumentCoders.h"
+#endif
+
using namespace WebCore;
namespace WebKit {
@@ -60,46 +61,24 @@
CoordinatedLayerTreeHost::CoordinatedLayerTreeHost(WebPage& webPage)
: LayerTreeHost(webPage)
- , m_notifyAfterScheduledLayerFlush(false)
- , m_isValid(true)
- , m_isSuspended(false)
- , m_isWaitingForRenderer(true)
- , m_layerFlushTimer(*this, &CoordinatedLayerTreeHost::layerFlushTimerFired)
- , m_layerFlushSchedulingEnabled(true)
- , m_forceRepaintAsyncCallbackID(0)
- , m_viewOverlayRootLayer(nullptr)
+ , m_coordinator(std::make_unique<CompositingCoordinator>(webPage.corePage(), this))
+ , m_layerFlushTimer(RunLoop::main(), this, &CoordinatedLayerTreeHost::layerFlushTimerFired)
{
- m_coordinator = std::make_unique<CompositingCoordinator>(m_webPage.corePage(), this);
-
m_coordinator->createRootLayer(m_webPage.size());
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
m_layerTreeContext.contextID = toCoordinatedGraphicsLayer(m_coordinator->rootLayer())->id();
+#endif
CoordinatedSurface::setFactory(createCoordinatedSurface);
-
scheduleLayerFlush();
}
-void CoordinatedLayerTreeHost::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
-{
- if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
- return;
-
- m_layerFlushSchedulingEnabled = layerFlushingEnabled;
-
- if (m_layerFlushSchedulingEnabled) {
- scheduleLayerFlush();
- return;
- }
-
- cancelPendingLayerFlush();
-}
-
void CoordinatedLayerTreeHost::scheduleLayerFlush()
{
if (!m_layerFlushSchedulingEnabled)
return;
- if (!m_layerFlushTimer.isActive() || m_layerFlushTimer.nextFireInterval() > 0)
+ if (!m_layerFlushTimer.isActive())
m_layerFlushTimer.startOneShot(0);
}
@@ -108,18 +87,13 @@
m_layerFlushTimer.stop();
}
-void CoordinatedLayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
+void CoordinatedLayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
{
- m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
-}
-
-void CoordinatedLayerTreeHost::setViewOverlayRootLayer(WebCore::GraphicsLayer* viewOverlayRootLayer)
-{
- m_viewOverlayRootLayer = viewOverlayRootLayer;
+ LayerTreeHost::setViewOverlayRootLayer(viewOverlayRootLayer);
m_coordinator->setViewOverlayRootLayer(viewOverlayRootLayer);
}
-void CoordinatedLayerTreeHost::setRootCompositingLayer(WebCore::GraphicsLayer* graphicsLayer)
+void CoordinatedLayerTreeHost::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
m_coordinator->setRootCompositingLayer(graphicsLayer);
}
@@ -128,9 +102,8 @@
{
cancelPendingLayerFlush();
- ASSERT(m_isValid);
m_coordinator->clearRootLayer();
- m_isValid = false;
+ LayerTreeHost::invalidate();
}
void CoordinatedLayerTreeHost::forceRepaint()
@@ -158,7 +131,7 @@
return true;
}
-void CoordinatedLayerTreeHost::sizeDidChange(const WebCore::IntSize& newSize)
+void CoordinatedLayerTreeHost::sizeDidChange(const IntSize& newSize)
{
m_coordinator->sizeDidChange(newSize);
scheduleLayerFlush();
@@ -189,7 +162,7 @@
m_viewOverlayRootLayer->flushCompositingState(visibleContentRect, m_webPage.mainFrame()->view()->viewportIsStable());
}
-void CoordinatedLayerTreeHost::performScheduledLayerFlush()
+void CoordinatedLayerTreeHost::layerFlushTimerFired()
{
if (m_isSuspended || m_isWaitingForRenderer)
return;
@@ -207,29 +180,34 @@
}
if (m_notifyAfterScheduledLayerFlush && didSync) {
- static_cast<CoordinatedDrawingArea*>(m_webPage.drawingArea())->layerHostDidFlushLayers();
+ m_webPage.drawingArea()->layerHostDidFlushLayers();
m_notifyAfterScheduledLayerFlush = false;
}
}
-void CoordinatedLayerTreeHost::layerFlushTimerFired()
-{
- performScheduledLayerFlush();
-}
-
void CoordinatedLayerTreeHost::paintLayerContents(const GraphicsLayer*, GraphicsContext&, const IntRect&)
{
}
-void CoordinatedLayerTreeHost::commitSceneState(const WebCore::CoordinatedGraphicsState& state)
+void CoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
{
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
m_webPage.send(Messages::CoordinatedLayerTreeHostProxy::CommitCoordinatedGraphicsState(state));
+#endif
m_isWaitingForRenderer = true;
}
RefPtr<CoordinatedSurface> CoordinatedLayerTreeHost::createCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags)
{
+#if USE(COORDINATED_GRAPHICS_THREADED)
+ return ThreadSafeCoordinatedSurface::create(size, flags);
+#elif USE(COORDINATED_GRAPHICS_MULTIPROCESS)
return WebCoordinatedSurface::create(size, flags);
+#else
+ UNUSED_PARAM(size);
+ UNUSED_PARAM(flags);
+ return nullptr;
+#endif
}
void CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/CoordinatedLayerTreeHost.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -23,14 +23,13 @@
#if USE(COORDINATED_GRAPHICS)
-#include "LayerTreeContext.h"
#include "LayerTreeHost.h"
#include <WebCore/CompositingCoordinator.h>
-#include <WebCore/GraphicsLayerFactory.h>
-#include <wtf/HashSet.h>
+#include <wtf/RunLoop.h>
namespace WebCore {
class CoordinatedSurface;
+class GraphicsLayerFactory;
}
namespace WebKit {
@@ -43,28 +42,27 @@
static Ref<CoordinatedLayerTreeHost> create(WebPage&);
virtual ~CoordinatedLayerTreeHost();
- const LayerTreeContext& layerTreeContext() override { return m_layerTreeContext; }
- void setLayerFlushSchedulingEnabled(bool) override;
+protected:
+ explicit CoordinatedLayerTreeHost(WebPage&);
+
void scheduleLayerFlush() override;
- void setShouldNotifyAfterNextScheduledLayerFlush(bool) override;
+ void cancelPendingLayerFlush() override;
void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
void invalidate() override;
- void setNonCompositedContentsNeedDisplay() override { }
- void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) override { }
- void scrollNonCompositedContents(const WebCore::IntRect&) override { }
void forceRepaint() override;
bool forceRepaintAsync(uint64_t callbackID) override;
void sizeDidChange(const WebCore::IntSize& newSize) override;
- void pauseRendering() override { m_isSuspended = true; }
- void resumeRendering() override { m_isSuspended = false; scheduleLayerFlush(); }
void deviceOrPageScaleFactorChanged() override;
void pageBackgroundTransparencyChanged() override;
- void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+ void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&);
+ void renderNextFrame();
+ void purgeBackingStores();
+ void commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset);
+
WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
- WebCore::CoordinatedGraphicsLayer* mainContentsLayer();
#if ENABLE(REQUEST_ANIMATION_FRAME)
void scheduleAnimation() override;
@@ -72,22 +70,6 @@
void setViewOverlayRootLayer(WebCore::GraphicsLayer*) override;
- static RefPtr<WebCore::CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags);
-
-protected:
- explicit CoordinatedLayerTreeHost(WebPage&);
-
-private:
- // CoordinatedLayerTreeHost
- void cancelPendingLayerFlush();
- void performScheduledLayerFlush();
- void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&);
- void renderNextFrame();
- void purgeBackingStores();
- void commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset);
-
- void layerFlushTimerFired();
-
// CompositingCoordinator::Client
void didFlushRootLayer(const WebCore::FloatRect& visibleContentRect) override;
void notifyFlushRequired() override { scheduleLayerFlush(); };
@@ -94,20 +76,19 @@
void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
void paintLayerContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, const WebCore::IntRect& clipRect) override;
- std::unique_ptr<WebCore::CompositingCoordinator> m_coordinator;
+private:
+ void layerFlushTimerFired();
- bool m_notifyAfterScheduledLayerFlush;
- bool m_isValid;
- bool m_isSuspended;
- bool m_isWaitingForRenderer;
+#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
+ void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&, IPC::MessageDecoder&) override;
+#endif
- LayerTreeContext m_layerTreeContext;
+ static RefPtr<WebCore::CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags);
- WebCore::Timer m_layerFlushTimer;
- bool m_layerFlushSchedulingEnabled;
- uint64_t m_forceRepaintAsyncCallbackID;
-
- WebCore::GraphicsLayer* m_viewOverlayRootLayer;
+ std::unique_ptr<WebCore::CompositingCoordinator> m_coordinator;
+ bool m_isWaitingForRenderer { true };
+ uint64_t m_forceRepaintAsyncCallbackID { 0 };
+ RunLoop::Timer<CoordinatedLayerTreeHost> m_layerFlushTimer;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.cpp 2016-06-29 12:16:41 UTC (rev 202621)
@@ -30,19 +30,9 @@
#include "ThreadedCoordinatedLayerTreeHost.h"
#if USE(COORDINATED_GRAPHICS_THREADED)
-
-#include "DrawingAreaImpl.h"
-#include "NotImplemented.h"
-#include "ThreadSafeCoordinatedSurface.h"
#include "WebPage.h"
-#include <WebCore/CoordinatedGraphicsLayer.h>
-#include <WebCore/CoordinatedGraphicsState.h>
-#include <WebCore/Frame.h>
#include <WebCore/FrameView.h>
-#include <WebCore/GraphicsContext.h>
#include <WebCore/MainFrame.h>
-#include <WebCore/Page.h>
-#include <wtf/CurrentTime.h>
using namespace WebCore;
@@ -58,68 +48,12 @@
}
ThreadedCoordinatedLayerTreeHost::ThreadedCoordinatedLayerTreeHost(WebPage& webPage)
- : LayerTreeHost(webPage)
- , m_forceRepaintAsyncCallbackID(0)
- , m_notifyAfterScheduledLayerFlush(false)
- , m_isSuspended(false)
- , m_isWaitingForRenderer(false)
- , m_layerFlushTimer(RunLoop::main(), this, &ThreadedCoordinatedLayerTreeHost::performScheduledLayerFlush)
- , m_layerFlushSchedulingEnabled(true)
+ : CoordinatedLayerTreeHost(webPage)
+ , m_compositorClient(*this)
+ , m_compositor(ThreadedCompositor::create(&m_compositorClient))
{
- m_coordinator = std::make_unique<CompositingCoordinator>(m_webPage.corePage(), this);
-
- m_coordinator->createRootLayer(m_webPage.size());
-
- CoordinatedSurface::setFactory(createCoordinatedSurface);
-
- m_compositor = ThreadedCompositor::create(this);
- scheduleLayerFlush();
}
-RefPtr<CoordinatedSurface> ThreadedCoordinatedLayerTreeHost::createCoordinatedSurface(const IntSize& size, CoordinatedSurface::Flags flags)
-{
- return ThreadSafeCoordinatedSurface::create(size, flags);
-}
-
-void ThreadedCoordinatedLayerTreeHost::scheduleLayerFlush()
-{
- if (!m_layerFlushSchedulingEnabled)
- return;
-
- if (!m_layerFlushTimer.isActive())
- m_layerFlushTimer.startOneShot(0);
-}
-
-void ThreadedCoordinatedLayerTreeHost::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
-{
- if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
- return;
-
- m_layerFlushSchedulingEnabled = layerFlushingEnabled;
-
- if (m_layerFlushSchedulingEnabled) {
- scheduleLayerFlush();
- return;
- }
-
- cancelPendingLayerFlush();
-}
-
-void ThreadedCoordinatedLayerTreeHost::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
-{
- m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
-}
-
-void ThreadedCoordinatedLayerTreeHost::setRootCompositingLayer(WebCore::GraphicsLayer* graphicsLayer)
-{
- m_coordinator->setRootCompositingLayer(graphicsLayer);
-}
-
-void ThreadedCoordinatedLayerTreeHost::invalidate()
-{
- notImplemented();
-}
-
void ThreadedCoordinatedLayerTreeHost::scrollNonCompositedContents(const WebCore::IntRect& rect)
{
m_compositor->scrollTo(rect.location());
@@ -126,20 +60,6 @@
scheduleLayerFlush();
}
-void ThreadedCoordinatedLayerTreeHost::forceRepaint()
-{
- notImplemented();
-}
-
-bool ThreadedCoordinatedLayerTreeHost::forceRepaintAsync(uint64_t callbackID)
-{
- // We expect the UI process to not require a new repaint until the previous one has finished.
- ASSERT(!m_forceRepaintAsyncCallbackID);
- m_forceRepaintAsyncCallbackID = callbackID;
- scheduleLayerFlush();
- return true;
-}
-
void ThreadedCoordinatedLayerTreeHost::contentsSizeChanged(const WebCore::IntSize& newSize)
{
m_compositor->didChangeContentsSize(newSize);
@@ -147,29 +67,13 @@
void ThreadedCoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged()
{
- m_coordinator->deviceOrPageScaleFactorChanged();
+ CoordinatedLayerTreeHost::deviceOrPageScaleFactorChanged();
m_compositor->setDeviceScaleFactor(m_webPage.deviceScaleFactor());
}
-void ThreadedCoordinatedLayerTreeHost::pauseRendering()
+void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const IntSize& size)
{
- m_isSuspended = true;
-}
-
-void ThreadedCoordinatedLayerTreeHost::resumeRendering()
-{
- m_isSuspended = false;
- scheduleLayerFlush();
-}
-
-GraphicsLayerFactory* ThreadedCoordinatedLayerTreeHost::graphicsLayerFactory()
-{
- return m_coordinator.get();
-}
-
-void ThreadedCoordinatedLayerTreeHost::sizeDidChange(const WebCore::IntSize& size)
-{
- m_coordinator->sizeDidChange(size);
+ CoordinatedLayerTreeHost::sizeDidChange(size);
m_compositor->didChangeViewportSize(size);
}
@@ -178,21 +82,11 @@
m_compositor->didChangeViewportAttribute(attr);
}
-void ThreadedCoordinatedLayerTreeHost::compositorDidFlushLayers()
-{
- static_cast<DrawingAreaImpl*>(m_webPage.drawingArea())->layerHostDidFlushLayers();
-}
-
void ThreadedCoordinatedLayerTreeHost::didScaleFactorChanged(float scale, const IntPoint& origin)
{
m_webPage.scalePage(scale, origin);
}
-void ThreadedCoordinatedLayerTreeHost::setViewOverlayRootLayer(GraphicsLayer* graphicsLayer)
-{
- m_coordinator->setViewOverlayRootLayer(graphicsLayer);
-}
-
#if PLATFORM(GTK)
void ThreadedCoordinatedLayerTreeHost::setNativeSurfaceHandleForCompositing(uint64_t handle)
{
@@ -202,23 +96,9 @@
}
#endif
-#if ENABLE(REQUEST_ANIMATION_FRAME)
-void ThreadedCoordinatedLayerTreeHost::scheduleAnimation()
-{
- if (m_isWaitingForRenderer)
- return;
-
- if (m_layerFlushTimer.isActive())
- return;
-
- m_layerFlushTimer.startOneShot(m_coordinator->nextAnimationServiceTime());
- scheduleLayerFlush();
-}
-#endif
-
void ThreadedCoordinatedLayerTreeHost::setVisibleContentsRect(const FloatRect& rect, const FloatPoint& trajectoryVector, float scale)
{
- m_coordinator->setVisibleContentsRect(rect, trajectoryVector);
+ CoordinatedLayerTreeHost::setVisibleContentsRect(rect, trajectoryVector);
if (m_lastScrollPosition != roundedIntPoint(rect.location())) {
m_lastScrollPosition = roundedIntPoint(rect.location());
@@ -230,61 +110,14 @@
m_lastScaleFactor = scale;
didScaleFactorChanged(m_lastScaleFactor, m_lastScrollPosition);
}
-
- scheduleLayerFlush();
}
-void ThreadedCoordinatedLayerTreeHost::cancelPendingLayerFlush()
-{
- m_layerFlushTimer.stop();
-}
-
-void ThreadedCoordinatedLayerTreeHost::performScheduledLayerFlush()
-{
- if (m_isSuspended || m_isWaitingForRenderer)
- return;
-
- m_coordinator->syncDisplayState();
- bool didSync = m_coordinator->flushPendingLayerChanges();
-
- if (m_notifyAfterScheduledLayerFlush && didSync) {
- compositorDidFlushLayers();
- m_notifyAfterScheduledLayerFlush = false;
- }
-}
-
-void ThreadedCoordinatedLayerTreeHost::purgeBackingStores()
-{
- m_coordinator->purgeBackingStores();
-}
-
-void ThreadedCoordinatedLayerTreeHost::renderNextFrame()
-{
- m_isWaitingForRenderer = false;
- m_coordinator->renderNextFrame();
- scheduleLayerFlush();
-}
-
-void ThreadedCoordinatedLayerTreeHost::commitScrollOffset(uint32_t layerID, const IntSize& offset)
-{
- m_coordinator->commitScrollOffset(layerID, offset);
-}
-
-void ThreadedCoordinatedLayerTreeHost::notifyFlushRequired()
-{
- scheduleLayerFlush();
-}
-
void ThreadedCoordinatedLayerTreeHost::commitSceneState(const CoordinatedGraphicsState& state)
{
- m_isWaitingForRenderer = true;
+ CoordinatedLayerTreeHost::commitSceneState(state);
m_compositor->updateSceneState(state);
}
-void ThreadedCoordinatedLayerTreeHost::paintLayerContents(const GraphicsLayer*, GraphicsContext&, const IntRect&)
-{
-}
-
} // namespace WebKit
#endif // USE(COORDINATED_GRAPHICS)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/CoordinatedGraphics/ThreadedCoordinatedLayerTreeHost.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -30,27 +30,12 @@
#if USE(COORDINATED_GRAPHICS_THREADED)
-#include "LayerTreeContext.h"
-#include "LayerTreeHost.h"
+#include "CoordinatedLayerTreeHost.h"
#include "ThreadedCompositor.h"
-#include <WebCore/CompositingCoordinator.h>
-#include <WebCore/FloatPoint.h>
-#include <WebCore/FloatRect.h>
-#include <WebCore/IntPoint.h>
-#include <WebCore/IntRect.h>
-#include <WebCore/IntSize.h>
-#include <WebCore/PageOverlay.h>
-#include <WebCore/Timer.h>
-#include <wtf/RunLoop.h>
-#include <wtf/Threading.h>
namespace WebCore {
-class CoordinatedSurface;
class GraphicsContext;
class GraphicsLayer;
-class GraphicsLayerFactory;
-class GraphicsLayerFactory;
-struct CoordinatedGraphicsLayerState;
struct CoordinatedGraphicsState;
}
@@ -58,34 +43,18 @@
class WebPage;
-class ThreadedCoordinatedLayerTreeHost : public LayerTreeHost, public WebCore::CompositingCoordinator::Client, public ThreadedCompositor::Client {
- WTF_MAKE_NONCOPYABLE(ThreadedCoordinatedLayerTreeHost); WTF_MAKE_FAST_ALLOCATED;
+class ThreadedCoordinatedLayerTreeHost final : public CoordinatedLayerTreeHost {
public:
static Ref<ThreadedCoordinatedLayerTreeHost> create(WebPage&);
virtual ~ThreadedCoordinatedLayerTreeHost();
- const LayerTreeContext& layerTreeContext() override { return m_layerTreeContext; };
+private:
+ explicit ThreadedCoordinatedLayerTreeHost(WebPage&);
- void scheduleLayerFlush() override;
- void setLayerFlushSchedulingEnabled(bool) override;
- void setShouldNotifyAfterNextScheduledLayerFlush(bool) override;
- void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
- void invalidate() override;
-
- void setNonCompositedContentsNeedDisplay() override { };
- void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) override { };
void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override;
- void forceRepaint() override;
- bool forceRepaintAsync(uint64_t /*callbackID*/) override;
void sizeDidChange(const WebCore::IntSize&) override;
void deviceOrPageScaleFactorChanged() override;
- void pauseRendering() override;
- void resumeRendering() override;
-
- WebCore::GraphicsLayerFactory* graphicsLayerFactory() override;
- void pageBackgroundTransparencyChanged() override { };
-
void contentsSizeChanged(const WebCore::IntSize&) override;
void didChangeViewportProperties(const WebCore::ViewportAttributes&) override;
@@ -93,55 +62,51 @@
void setNativeSurfaceHandleForCompositing(uint64_t) override;
#endif
-#if ENABLE(REQUEST_ANIMATION_FRAME)
- void scheduleAnimation() override;
-#endif
+ class CompositorClient final : public ThreadedCompositor::Client {
+ WTF_MAKE_NONCOPYABLE(CompositorClient);
+ public:
+ CompositorClient(ThreadedCoordinatedLayerTreeHost& layerTreeHost)
+ : m_layerTreeHost(layerTreeHost)
+ {
+ }
- void setViewOverlayRootLayer(WebCore::GraphicsLayer*) override;
- static RefPtr<WebCore::CoordinatedSurface> createCoordinatedSurface(const WebCore::IntSize&, WebCore::CoordinatedSurface::Flags);
+ private:
+ void setVisibleContentsRect(const WebCore::FloatRect& rect, const WebCore::FloatPoint& trajectoryVector, float scale) override
+ {
+ m_layerTreeHost.setVisibleContentsRect(rect, trajectoryVector, scale);
+ }
-protected:
- explicit ThreadedCoordinatedLayerTreeHost(WebPage&);
+ void purgeBackingStores() override
+ {
+ m_layerTreeHost.purgeBackingStores();
+ }
-private:
+ void renderNextFrame() override
+ {
+ m_layerTreeHost.renderNextFrame();
+ }
- void compositorDidFlushLayers();
- void didScaleFactorChanged(float scale, const WebCore::IntPoint& origin);
+ void commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset) override
+ {
+ m_layerTreeHost.commitScrollOffset(layerID, offset);
+ }
- void cancelPendingLayerFlush();
- void performScheduledLayerFlush();
+ ThreadedCoordinatedLayerTreeHost& m_layerTreeHost;
+ };
- WebCore::GraphicsLayer* rootLayer() { return m_coordinator->rootLayer(); }
+ void didScaleFactorChanged(float scale, const WebCore::IntPoint& origin);
- // ThreadedCompositor::Client
- void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&, float) override;
- void purgeBackingStores() override;
- void renderNextFrame() override;
- void commitScrollOffset(uint32_t layerID, const WebCore::IntSize& offset) override;
+ void setVisibleContentsRect(const WebCore::FloatRect&, const WebCore::FloatPoint&, float);
// CompositingCoordinator::Client
void didFlushRootLayer(const WebCore::FloatRect&) override { }
- void notifyFlushRequired() override;
void commitSceneState(const WebCore::CoordinatedGraphicsState&) override;
- void paintLayerContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, const WebCore::IntRect& clipRect) override;
- LayerTreeContext m_layerTreeContext;
- uint64_t m_forceRepaintAsyncCallbackID;
-
WebCore::IntPoint m_prevScrollPosition;
-
- std::unique_ptr<WebCore::CompositingCoordinator> m_coordinator;
+ CompositorClient m_compositorClient;
RefPtr<ThreadedCompositor> m_compositor;
-
- bool m_notifyAfterScheduledLayerFlush;
- bool m_isSuspended;
- bool m_isWaitingForRenderer;
-
- float m_lastScaleFactor;
+ float m_lastScaleFactor { 1 };
WebCore::IntPoint m_lastScrollPosition;
-
- RunLoop::Timer<ThreadedCoordinatedLayerTreeHost> m_layerFlushTimer;
- bool m_layerFlushSchedulingEnabled;
};
} // namespace WebKit
Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingArea.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -138,6 +138,8 @@
virtual void updateGeometry(const WebCore::IntSize& viewSize, const WebCore::IntSize& layerPosition, bool flushSynchronously, const WebCore::MachSendRight& fencePort) { }
#endif
+ virtual void layerHostDidFlushLayers() { };
+
protected:
DrawingArea(DrawingAreaType, WebPage&);
Modified: trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/DrawingAreaImpl.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -45,8 +45,6 @@
DrawingAreaImpl(WebPage&, const WebPageCreationParameters&);
virtual ~DrawingAreaImpl();
- void layerHostDidFlushLayers();
-
private:
// DrawingArea
void setNeedsDisplay() override;
@@ -75,6 +73,8 @@
void destroyNativeSurfaceHandleForCompositing(bool&) override;
#endif
+ void layerHostDidFlushLayers() override;
+
// IPC message handlers.
void updateBackingStoreState(uint64_t backingStoreStateID, bool respondImmediately, float deviceScaleFactor, const WebCore::IntSize&, const WebCore::IntSize& scrollOffset) override;
void didUpdate() override;
Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.cpp 2016-06-29 12:16:41 UTC (rev 202621)
@@ -62,8 +62,41 @@
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)
Modified: trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/LayerTreeHost.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -29,8 +29,7 @@
#if USE(COORDINATED_GRAPHICS) || USE(TEXTURE_MAPPER)
#include "LayerTreeContext.h"
-#include <WebCore/Color.h>
-#include <wtf/PassRefPtr.h>
+#include <wtf/Forward.h>
#include <wtf/RefCounted.h>
namespace IPC {
@@ -39,8 +38,6 @@
}
namespace WebCore {
-class FloatPoint;
-class FloatRect;
class IntRect;
class IntSize;
class GraphicsLayer;
@@ -52,7 +49,6 @@
namespace WebKit {
-class UpdateInfo;
class WebPage;
class LayerTreeHost : public RefCounted<LayerTreeHost> {
@@ -60,16 +56,18 @@
static RefPtr<LayerTreeHost> create(WebPage&);
virtual ~LayerTreeHost();
- virtual const LayerTreeContext& layerTreeContext() = 0;
+ const LayerTreeContext& layerTreeContext() const { return m_layerTreeContext; }
+ void setLayerFlushSchedulingEnabled(bool);
+ void setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush) { m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush; }
+
virtual void scheduleLayerFlush() = 0;
- virtual void setLayerFlushSchedulingEnabled(bool) = 0;
- virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) = 0;
+ virtual void cancelPendingLayerFlush() = 0;
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) = 0;
- virtual void invalidate() = 0;
+ virtual void invalidate();
- virtual void setNonCompositedContentsNeedDisplay() = 0;
- virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) = 0;
- virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) = 0;
+ virtual void setNonCompositedContentsNeedDisplay() { };
+ virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) { };
+ virtual void scrollNonCompositedContents(const WebCore::IntRect&) { };
virtual void forceRepaint() = 0;
virtual bool forceRepaintAsync(uint64_t /*callbackID*/) { return false; }
virtual void sizeDidChange(const WebCore::IntSize& newSize) = 0;
@@ -76,10 +74,10 @@
virtual void deviceOrPageScaleFactorChanged() = 0;
virtual void pageBackgroundTransparencyChanged() = 0;
- virtual void pauseRendering() { }
- virtual void resumeRendering() { }
+ virtual void pauseRendering();
+ virtual void resumeRendering();
- virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return 0; }
+ virtual WebCore::GraphicsLayerFactory* graphicsLayerFactory() { return nullptr; }
#if USE(COORDINATED_GRAPHICS_MULTIPROCESS)
virtual void didReceiveCoordinatedLayerTreeHostMessage(IPC::Connection&, IPC::MessageDecoder&) = 0;
@@ -86,8 +84,8 @@
#endif
#if USE(COORDINATED_GRAPHICS_THREADED)
- virtual void contentsSizeChanged(const WebCore::IntSize&) = 0;
- virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) = 0;
+ virtual void contentsSizeChanged(const WebCore::IntSize&) { };
+ virtual void didChangeViewportProperties(const WebCore::ViewportAttributes&) { };
#endif
#if USE(COORDINATED_GRAPHICS) && ENABLE(REQUEST_ANIMATION_FRAME)
@@ -95,15 +93,21 @@
#endif
#if USE(TEXTURE_MAPPER) && PLATFORM(GTK)
- virtual void setNativeSurfaceHandleForCompositing(uint64_t) = 0;
+ virtual void setNativeSurfaceHandleForCompositing(uint64_t) { };
#endif
- virtual void setViewOverlayRootLayer(WebCore::GraphicsLayer*) = 0;
+ 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
Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.cpp 2016-06-29 12:16:41 UTC (rev 202621)
@@ -133,10 +133,6 @@
LayerTreeHostGtk::LayerTreeHostGtk(WebPage& webPage)
: LayerTreeHost(webPage)
- , m_isValid(true)
- , m_notifyAfterScheduledLayerFlush(false)
- , m_layerFlushSchedulingEnabled(true)
- , m_viewOverlayRootLayer(nullptr)
, m_renderFrameScheduler(std::bind(&LayerTreeHostGtk::renderFrame, this))
{
m_rootLayer = GraphicsLayer::create(graphicsLayerFactory(), *this);
@@ -183,21 +179,10 @@
LayerTreeHostGtk::~LayerTreeHostGtk()
{
- ASSERT(!m_isValid);
ASSERT(!m_rootLayer);
cancelPendingLayerFlush();
}
-const LayerTreeContext& LayerTreeHostGtk::layerTreeContext()
-{
- return m_layerTreeContext;
-}
-
-void LayerTreeHostGtk::setShouldNotifyAfterNextScheduledLayerFlush(bool notifyAfterScheduledLayerFlush)
-{
- m_notifyAfterScheduledLayerFlush = notifyAfterScheduledLayerFlush;
-}
-
void LayerTreeHostGtk::setRootCompositingLayer(GraphicsLayer* graphicsLayer)
{
m_nonCompositedContentLayer->removeAllChildren();
@@ -211,8 +196,6 @@
void LayerTreeHostGtk::invalidate()
{
- ASSERT(m_isValid);
-
// This can trigger destruction of GL objects so let's make sure that
// we have the right active context
if (m_context)
@@ -224,7 +207,7 @@
m_textureMapper = nullptr;
m_context = nullptr;
- m_isValid = false;
+ LayerTreeHost::invalidate();
}
void LayerTreeHostGtk::setNonCompositedContentsNeedDisplay()
@@ -365,7 +348,7 @@
if (m_notifyAfterScheduledLayerFlush) {
// Let the drawing area know that we've done a flush of the layer changes.
- static_cast<DrawingAreaImpl*>(m_webPage.drawingArea())->layerHostDidFlushLayers();
+ m_webPage.drawingArea()->layerHostDidFlushLayers();
m_notifyAfterScheduledLayerFlush = false;
}
}
@@ -378,21 +361,6 @@
m_renderFrameScheduler.start();
}
-void LayerTreeHostGtk::setLayerFlushSchedulingEnabled(bool layerFlushingEnabled)
-{
- if (m_layerFlushSchedulingEnabled == layerFlushingEnabled)
- return;
-
- m_layerFlushSchedulingEnabled = layerFlushingEnabled;
-
- if (m_layerFlushSchedulingEnabled) {
- scheduleLayerFlush();
- return;
- }
-
- cancelPendingLayerFlush();
-}
-
void LayerTreeHostGtk::pageBackgroundTransparencyChanged()
{
m_nonCompositedContentLayer->setContentsOpaque(m_webPage.drawsBackground());
@@ -403,9 +371,9 @@
m_renderFrameScheduler.stop();
}
-void LayerTreeHostGtk::setViewOverlayRootLayer(WebCore::GraphicsLayer* viewOverlayRootLayer)
+void LayerTreeHostGtk::setViewOverlayRootLayer(GraphicsLayer* viewOverlayRootLayer)
{
- m_viewOverlayRootLayer = viewOverlayRootLayer;
+ LayerTreeHost::setViewOverlayRootLayer(viewOverlayRootLayer);
if (m_viewOverlayRootLayer)
m_rootLayer->addChild(m_viewOverlayRootLayer);
}
Modified: trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h (202620 => 202621)
--- trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h 2016-06-29 11:52:32 UTC (rev 202620)
+++ trunk/Source/WebKit2/WebProcess/WebPage/gtk/LayerTreeHostGtk.h 2016-06-29 12:16:41 UTC (rev 202621)
@@ -51,7 +51,7 @@
// LayerTreeHost
void scheduleLayerFlush() override;
- void setLayerFlushSchedulingEnabled(bool layerFlushingEnabled) override;
+ void cancelPendingLayerFlush() override;
void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
void invalidate() override;
@@ -60,6 +60,11 @@
void deviceOrPageScaleFactorChanged() override;
void pageBackgroundTransparencyChanged() override;
+ void setNonCompositedContentsNeedDisplay() override;
+ void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) override;
+ void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override;
+ void setViewOverlayRootLayer(WebCore::GraphicsLayer*) override;
+
void setNativeSurfaceHandleForCompositing(uint64_t) override;
class RenderFrameScheduler {
@@ -80,15 +85,6 @@
double m_lastImmediateFlushTime { 0 };
};
- // LayerTreeHost
- const LayerTreeContext& layerTreeContext() override;
- void setShouldNotifyAfterNextScheduledLayerFlush(bool) override;
-
- void setNonCompositedContentsNeedDisplay() override;
- void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) override;
- void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override;
- void setViewOverlayRootLayer(WebCore::GraphicsLayer*) override;
-
// GraphicsLayerClient
void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect) override;
float deviceScaleFactor() const override;
@@ -100,21 +96,13 @@
void compositeLayersToContext(CompositePurpose = NotForResize);
void flushAndRenderLayers();
- void cancelPendingLayerFlush();
-
bool renderFrame();
-
bool makeContextCurrent();
- LayerTreeContext m_layerTreeContext;
- bool m_isValid;
- bool m_notifyAfterScheduledLayerFlush;
std::unique_ptr<WebCore::GraphicsLayer> m_rootLayer;
std::unique_ptr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
std::unique_ptr<WebCore::TextureMapper> m_textureMapper;
std::unique_ptr<WebCore::GLContext> m_context;
- bool m_layerFlushSchedulingEnabled;
- WebCore::GraphicsLayer* m_viewOverlayRootLayer;
WebCore::TransformationMatrix m_scaleMatrix;
RenderFrameScheduler m_renderFrameScheduler;
};