DrawingAreaProxyImpl.h [plain text]
#ifndef DrawingAreaProxyImpl_h
#define DrawingAreaProxyImpl_h
#include "BackingStore.h"
#include "DrawingAreaProxy.h"
#include "LayerTreeContext.h"
#include <WebCore/RunLoop.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
namespace WebCore {
class Region;
}
namespace WebKit {
class CoordinatedLayerTreeHostProxy;
class DrawingAreaProxyImpl : public DrawingAreaProxy {
public:
static PassOwnPtr<DrawingAreaProxyImpl> create(WebPageProxy*);
virtual ~DrawingAreaProxyImpl();
void paint(BackingStore::PlatformGraphicsContext, const WebCore::IntRect&, WebCore::Region& unpaintedRegion);
#if USE(ACCELERATED_COMPOSITING)
bool isInAcceleratedCompositingMode() const { return !m_layerTreeContext.isEmpty(); }
#endif
bool hasReceivedFirstUpdate() const { return m_hasReceivedFirstUpdate; }
private:
explicit DrawingAreaProxyImpl(WebPageProxy*);
virtual void sizeDidChange();
virtual void deviceScaleFactorDidChange();
virtual void layerHostingModeDidChange() OVERRIDE;
virtual void visibilityDidChange();
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();
#if USE(ACCELERATED_COMPOSITING)
void enterAcceleratedCompositingMode(const LayerTreeContext&);
void exitAcceleratedCompositingMode();
void updateAcceleratedCompositingMode(const LayerTreeContext&);
#if USE(COORDINATED_GRAPHICS)
virtual void setVisibleContentsRect(const WebCore::FloatRect& visibleContentsRect, const WebCore::FloatPoint& trajectory) OVERRIDE;
#endif
#else
bool isInAcceleratedCompositingMode() const { return false; }
#endif
virtual void pageCustomRepresentationChanged();
void discardBackingStoreSoon();
void discardBackingStore();
uint64_t m_currentBackingStoreStateID;
uint64_t m_nextBackingStoreStateID;
#if USE(ACCELERATED_COMPOSITING)
LayerTreeContext m_layerTreeContext;
#endif
bool m_isWaitingForDidUpdateBackingStoreState;
bool m_hasReceivedFirstUpdate;
bool m_isBackingStoreDiscardable;
OwnPtr<BackingStore> m_backingStore;
WebCore::RunLoop::Timer<DrawingAreaProxyImpl> m_discardBackingStoreTimer;
};
}
#endif // DrawingAreaProxyImpl_h