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