InspectorScriptProfilerAgent.h [plain text]
#ifndef InspectorScriptProfilerAgent_h
#define InspectorScriptProfilerAgent_h
#include "InspectorBackendDispatchers.h"
#include "InspectorFrontendDispatchers.h"
#include "inspector/InspectorAgentBase.h"
#include "inspector/ScriptDebugServer.h"
#include <wtf/Noncopyable.h>
namespace JSC {
class Profile;
}
namespace Inspector {
typedef String ErrorString;
class JS_EXPORT_PRIVATE InspectorScriptProfilerAgent final : public InspectorAgentBase, public ScriptProfilerBackendDispatcherHandler, public JSC::Debugger::ProfilingClient {
WTF_MAKE_NONCOPYABLE(InspectorScriptProfilerAgent);
public:
InspectorScriptProfilerAgent(AgentContext&);
virtual ~InspectorScriptProfilerAgent();
void didCreateFrontendAndBackend(FrontendRouter*, BackendDispatcher*) override;
void willDestroyFrontendAndBackend(DisconnectReason) override;
void startTracking(ErrorString&, const bool* includeSamples) override;
void stopTracking(ErrorString&) override;
void programmaticCaptureStarted();
void programmaticCaptureStopped();
bool isAlreadyProfiling() const override;
double willEvaluateScript() override;
void didEvaluateScript(double, JSC::ProfilingReason) override;
private:
struct Event {
Event(double start, double end) : startTime(start), endTime(end) { }
double startTime { 0 };
double endTime { 0 };
};
void addEvent(double startTime, double endTime, JSC::ProfilingReason);
void trackingComplete();
std::unique_ptr<ScriptProfilerFrontendDispatcher> m_frontendDispatcher;
RefPtr<ScriptProfilerBackendDispatcher> m_backendDispatcher;
InspectorEnvironment& m_environment;
bool m_tracking { false };
#if ENABLE(SAMPLING_PROFILER)
bool m_enabledSamplingProfiler { false };
#endif
bool m_activeEvaluateScript { false };
};
}
#endif // InspectorScriptProfilerAgent_h