| 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" | 9 #include "platform/inspector_protocol/Backend.h" |
| 10 #include "platform/inspector_protocol/Frontend.h" | 10 #include "platform/inspector_protocol/Frontend.h" |
| 11 #include "platform/inspector_protocol/String16.h" | 11 #include "platform/inspector_protocol/String16.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 V8InspectorSessionImpl; | 19 class V8InspectorSessionImpl; |
| 20 | 20 |
| 21 class V8ProfilerAgentImpl : public protocol::Backend::Profiler { | 21 class V8ProfilerAgentImpl : public protocol::Profiler::Backend { |
| 22 PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); | 22 PROTOCOL_DISALLOW_COPY(V8ProfilerAgentImpl); |
| 23 public: | 23 public: |
| 24 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::Frontend::Profiler*,
protocol::DictionaryValue* state); | 24 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::Profiler::Frontend*,
protocol::DictionaryValue* state); |
| 25 ~V8ProfilerAgentImpl() override; | 25 ~V8ProfilerAgentImpl() override; |
| 26 | 26 |
| 27 bool enabled() const { return m_enabled; } | 27 bool enabled() const { return m_enabled; } |
| 28 void restore(); | 28 void restore(); |
| 29 | 29 |
| 30 void enable(ErrorString*) override; | 30 void enable(ErrorString*) override; |
| 31 void disable(ErrorString*) override; | 31 void disable(ErrorString*) override; |
| 32 void setSamplingInterval(ErrorString*, int) override; | 32 void setSamplingInterval(ErrorString*, int) override; |
| 33 void start(ErrorString*) override; | 33 void start(ErrorString*) override; |
| 34 void stop(ErrorString*, std::unique_ptr<protocol::Profiler::CPUProfile>*) ov
erride; | 34 void stop(ErrorString*, std::unique_ptr<protocol::Profiler::CPUProfile>*) ov
erride; |
| 35 | 35 |
| 36 void consoleProfile(const String16& title); | 36 void consoleProfile(const String16& title); |
| 37 void consoleProfileEnd(const String16& title); | 37 void consoleProfileEnd(const String16& title); |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 String16 nextProfileId(); | 40 String16 nextProfileId(); |
| 41 | 41 |
| 42 void startProfiling(const String16& title); | 42 void startProfiling(const String16& title); |
| 43 std::unique_ptr<protocol::Profiler::CPUProfile> stopProfiling(const String16
& title, bool serialize); | 43 std::unique_ptr<protocol::Profiler::CPUProfile> stopProfiling(const String16
& title, bool serialize); |
| 44 | 44 |
| 45 bool isRecording() const; | 45 bool isRecording() const; |
| 46 | 46 |
| 47 V8InspectorSessionImpl* m_session; | 47 V8InspectorSessionImpl* m_session; |
| 48 v8::Isolate* m_isolate; | 48 v8::Isolate* m_isolate; |
| 49 protocol::DictionaryValue* m_state; | 49 protocol::DictionaryValue* m_state; |
| 50 protocol::Frontend::Profiler* m_frontend; | 50 protocol::Profiler::Frontend* m_frontend; |
| 51 bool m_enabled; | 51 bool m_enabled; |
| 52 bool m_recordingCPUProfile; | 52 bool m_recordingCPUProfile; |
| 53 class ProfileDescriptor; | 53 class ProfileDescriptor; |
| 54 protocol::Vector<ProfileDescriptor> m_startedProfiles; | 54 protocol::Vector<ProfileDescriptor> m_startedProfiles; |
| 55 String16 m_frontendInitiatedProfileId; | 55 String16 m_frontendInitiatedProfileId; |
| 56 }; | 56 }; |
| 57 | 57 |
| 58 } // namespace blink | 58 } // namespace blink |
| 59 | 59 |
| 60 | 60 |
| 61 #endif // !defined(V8ProfilerAgentImpl_h) | 61 #endif // !defined(V8ProfilerAgentImpl_h) |
| OLD | NEW |