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/Frontend.h" | 9 #include "platform/inspector_protocol/Frontend.h" |
10 #include "platform/inspector_protocol/String16.h" | 10 #include "platform/inspector_protocol/String16.h" |
11 #include "platform/v8_inspector/public/V8ProfilerAgent.h" | 11 #include "platform/v8_inspector/public/V8ProfilerAgent.h" |
12 | 12 |
13 namespace v8 { | 13 namespace v8 { |
14 class Isolate; | 14 class Isolate; |
15 } | 15 } |
16 | 16 |
17 namespace blink { | 17 namespace blink { |
18 | 18 |
19 class V8DebuggerImpl; | 19 class V8DebuggerImpl; |
20 class V8InspectorSessionImpl; | 20 class V8InspectorSessionImpl; |
21 | 21 |
22 class V8ProfilerAgentImpl : public V8ProfilerAgent { | 22 class V8ProfilerAgentImpl : public V8ProfilerAgent { |
23 PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); | 23 PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); |
24 public: | 24 public: |
25 explicit V8ProfilerAgentImpl(V8InspectorSessionImpl*); | 25 explicit V8ProfilerAgentImpl(V8InspectorSessionImpl*); |
26 ~V8ProfilerAgentImpl() override; | 26 ~V8ProfilerAgentImpl() override; |
27 | 27 |
| 28 bool enabled() const { return m_enabled; } |
| 29 |
28 void setInspectorState(protocol::DictionaryValue* state) override { m_state
= state; } | 30 void setInspectorState(protocol::DictionaryValue* state) override { m_state
= state; } |
29 void setFrontend(protocol::Frontend::Profiler* frontend) override { m_fronte
nd = frontend; } | 31 void setFrontend(protocol::Frontend::Profiler* frontend) override { m_fronte
nd = frontend; } |
30 void clearFrontend() override; | 32 void clearFrontend() override; |
31 void restore() override; | 33 void restore() override; |
32 | 34 |
33 void enable(ErrorString*) override; | 35 void enable(ErrorString*) override; |
34 void disable(ErrorString*) override; | 36 void disable(ErrorString*) override; |
35 void setSamplingInterval(ErrorString*, int) override; | 37 void setSamplingInterval(ErrorString*, int) override; |
36 void start(ErrorString*) override; | 38 void start(ErrorString*) override; |
37 void stop(ErrorString*, OwnPtr<protocol::Profiler::CPUProfile>*) override; | 39 void stop(ErrorString*, OwnPtr<protocol::Profiler::CPUProfile>*) override; |
38 | 40 |
39 void consoleProfile(const String16& title) override; | 41 void consoleProfile(const String16& title); |
40 void consoleProfileEnd(const String16& title) override; | 42 void consoleProfileEnd(const String16& title); |
41 | 43 |
42 void idleStarted() override; | 44 void idleStarted() override; |
43 void idleFinished() override; | 45 void idleFinished() override; |
44 | 46 |
45 private: | 47 private: |
46 String16 nextProfileId(); | 48 String16 nextProfileId(); |
47 | 49 |
48 void startProfiling(const String16& title); | 50 void startProfiling(const String16& title); |
49 PassOwnPtr<protocol::Profiler::CPUProfile> stopProfiling(const String16& tit
le, bool serialize); | 51 PassOwnPtr<protocol::Profiler::CPUProfile> stopProfiling(const String16& tit
le, bool serialize); |
50 | 52 |
51 bool isRecording() const; | 53 bool isRecording() const; |
52 | 54 |
53 V8DebuggerImpl* m_debugger; | 55 V8DebuggerImpl* m_debugger; |
54 v8::Isolate* m_isolate; | 56 v8::Isolate* m_isolate; |
55 protocol::DictionaryValue* m_state; | 57 protocol::DictionaryValue* m_state; |
56 protocol::Frontend::Profiler* m_frontend; | 58 protocol::Frontend::Profiler* m_frontend; |
57 bool m_enabled; | 59 bool m_enabled; |
58 bool m_recordingCPUProfile; | 60 bool m_recordingCPUProfile; |
59 class ProfileDescriptor; | 61 class ProfileDescriptor; |
60 protocol::Vector<ProfileDescriptor> m_startedProfiles; | 62 protocol::Vector<ProfileDescriptor> m_startedProfiles; |
61 String16 m_frontendInitiatedProfileId; | 63 String16 m_frontendInitiatedProfileId; |
62 }; | 64 }; |
63 | 65 |
64 } // namespace blink | 66 } // namespace blink |
65 | 67 |
66 | 68 |
67 #endif // !defined(V8ProfilerAgentImpl_h) | 69 #endif // !defined(V8ProfilerAgentImpl_h) |
OLD | NEW |