CoordinatedDrawingAreaProxy.h [plain text]
#ifndef CoordinatedDrawingAreaProxy_h
#define CoordinatedDrawingAreaProxy_h
#if USE(COORDINATED_GRAPHICS)
#include "BackingStore.h"
#include "DrawingAreaProxy.h"
#include "LayerTreeContext.h"
#include <wtf/OwnPtr.h>
#include <wtf/RunLoop.h>
namespace WebCore {
class Region;
}
namespace WebKit {
class CoordinatedLayerTreeHostProxy;
class CoordinatedDrawingAreaProxy : public DrawingAreaProxy {
public:
explicit CoordinatedDrawingAreaProxy(WebPageProxy*);
virtual ~CoordinatedDrawingAreaProxy();
void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
void visibilityDidChange();
void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectory);
bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; }
CoordinatedLayerTreeHostProxy& coordinatedLayerTreeHostProxy() const { return *m_coordinatedLayerTreeHostProxy.get(); }
WebCore::IntRect viewportVisibleRect() const { return contentsRect(); }
WebCore::IntRect contentsRect() const;
void updateViewport();
WebPageProxy* page() { return m_webPageProxy; }
private:
virtual void sizeDidChange();
virtual void deviceScaleFactorDidChange();
virtual void setBackingStoreIsDiscardable(bool);
virtual void waitForBackingStoreUpdateOnNextPaint();
virtual void update(uint64_t backingStoreStateID, const UpdateInfo&);
virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&);
virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&);
virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&);
virtual void updateAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&);
void incorporateUpdate(const UpdateInfo&);
enum RespondImmediatelyOrNot { DoNotRespondImmediately, RespondImmediately };
void backingStoreStateDidChange(RespondImmediatelyOrNot);
void sendUpdateBackingStoreState(RespondImmediatelyOrNot);
void waitForAndDispatchDidUpdateBackingStoreState();
void enterAcceleratedCompositingMode(const LayerTreeContext&);
void exitAcceleratedCompositingMode();
void updateAcceleratedCompositingMode(const LayerTreeContext&);
void discardBackingStoreSoon();
void discardBackingStore();
OwnPtr<CoordinatedLayerTreeHostProxy> m_coordinatedLayerTreeHostProxy;
uint64_t m_currentBackingStoreStateID;
uint64_t m_nextBackingStoreStateID;
LayerTreeContext m_layerTreeContext;
bool m_isWaitingForDidUpdateBackingStoreState;
bool m_hasReceivedFirstUpdate;
bool m_isBackingStoreDiscardable;
std::unique_ptr<BackingStore> m_backingStore;
RunLoop::Timer<CoordinatedDrawingAreaProxy> m_discardBackingStoreTimer;
};
}
#endif // USE(COORDINATED_GRAPHICS)
#endif // CoordinatedDrawingAreaProxy_h