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/HashMap.h>
#include <wtf/OwnPtr.h>
namespace WebKit {
class LayerTreeHostGtk : 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 invalidate();
virtual void sizeDidChange(const WebCore::IntSize& newSize);
virtual void deviceOrPageScaleFactorChanged();
virtual void forceRepaint();
virtual void setRootCompositingLayer(WebCore::GraphicsLayer*);
virtual void scheduleLayerFlush();
virtual void setLayerFlushSchedulingEnabled(bool layerFlushingEnabled);
virtual void pageBackgroundTransparencyChanged() OVERRIDE;
private:
virtual const LayerTreeContext& layerTreeContext();
virtual void setShouldNotifyAfterNextScheduledLayerFlush(bool);
virtual void setNonCompositedContentsNeedDisplay() OVERRIDE;
virtual void setNonCompositedContentsNeedDisplayInRect(const WebCore::IntRect&) OVERRIDE;
virtual void scrollNonCompositedContents(const WebCore::IntRect& scrollRect);
virtual void didInstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void didUninstallPageOverlay(PageOverlay*) OVERRIDE;
virtual void setPageOverlayNeedsDisplay(PageOverlay*, const WebCore::IntRect&) OVERRIDE;
virtual bool flushPendingLayerChanges();
virtual void notifyAnimationStarted(const WebCore::GraphicsLayer*, double time);
virtual void notifyFlushRequired(const WebCore::GraphicsLayer*);
virtual void paintContents(const WebCore::GraphicsLayer*, WebCore::GraphicsContext&, WebCore::GraphicsLayerPaintingPhase, const WebCore::IntRect& clipRect);
virtual void didCommitChangesForLayer(const WebCore::GraphicsLayer*) const { }
void createPageOverlayLayer(PageOverlay*);
void destroyPageOverlayLayer(PageOverlay*);
enum CompositePurpose { ForResize, NotForResize };
void compositeLayersToContext(CompositePurpose = NotForResize);
void flushAndRenderLayers();
void cancelPendingLayerFlush();
void layerFlushTimerFired();
static gboolean layerFlushTimerFiredCallback(LayerTreeHostGtk*);
WebCore::GLContext* glContext();
LayerTreeContext m_layerTreeContext;
bool m_isValid;
bool m_notifyAfterScheduledLayerFlush;
OwnPtr<WebCore::GraphicsLayer> m_rootLayer;
OwnPtr<WebCore::GraphicsLayer> m_nonCompositedContentLayer;
typedef HashMap<PageOverlay*, OwnPtr<WebCore::GraphicsLayer> > PageOverlayLayerMap;
PageOverlayLayerMap m_pageOverlayLayers;
OwnPtr<WebCore::TextureMapper> m_textureMapper;
OwnPtr<WebCore::GLContext> m_context;
double m_lastFlushTime;
bool m_layerFlushSchedulingEnabled;
unsigned m_layerFlushTimerCallbackId;
};
}
#endif
#endif // LayerTreeHostGtk_h