InspectorScriptProfilerAgent.h [plain text]
#pragma once
#include "Debugger.h"
#include "InspectorAgentBase.h"
#include "InspectorBackendDispatchers.h"
#include "InspectorFrontendDispatchers.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);
WTF_MAKE_FAST_ALLOCATED;
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;
Seconds willEvaluateScript() override;
void didEvaluateScript(Seconds, JSC::ProfilingReason) override;
private:
void addEvent(Seconds startTime, Seconds endTime, JSC::ProfilingReason);
void trackingComplete();
void stopSamplingWhenDisconnecting();
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 };
};
}