OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 V8HeapProfilerAgentImpl_h | 5 #ifndef V8HeapProfilerAgentImpl_h |
6 #define V8HeapProfilerAgentImpl_h | 6 #define V8HeapProfilerAgentImpl_h |
7 | 7 |
8 #include "platform/inspector_protocol/Allocator.h" | 8 #include "platform/inspector_protocol/Allocator.h" |
9 #include "platform/inspector_protocol/Backend.h" | |
10 #include "platform/inspector_protocol/Frontend.h" | |
11 #include "platform/inspector_protocol/String16.h" | 9 #include "platform/inspector_protocol/String16.h" |
| 10 #include "platform/inspector_protocol/TypeBuilder.h" |
12 | 11 |
13 namespace blink { | 12 namespace blink { |
14 | 13 |
15 class V8InspectorSessionImpl; | 14 class V8InspectorSessionImpl; |
16 | 15 |
17 using protocol::Maybe; | 16 using protocol::Maybe; |
18 | 17 |
19 class V8HeapProfilerAgentImpl : public protocol::HeapProfiler::Backend { | 18 class V8HeapProfilerAgentImpl : public protocol::HeapProfiler::Backend { |
20 PROTOCOL_DISALLOW_COPY(V8HeapProfilerAgentImpl); | 19 PROTOCOL_DISALLOW_COPY(V8HeapProfilerAgentImpl); |
21 public: | 20 public: |
22 V8HeapProfilerAgentImpl(V8InspectorSessionImpl*, protocol::HeapProfiler::Fro
ntend*, protocol::DictionaryValue* state); | 21 V8HeapProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*,
protocol::DictionaryValue* state); |
23 ~V8HeapProfilerAgentImpl() override; | 22 ~V8HeapProfilerAgentImpl() override; |
24 void restore(); | 23 void restore(); |
25 | 24 |
26 void collectGarbage(ErrorString*) override; | 25 void collectGarbage(ErrorString*) override; |
27 | 26 |
28 void enable(ErrorString*) override; | 27 void enable(ErrorString*) override; |
29 void startTrackingHeapObjects(ErrorString*, const Maybe<bool>& trackAllocati
ons) override; | 28 void startTrackingHeapObjects(ErrorString*, const Maybe<bool>& trackAllocati
ons) override; |
30 void stopTrackingHeapObjects(ErrorString*, const Maybe<bool>& reportProgress
) override; | 29 void stopTrackingHeapObjects(ErrorString*, const Maybe<bool>& reportProgress
) override; |
31 | 30 |
32 void disable(ErrorString*) override; | 31 void disable(ErrorString*) override; |
33 | 32 |
34 void takeHeapSnapshot(ErrorString*, const Maybe<bool>& reportProgress) overr
ide; | 33 void takeHeapSnapshot(ErrorString*, const Maybe<bool>& reportProgress) overr
ide; |
35 | 34 |
36 void getObjectByHeapObjectId(ErrorString*, const String16& heapSnapshotObjec
tId, const Maybe<String16>& objectGroup, std::unique_ptr<protocol::Runtime::Remo
teObject>* result) override; | 35 void getObjectByHeapObjectId(ErrorString*, const String16& heapSnapshotObjec
tId, const Maybe<String16>& objectGroup, std::unique_ptr<protocol::Runtime::Remo
teObject>* result) override; |
37 void addInspectedHeapObject(ErrorString*, const String16& inspectedHeapObjec
tId) override; | 36 void addInspectedHeapObject(ErrorString*, const String16& inspectedHeapObjec
tId) override; |
38 void getHeapObjectId(ErrorString*, const String16& objectId, String16* heapS
napshotObjectId) override; | 37 void getHeapObjectId(ErrorString*, const String16& objectId, String16* heapS
napshotObjectId) override; |
39 | 38 |
40 void startSampling(ErrorString*, const Maybe<double>& samplingInterval) over
ride; | 39 void startSampling(ErrorString*, const Maybe<double>& samplingInterval) over
ride; |
41 void stopSampling(ErrorString*, std::unique_ptr<protocol::HeapProfiler::Samp
lingHeapProfile>*) override; | 40 void stopSampling(ErrorString*, std::unique_ptr<protocol::HeapProfiler::Samp
lingHeapProfile>*) override; |
42 | 41 |
43 private: | 42 private: |
44 void startTrackingHeapObjectsInternal(bool trackAllocations); | 43 void startTrackingHeapObjectsInternal(bool trackAllocations); |
45 void stopTrackingHeapObjectsInternal(); | 44 void stopTrackingHeapObjectsInternal(); |
46 void requestHeapStatsUpdate(); | 45 void requestHeapStatsUpdate(); |
47 static void onTimer(void*); | 46 static void onTimer(void*); |
48 | 47 |
49 V8InspectorSessionImpl* m_session; | 48 V8InspectorSessionImpl* m_session; |
50 v8::Isolate* m_isolate; | 49 v8::Isolate* m_isolate; |
51 protocol::HeapProfiler::Frontend* m_frontend; | 50 protocol::HeapProfiler::Frontend m_frontend; |
52 protocol::DictionaryValue* m_state; | 51 protocol::DictionaryValue* m_state; |
53 bool m_hasTimer; | 52 bool m_hasTimer; |
54 }; | 53 }; |
55 | 54 |
56 } // namespace blink | 55 } // namespace blink |
57 | 56 |
58 #endif // !defined(V8HeapProfilerAgentImpl_h) | 57 #endif // !defined(V8HeapProfilerAgentImpl_h) |
OLD | NEW |