LayerTreeHostGtk.h [plain text]
#ifndef LayerTreeHostGtk_h
#define LayerTreeHostGtk_h
#if USE(TEXTURE_MAPPER_GL)
#include "LayerTreeContext.h"
#include "LayerTreeHost.h"
#include "TextureMapperLayer.h"
#include <WebCore/GLContext.h>
#include <WebCore/GraphicsLayerClient.h>
#include <wtf/glib/GMainLoopSource.h>
namespace WebKit {
class LayerTreeHostGtk final : public LayerTreeHost, WebCore::GraphicsLayerClient {
public:
static PassRefPtr<LayerTreeHostGtk> create(WebPage*);
virtual ~LayerTreeHostGtk();
protected:
explicit LayerTreeHostGtk(WebPage*);
WebCore::GraphicsLayer* rootLayer() const { return m_rootLayer.get(); }
void initialize();
virtual void scheduleLayerFlush() override;
virtual void setLayerFlushSchedulingEnabled(bool layerFlushingEnabled) override;
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*) override;
virtual void invalidate() override;
virtual void forceRepaint() override;
virtual void sizeDidChange(const WebCore::IntSize& newSize) override;
virtual void deviceOrPageScaleFactorChanged() override;
virtual void pageBackgroundTransparencyChanged() override;
virtual void setNativeSurfaceHandleForCompositing(uint64_t) override;
private:
virtual const LayerTreeContext& layerTreeContext() override;
virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool) override;
virtual void setNonCompositedContentsNeedDisplay() override;
virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) override;
virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect) override;
virtual void setViewOverlayRootLayer(WebCore::GraphicsLayer*) override;
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::FloatRect& clipRect) override;
bool flushPendingLayerChanges();
enum CompositePurpose { ForResize, NotForResize };
void compositeLayersToContext(CompositePurpose = NotForResize);
void flushAndRenderLayers();
void cancelPendingLayerFlush();
void layerFlushTimerFired();
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;
double m_lastImmediateFlushTime;
bool m_layerFlushSchedulingEnabled;
GMainLoopSource m_layerFlushTimerCallback;
WebCore::GraphicsLayer* m_viewOverlayRootLayer;
};
}
#endif
#endif // LayerTreeHostGtk_h