InspectorLayerTreeAgent.h [plain text]
#ifndef InspectorLayerTreeAgent_h
#define InspectorLayerTreeAgent_h
#if ENABLE(INSPECTOR)
#include "InspectorBaseAgent.h"
#include "InspectorFrontend.h"
#include "InspectorTypeBuilder.h"
#include "RenderLayer.h"
#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/Vector.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class InspectorState;
class InstrumentingAgents;
typedef String ErrorString;
class InspectorLayerTreeAgent : public InspectorBaseAgent<InspectorLayerTreeAgent>, public InspectorBackendDispatcher::LayerTreeCommandHandler {
public:
static PassOwnPtr<InspectorLayerTreeAgent> create(InstrumentingAgents* instrumentingAgents, InspectorCompositeState* state)
{
return adoptPtr(new InspectorLayerTreeAgent(instrumentingAgents, state));
}
~InspectorLayerTreeAgent();
virtual void setFrontend(InspectorFrontend*);
virtual void clearFrontend();
virtual void restore();
void reset();
void layerTreeDidChange();
void renderLayerDestroyed(const RenderLayer*);
void pseudoElementDestroyed(PseudoElement*);
virtual void enable(ErrorString*);
virtual void disable(ErrorString*);
virtual void layersForNode(ErrorString*, int nodeId, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
virtual void reasonsForCompositingLayer(ErrorString*, const String& layerId, RefPtr<TypeBuilder::LayerTree::CompositingReasons>&);
private:
InspectorLayerTreeAgent(InstrumentingAgents*, InspectorCompositeState*);
String bind(const RenderLayer*);
void unbind(const RenderLayer*);
void gatherLayersUsingRenderObjectHierarchy(ErrorString*, RenderObject*, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
void gatherLayersUsingRenderLayerHierarchy(ErrorString*, RenderLayer*, RefPtr<TypeBuilder::Array<TypeBuilder::LayerTree::Layer> >&);
PassRefPtr<TypeBuilder::LayerTree::Layer> buildObjectForLayer(ErrorString*, RenderLayer*);
PassRefPtr<TypeBuilder::LayerTree::IntRect> buildObjectForIntRect(const IntRect&);
int idForNode(ErrorString*, Node*);
String bindPseudoElement(PseudoElement*);
void unbindPseudoElement(PseudoElement*);
InspectorFrontend::LayerTree* m_frontend;
HashMap<const RenderLayer*, String> m_documentLayerToIdMap;
HashMap<String, const RenderLayer*> m_idToLayer;
HashMap<PseudoElement*, String> m_pseudoElementToIdMap;
HashMap<String, PseudoElement*> m_idToPseudoElement;
};
}
#endif // ENABLE(INSPECTOR)
#endif // !defined(InspectorLayerTreeAgent_h)