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/v8_inspector/public/V8HeapProfilerAgent.h" | 9 #include "platform/v8_inspector/public/V8HeapProfilerAgent.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class V8RuntimeAgentImpl; | 13 class V8RuntimeAgentImpl; |
14 | 14 |
15 typedef String ErrorString; | |
16 | |
17 using protocol::Maybe; | 15 using protocol::Maybe; |
18 | 16 |
19 class V8HeapProfilerAgentImpl : public V8HeapProfilerAgent { | 17 class V8HeapProfilerAgentImpl : public V8HeapProfilerAgent { |
20 PROTOCOL_DISALLOW_COPY(V8HeapProfilerAgentImpl); | 18 PROTOCOL_DISALLOW_COPY(V8HeapProfilerAgentImpl); |
21 public: | 19 public: |
22 explicit V8HeapProfilerAgentImpl(v8::Isolate*, V8RuntimeAgent*); | 20 explicit V8HeapProfilerAgentImpl(v8::Isolate*, V8RuntimeAgent*); |
23 ~V8HeapProfilerAgentImpl() override; | 21 ~V8HeapProfilerAgentImpl() override; |
24 | 22 |
25 void setInspectorState(protocol::DictionaryValue* state) override { m_state
= state; } | 23 void setInspectorState(protocol::DictionaryValue* state) override { m_state
= state; } |
26 void setFrontend(protocol::Frontend::HeapProfiler* frontend) override { m_fr
ontend = frontend; } | 24 void setFrontend(protocol::Frontend::HeapProfiler* frontend) override { m_fr
ontend = frontend; } |
27 void clearFrontend() override; | 25 void clearFrontend() override; |
28 void restore() override; | 26 void restore() override; |
29 | 27 |
30 void collectGarbage(ErrorString*) override; | 28 void collectGarbage(ErrorString*) override; |
31 | 29 |
32 void enable(ErrorString*) override; | 30 void enable(ErrorString*) override; |
33 void startTrackingHeapObjects(ErrorString*, const Maybe<bool>& trackAllocati
ons) override; | 31 void startTrackingHeapObjects(ErrorString*, const Maybe<bool>& trackAllocati
ons) override; |
34 void stopTrackingHeapObjects(ErrorString*, const Maybe<bool>& reportProgress
) override; | 32 void stopTrackingHeapObjects(ErrorString*, const Maybe<bool>& reportProgress
) override; |
35 | 33 |
36 void disable(ErrorString*) override; | 34 void disable(ErrorString*) override; |
37 | 35 |
38 void takeHeapSnapshot(ErrorString*, const Maybe<bool>& reportProgress) overr
ide; | 36 void takeHeapSnapshot(ErrorString*, const Maybe<bool>& reportProgress) overr
ide; |
39 | 37 |
40 void getObjectByHeapObjectId(ErrorString*, const String& heapSnapshotObjectI
d, const Maybe<String>& objectGroup, OwnPtr<protocol::Runtime::RemoteObject>* re
sult) override; | 38 void getObjectByHeapObjectId(ErrorString*, const String16& heapSnapshotObjec
tId, const Maybe<String16>& objectGroup, OwnPtr<protocol::Runtime::RemoteObject>
* result) override; |
41 void addInspectedHeapObject(ErrorString*, const String& inspectedHeapObjectI
d) override; | 39 void addInspectedHeapObject(ErrorString*, const String16& inspectedHeapObjec
tId) override; |
42 void getHeapObjectId(ErrorString*, const String& objectId, String* heapSnaps
hotObjectId) override; | 40 void getHeapObjectId(ErrorString*, const String16& objectId, String16* heapS
napshotObjectId) override; |
43 | 41 |
44 void startSampling(ErrorString*) override; | 42 void startSampling(ErrorString*) override; |
45 void stopSampling(ErrorString*, OwnPtr<protocol::HeapProfiler::SamplingHeapP
rofile>*) override; | 43 void stopSampling(ErrorString*, OwnPtr<protocol::HeapProfiler::SamplingHeapP
rofile>*) override; |
46 | 44 |
47 void requestHeapStatsUpdate() override; | 45 void requestHeapStatsUpdate() override; |
48 | 46 |
49 private: | 47 private: |
50 void startTrackingHeapObjectsInternal(bool trackAllocations); | 48 void startTrackingHeapObjectsInternal(bool trackAllocations); |
51 void stopTrackingHeapObjectsInternal(); | 49 void stopTrackingHeapObjectsInternal(); |
52 | 50 |
53 v8::Isolate* m_isolate; | 51 v8::Isolate* m_isolate; |
54 V8RuntimeAgentImpl* m_runtimeAgent; | 52 V8RuntimeAgentImpl* m_runtimeAgent; |
55 protocol::Frontend::HeapProfiler* m_frontend; | 53 protocol::Frontend::HeapProfiler* m_frontend; |
56 protocol::DictionaryValue* m_state; | 54 protocol::DictionaryValue* m_state; |
57 }; | 55 }; |
58 | 56 |
59 } // namespace blink | 57 } // namespace blink |
60 | 58 |
61 #endif // !defined(V8HeapProfilerAgentImpl_h) | 59 #endif // !defined(V8HeapProfilerAgentImpl_h) |
OLD | NEW |