OLD | NEW |
| (Empty) |
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_V8PROFILERAGENTIMPL_H_ | |
6 #define V8_INSPECTOR_V8PROFILERAGENTIMPL_H_ | |
7 | |
8 #include "src/inspector/Allocator.h" | |
9 #include "src/inspector/protocol/Forward.h" | |
10 #include "src/inspector/protocol/Profiler.h" | |
11 | |
12 #include <vector> | |
13 | |
14 namespace v8 { | |
15 class CpuProfiler; | |
16 class Isolate; | |
17 } | |
18 | |
19 namespace v8_inspector { | |
20 | |
21 class V8InspectorSessionImpl; | |
22 | |
23 using protocol::ErrorString; | |
24 | |
25 class V8ProfilerAgentImpl : public protocol::Profiler::Backend { | |
26 V8_INSPECTOR_DISALLOW_COPY(V8ProfilerAgentImpl); | |
27 public: | |
28 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, pro
tocol::DictionaryValue* state); | |
29 ~V8ProfilerAgentImpl() override; | |
30 | |
31 bool enabled() const { return m_enabled; } | |
32 void restore(); | |
33 | |
34 void enable(ErrorString*) override; | |
35 void disable(ErrorString*) override; | |
36 void setSamplingInterval(ErrorString*, int) override; | |
37 void start(ErrorString*) override; | |
38 void stop(ErrorString*, std::unique_ptr<protocol::Profiler::Profile>*) overr
ide; | |
39 | |
40 void consoleProfile(const String16& title); | |
41 void consoleProfileEnd(const String16& title); | |
42 | |
43 private: | |
44 String16 nextProfileId(); | |
45 v8::CpuProfiler* profiler(); | |
46 | |
47 void startProfiling(const String16& title); | |
48 std::unique_ptr<protocol::Profiler::Profile> stopProfiling(const String16& t
itle, bool serialize); | |
49 | |
50 bool isRecording() const; | |
51 | |
52 V8InspectorSessionImpl* m_session; | |
53 v8::Isolate* m_isolate; | |
54 v8::CpuProfiler* m_profiler; | |
55 protocol::DictionaryValue* m_state; | |
56 protocol::Profiler::Frontend m_frontend; | |
57 bool m_enabled; | |
58 bool m_recordingCPUProfile; | |
59 class ProfileDescriptor; | |
60 std::vector<ProfileDescriptor> m_startedProfiles; | |
61 String16 m_frontendInitiatedProfileId; | |
62 }; | |
63 | |
64 } // namespace v8_inspector | |
65 | |
66 #endif // V8_INSPECTOR_V8PROFILERAGENTIMPL_H_ | |
OLD | NEW |