RemoteLayerTreeHost.h [plain text]
#pragma once
#include "RemoteLayerTreeNode.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 {
WTF_MAKE_FAST_ALLOCATED;
public:
explicit RemoteLayerTreeHost(RemoteLayerTreeDrawingAreaProxy&);
~RemoteLayerTreeHost();
RemoteLayerTreeNode* nodeForID(WebCore::GraphicsLayer::PlatformLayerID) const;
RemoteLayerTreeNode* rootNode() const { return m_rootNode; }
CALayer *layerForID(WebCore::GraphicsLayer::PlatformLayerID) const;
CALayer *rootLayer() const;
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 *, MonotonicTime startTime);
void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, CAAnimation *);
void detachFromDrawingArea();
void clearLayers();
void detachRootLayer();
void mapAllIOSurfaceBackingStore();
CALayer *layerWithIDForTesting(uint64_t) const;
private:
void createLayer(const RemoteLayerTreeTransaction::LayerCreationProperties&);
std::unique_ptr<RemoteLayerTreeNode> makeNode(const RemoteLayerTreeTransaction::LayerCreationProperties&);
void layerWillBeRemoved(WebCore::GraphicsLayer::PlatformLayerID);
RemoteLayerTreeDrawingAreaProxy* m_drawingArea { nullptr };
RemoteLayerTreeNode* m_rootNode { nullptr };
HashMap<WebCore::GraphicsLayer::PlatformLayerID, std::unique_ptr<RemoteLayerTreeNode>> m_nodes;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, RetainPtr<WKAnimationDelegate>> m_animationDelegates;
bool m_isDebugLayerTreeHost { false };
};
}