DrawingAreaProxy.h [plain text]
#ifndef DrawingAreaProxy_h
#define DrawingAreaProxy_h
#include "DrawingAreaInfo.h"
#include <stdint.h>
#include <WebCore/IntSize.h>
#include <wtf/Noncopyable.h>
#if PLATFORM(QT)
class QPainter;
#elif PLATFORM(GTK)
typedef struct _cairo cairo_t;
#endif
namespace CoreIPC {
class ArgumentDecoder;
class Connection;
class MessageID;
}
namespace WebCore {
class IntRect;
}
namespace WebKit {
class LayerTreeContext;
class UpdateInfo;
class WebPageProxy;
#if PLATFORM(MAC)
typedef CGContextRef PlatformDrawingContext;
#elif PLATFORM(WIN)
typedef HDC PlatformDrawingContext;
#elif PLATFORM(QT)
typedef QPainter* PlatformDrawingContext;
#elif PLATFORM(GTK)
typedef cairo_t* PlatformDrawingContext;
#endif
class DrawingAreaProxy {
WTF_MAKE_NONCOPYABLE(DrawingAreaProxy);
public:
virtual ~DrawingAreaProxy();
DrawingAreaType type() const { return m_type; }
void didReceiveDrawingAreaProxyMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*);
virtual void didReceiveMessage(CoreIPC::Connection*, CoreIPC::MessageID, CoreIPC::ArgumentDecoder*) = 0;
virtual bool paint(const WebCore::IntRect&, PlatformDrawingContext) = 0;
virtual void sizeDidChange() = 0;
virtual void deviceScaleFactorDidChange() = 0;
virtual void visibilityDidChange() { }
virtual void setBackingStoreIsDiscardable(bool) { }
virtual void waitForBackingStoreUpdateOnNextPaint() { }
virtual void setPageIsVisible(bool isVisible) = 0;
const WebCore::IntSize& size() const { return m_size; }
void setSize(const WebCore::IntSize&, const WebCore::IntSize& scrollOffset);
protected:
explicit DrawingAreaProxy(DrawingAreaType, WebPageProxy*);
DrawingAreaType m_type;
WebPageProxy* m_webPageProxy;
WebCore::IntSize m_size;
WebCore::IntSize m_scrollOffset;
private:
virtual void update(uint64_t backingStoreStateID, const UpdateInfo&) { }
virtual void didUpdateBackingStoreState(uint64_t backingStoreStateID, const UpdateInfo&, const LayerTreeContext&) { }
#if USE(ACCELERATED_COMPOSITING)
virtual void enterAcceleratedCompositingMode(uint64_t backingStoreStateID, const LayerTreeContext&) { }
virtual void exitAcceleratedCompositingMode(uint64_t backingStoreStateID, const UpdateInfo&) { }
#endif
};
}
#endif // DrawingAreaProxy_h