RemoteLayerTreeContext.h [plain text]
#pragma once
#include "LayerTreeContext.h"
#include "RemoteLayerBackingStoreCollection.h"
#include "RemoteLayerTreeTransaction.h"
#include <WebCore/GraphicsLayerFactory.h>
#include <WebCore/LayerPool.h>
#include <WebCore/PlatformCALayer.h>
#include <wtf/Vector.h>
namespace WebKit {
class GraphicsLayerCARemote;
class PlatformCALayerRemote;
class WebPage;
class RemoteLayerTreeContext : public WebCore::GraphicsLayerFactory {
public:
explicit RemoteLayerTreeContext(WebPage&);
~RemoteLayerTreeContext();
void layerDidEnterContext(PlatformCALayerRemote&, WebCore::PlatformCALayer::LayerType);
void layerWillLeaveContext(PlatformCALayerRemote&);
void graphicsLayerDidEnterContext(GraphicsLayerCARemote&);
void graphicsLayerWillLeaveContext(GraphicsLayerCARemote&);
void backingStoreWasCreated(RemoteLayerBackingStore&);
void backingStoreWillBeDestroyed(RemoteLayerBackingStore&);
bool backingStoreWillBeDisplayed(RemoteLayerBackingStore&);
WebCore::LayerPool& layerPool() { return m_layerPool; }
float deviceScaleFactor() const;
LayerHostingMode layerHostingMode() const;
void buildTransaction(RemoteLayerTreeTransaction&, WebCore::PlatformCALayer& rootLayer);
void layerPropertyChangedWhileBuildingTransaction(PlatformCALayerRemote&);
void animationDidStart(WebCore::GraphicsLayer::PlatformLayerID, const String& key, MonotonicTime startTime);
void animationDidEnd(WebCore::GraphicsLayer::PlatformLayerID, const String& key);
void willStartAnimationOnLayer(PlatformCALayerRemote&);
RemoteLayerBackingStoreCollection& backingStoreCollection() { return m_backingStoreCollection; }
void setNextRenderingUpdateRequiresSynchronousImageDecoding(bool requireSynchronousDecoding) { m_nextRenderingUpdateRequiresSynchronousImageDecoding = requireSynchronousDecoding; }
bool nextRenderingUpdateRequiresSynchronousImageDecoding() const { return m_nextRenderingUpdateRequiresSynchronousImageDecoding; }
void adoptLayersFromContext(RemoteLayerTreeContext&);
#if PLATFORM(IOS_FAMILY)
bool canShowWhileLocked() const;
#endif
private:
Ref<WebCore::GraphicsLayer> createGraphicsLayer(WebCore::GraphicsLayer::Type, WebCore::GraphicsLayerClient&) override;
WebPage& m_webPage;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, RemoteLayerTreeTransaction::LayerCreationProperties> m_createdLayers;
Vector<WebCore::GraphicsLayer::PlatformLayerID> m_destroyedLayers;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_livePlatformLayers;
HashMap<WebCore::GraphicsLayer::PlatformLayerID, PlatformCALayerRemote*> m_layersWithAnimations;
HashSet<GraphicsLayerCARemote*> m_liveGraphicsLayers;
RemoteLayerBackingStoreCollection m_backingStoreCollection;
RemoteLayerTreeTransaction* m_currentTransaction;
WebCore::LayerPool m_layerPool;
bool m_nextRenderingUpdateRequiresSynchronousImageDecoding { false };
};
}