OLD | NEW |
(Empty) | |
| 1 // Copyright 2015 the V8 project authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef V8_INSPECTOR_V8PROFILERAGENTIMPL_H_ |
| 6 #define V8_INSPECTOR_V8PROFILERAGENTIMPL_H_ |
| 7 |
| 8 #include "src/inspector/Allocator.h" |
| 9 #include "src/inspector/protocol/Forward.h" |
| 10 #include "src/inspector/protocol/Profiler.h" |
| 11 |
| 12 #include <vector> |
| 13 |
| 14 namespace v8 { |
| 15 class CpuProfiler; |
| 16 class Isolate; |
| 17 } |
| 18 |
| 19 namespace v8_inspector { |
| 20 |
| 21 class V8InspectorSessionImpl; |
| 22 |
| 23 using protocol::ErrorString; |
| 24 |
| 25 class V8ProfilerAgentImpl : public protocol::Profiler::Backend { |
| 26 V8_INSPECTOR_DISALLOW_COPY(V8ProfilerAgentImpl); |
| 27 |
| 28 public: |
| 29 V8ProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, |
| 30 protocol::DictionaryValue* state); |
| 31 ~V8ProfilerAgentImpl() override; |
| 32 |
| 33 bool enabled() const { return m_enabled; } |
| 34 void restore(); |
| 35 |
| 36 void enable(ErrorString*) override; |
| 37 void disable(ErrorString*) override; |
| 38 void setSamplingInterval(ErrorString*, int) override; |
| 39 void start(ErrorString*) override; |
| 40 void stop(ErrorString*, |
| 41 std::unique_ptr<protocol::Profiler::Profile>*) override; |
| 42 |
| 43 void consoleProfile(const String16& title); |
| 44 void consoleProfileEnd(const String16& title); |
| 45 |
| 46 private: |
| 47 String16 nextProfileId(); |
| 48 v8::CpuProfiler* profiler(); |
| 49 |
| 50 void startProfiling(const String16& title); |
| 51 std::unique_ptr<protocol::Profiler::Profile> stopProfiling( |
| 52 const String16& title, bool serialize); |
| 53 |
| 54 bool isRecording() const; |
| 55 |
| 56 V8InspectorSessionImpl* m_session; |
| 57 v8::Isolate* m_isolate; |
| 58 v8::CpuProfiler* m_profiler; |
| 59 protocol::DictionaryValue* m_state; |
| 60 protocol::Profiler::Frontend m_frontend; |
| 61 bool m_enabled; |
| 62 bool m_recordingCPUProfile; |
| 63 class ProfileDescriptor; |
| 64 std::vector<ProfileDescriptor> m_startedProfiles; |
| 65 String16 m_frontendInitiatedProfileId; |
| 66 }; |
| 67 |
| 68 } // namespace v8_inspector |
| 69 |
| 70 #endif // V8_INSPECTOR_V8PROFILERAGENTIMPL_H_ |
OLD | NEW |