InspectorHeapProfilerAgent.h [plain text]
#ifndef InspectorHeapProfilerAgent_h
#define InspectorHeapProfilerAgent_h
#if ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
#include "InspectorBaseAgent.h"
#include "InspectorFrontend.h"
#include <wtf/Forward.h>
#include <wtf/HashMap.h>
#include <wtf/Noncopyable.h>
#include <wtf/PassOwnPtr.h>
#include <wtf/text/WTFString.h>
namespace WebCore {
class InjectedScriptManager;
class ScriptHeapSnapshot;
class ScriptProfile;
typedef String ErrorString;
class InspectorHeapProfilerAgent : public InspectorBaseAgent<InspectorHeapProfilerAgent>, public InspectorBackendDispatcher::HeapProfilerCommandHandler {
WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, InspectorCompositeState*, InjectedScriptManager*);
virtual ~InspectorHeapProfilerAgent();
virtual void collectGarbage(ErrorString*);
virtual void clearProfiles(ErrorString*) { resetState(); }
void resetState();
virtual void hasHeapProfiler(ErrorString*, bool*);
virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::HeapProfiler::ProfileHeader> >&);
virtual void getHeapSnapshot(ErrorString*, int uid);
virtual void removeProfile(ErrorString*, int uid);
virtual void setFrontend(InspectorFrontend*);
virtual void clearFrontend();
virtual void restore();
virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress);
virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapshotObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>& result);
virtual void getHeapObjectId(ErrorString*, const String& objectId, String* heapSnapshotObjectId);
private:
InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorCompositeState*, InjectedScriptManager*);
typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap;
void resetFrontendProfiles();
PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(const ScriptHeapSnapshot&);
InjectedScriptManager* m_injectedScriptManager;
InspectorFrontend::HeapProfiler* m_frontend;
unsigned m_nextUserInitiatedHeapSnapshotNumber;
IdToHeapSnapshotMap m_snapshots;
};
}
#endif // ENABLE(JAVASCRIPT_DEBUGGER) && ENABLE(INSPECTOR)
#endif // !defined(InspectorHeapProfilerAgent_h)