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