RemoteLayerTreeHost.h [plain text]
#ifndef RemoteLayerTreeHost_h
#define RemoteLayerTreeHost_h
#include "LayerRepresentation.h"
#include "RemoteLayerTreeTransaction.h"
#include <WebCore/PlatformCALayer.h>
#include <wtf/HashMap.h>
#include <wtf/RetainPtr.h>
OBJC_CLASS CAAnimation;
OBJC_CLASS WKAnimationDelegate;
namespace WebKit {
class RemoteLayerTreeDrawingAreaProxy;
class WebPageProxy;
class RemoteLayerTreeHost {
public:
explicit RemoteLayerTreeHost(RemoteLayerTreeDrawingAreaProxy&);
virtual ~RemoteLayerTreeHost();
LayerOrView *getLayer(WebCore::GraphicsLayer::PlatformLayerID) const;
LayerOrView *rootLayer() const { return m_rootLayer; }
static WebCore::GraphicsLayer::PlatformLayerID layerID(CALayer*);
bool updateLayerTree(const RemoteLayerTreeTransaction&, float indicatorScaleFactor = 1);
void setIsDebugLayerTreeHost(bool flag) { m_isDebugLayerTreeHost = flag; }
bool isDebugLayerTreeHost() const { return m_isDebugLayerTreeHost; }
typedef HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<WKAnimationDelegate>> LayerAnimationDelegateMap;
LayerAnimationDelegateMap& animationDelegates() { return m_animationDelegates; }
void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *, double startTime);
void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *);
void clearLayers();
void detachRootLayer();
private:
LayerOrView *createLayer(const RemoteLayerTreeTransaction::LayerCreationProperties&, const RemoteLayerTreeTransaction::LayerProperties*);
static void setLayerID(CALayer *, WebCore::GraphicsLayer::PlatformLayerID);
void layerWillBeRemoved(WebCore::GraphicsLayer::PlatformLayerID);
RemoteLayerTreeDrawingAreaProxy& m_drawingArea;
LayerOrView *m_rootLayer;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<LayerOrView>> m_layers;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<WKAnimationDelegate>> m_animationDelegates;
bool m_isDebugLayerTreeHost;
};
}
#endif // RemoteLayerTreeHost_h