OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8ProfilerAgentImpl_h | 5 #ifndef V8ProfilerAgentImpl_h |
6 #define V8ProfilerAgentImpl_h | 6 #define V8ProfilerAgentImpl_h |
7 | 7 |
8 #include "platform/inspector_protocol/Allocator.h" | 8 #include "platform/inspector_protocol/Allocator.h" |
9 #include "platform/inspector_protocol/Backend.h" | |
10 #include "platform/inspector_protocol/Frontend.h" | |
11 #include "platform/inspector_protocol/String16.h" | 9 #include "platform/inspector_protocol/String16.h" |
| 10 #include "platform/inspector_protocol/TypeBuilder.h" |
12 | 11 |
13 namespace v8 { | 12 namespace v8 { |
14 class Isolate; | 13 class Isolate; |
15 } | 14 } |
16 | 15 |
17 namespace blink { | 16 namespace blink { |
18 | 17 |
19 class V8InspectorSessionImpl; | 18 class V8InspectorSessionImpl; |
20 | 19 |
21 class V8ProfilerAgentImpl : public protocol::Profiler::Backend { | 20 class V8ProfilerAgentImpl : public protocol::Profiler::Backend { |
22 PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); | 21 PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); |
23 public: | 22 public: |
24 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::Profiler::Frontend*,
protocol::DictionaryValue* state); | 23 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, pro
tocol::DictionaryValue* state); |
25 ~V8ProfilerAgentImpl() override; | 24 ~V8ProfilerAgentImpl() override; |
26 | 25 |
27 bool enabled() const { return m_enabled; } | 26 bool enabled() const { return m_enabled; } |
28 void restore(); | 27 void restore(); |
29 | 28 |
30 void enable(ErrorString*) override; | 29 void enable(ErrorString*) override; |
31 void disable(ErrorString*) override; | 30 void disable(ErrorString*) override; |
32 void setSamplingInterval(ErrorString*, int) override; | 31 void setSamplingInterval(ErrorString*, int) override; |
33 void start(ErrorString*) override; | 32 void start(ErrorString*) override; |
34 void stop(ErrorString*, std::unique_ptr<protocol::Profiler::CPUProfile>*) ov
erride; | 33 void stop(ErrorString*, std::unique_ptr<protocol::Profiler::CPUProfile>*) ov
erride; |
35 | 34 |
36 void consoleProfile(const String16& title); | 35 void consoleProfile(const String16& title); |
37 void consoleProfileEnd(const String16& title); | 36 void consoleProfileEnd(const String16& title); |
38 | 37 |
39 private: | 38 private: |
40 String16 nextProfileId(); | 39 String16 nextProfileId(); |
41 | 40 |
42 void startProfiling(const String16& title); | 41 void startProfiling(const String16& title); |
43 std::unique_ptr<protocol::Profiler::CPUProfile> stopProfiling(const String16
& title, bool serialize); | 42 std::unique_ptr<protocol::Profiler::CPUProfile> stopProfiling(const String16
& title, bool serialize); |
44 | 43 |
45 bool isRecording() const; | 44 bool isRecording() const; |
46 | 45 |
47 V8InspectorSessionImpl* m_session; | 46 V8InspectorSessionImpl* m_session; |
48 v8::Isolate* m_isolate; | 47 v8::Isolate* m_isolate; |
49 protocol::DictionaryValue* m_state; | 48 protocol::DictionaryValue* m_state; |
50 protocol::Profiler::Frontend* m_frontend; | 49 protocol::Profiler::Frontend m_frontend; |
51 bool m_enabled; | 50 bool m_enabled; |
52 bool m_recordingCPUProfile; | 51 bool m_recordingCPUProfile; |
53 class ProfileDescriptor; | 52 class ProfileDescriptor; |
54 protocol::Vector<ProfileDescriptor> m_startedProfiles; | 53 protocol::Vector<ProfileDescriptor> m_startedProfiles; |
55 String16 m_frontendInitiatedProfileId; | 54 String16 m_frontendInitiatedProfileId; |
56 }; | 55 }; |
57 | 56 |
58 } // namespace blink | 57 } // namespace blink |
59 | 58 |
60 | 59 |
61 #endif // !defined(V8ProfilerAgentImpl_h) | 60 #endif // !defined(V8ProfilerAgentImpl_h) |
OLD | NEW |