v8
V8 is Google’s open source high-performance JavaScript and WebAssembly engine, written in C++.
Loading...
Searching...
No Matches
v8-profiler-agent-impl.h
Go to the documentation of this file.
1// Copyright 2015 the V8 project authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef V8_INSPECTOR_V8_PROFILER_AGENT_IMPL_H_
6#define V8_INSPECTOR_V8_PROFILER_AGENT_IMPL_H_
7
8#include <memory>
9#include <vector>
10
11#include "src/base/macros.h"
12#include "src/inspector/protocol/Forward.h"
13#include "src/inspector/protocol/Profiler.h"
14
15namespace v8 {
16class CpuProfiler;
17class Isolate;
18} // namespace v8
19
20namespace v8_inspector {
21
22class V8InspectorSessionImpl;
23
24using protocol::Response;
25
26class V8ProfilerAgentImpl : public protocol::Profiler::Backend {
27 public:
28 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*,
29 protocol::DictionaryValue* state);
30 ~V8ProfilerAgentImpl() override;
33
34 bool enabled() const { return m_enabled; }
35 void restore();
36
37 Response enable() override;
38 Response disable() override;
39 Response setSamplingInterval(int) override;
40 Response start() override;
41 Response stop(std::unique_ptr<protocol::Profiler::Profile>*) override;
42
43 Response startPreciseCoverage(std::optional<bool> binary,
44 std::optional<bool> detailed,
45 std::optional<bool> allow_triggered_updates,
46 double* out_timestamp) override;
47 Response stopPreciseCoverage() override;
48 Response takePreciseCoverage(
49 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>*
50 out_result,
51 double* out_timestamp) override;
52 Response getBestEffortCoverage(
53 std::unique_ptr<protocol::Array<protocol::Profiler::ScriptCoverage>>*
54 out_result) override;
55
56 void consoleProfile(const String16& title);
57 void consoleProfileEnd(const String16& title);
58
59 void triggerPreciseCoverageDeltaUpdate(const String16& occasion);
60
61 private:
63
64 void startProfiling(const String16& title);
65 std::unique_ptr<protocol::Profiler::Profile> stopProfiling(
66 const String16& title, bool serialize);
67
71 protocol::DictionaryValue* m_state;
72 protocol::Profiler::Frontend m_frontend;
73 bool m_enabled = false;
76 std::vector<ProfileDescriptor> m_startedProfiles;
79};
80
81} // namespace v8_inspector
82
83#endif // V8_INSPECTOR_V8_PROFILER_AGENT_IMPL_H_
Response takePreciseCoverage(std::unique_ptr< protocol::Array< protocol::Profiler::ScriptCoverage > > *out_result, double *out_timestamp) override
V8ProfilerAgentImpl & operator=(const V8ProfilerAgentImpl &)=delete
void startProfiling(const String16 &title)
Response startPreciseCoverage(std::optional< bool > binary, std::optional< bool > detailed, std::optional< bool > allow_triggered_updates, double *out_timestamp) override
protocol::Profiler::Frontend m_frontend
Response getBestEffortCoverage(std::unique_ptr< protocol::Array< protocol::Profiler::ScriptCoverage > > *out_result) override
void consoleProfile(const String16 &title)
V8ProfilerAgentImpl(const V8ProfilerAgentImpl &)=delete
V8ProfilerAgentImpl(V8InspectorSessionImpl *, protocol::FrontendChannel *, protocol::DictionaryValue *state)
std::vector< ProfileDescriptor > m_startedProfiles
protocol::DictionaryValue * m_state
std::unique_ptr< protocol::Profiler::Profile > stopProfiling(const String16 &title, bool serialize)
void triggerPreciseCoverageDeltaUpdate(const String16 &occasion)
Response stop(std::unique_ptr< protocol::Profiler::Profile > *) override
void consoleProfileEnd(const String16 &title)