Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(455)

Side by Side Diff: src/inspector/v8-heap-profiler-agent-impl.h

Issue 2474483003: [inspector] migrate HeapProfiler to new style (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | src/inspector/v8-heap-profiler-agent-impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 the V8 project authors. All rights reserved. 1 // Copyright 2016 the V8 project 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 V8_INSPECTOR_V8HEAPPROFILERAGENTIMPL_H_ 5 #ifndef V8_INSPECTOR_V8HEAPPROFILERAGENTIMPL_H_
6 #define V8_INSPECTOR_V8HEAPPROFILERAGENTIMPL_H_ 6 #define V8_INSPECTOR_V8HEAPPROFILERAGENTIMPL_H_
7 7
8 #include "src/base/macros.h" 8 #include "src/base/macros.h"
9 #include "src/inspector/protocol/Forward.h" 9 #include "src/inspector/protocol/Forward.h"
10 #include "src/inspector/protocol/HeapProfiler.h" 10 #include "src/inspector/protocol/HeapProfiler.h"
11 11
12 #include "include/v8.h" 12 #include "include/v8.h"
13 13
14 namespace v8_inspector { 14 namespace v8_inspector {
15 15
16 class V8InspectorSessionImpl; 16 class V8InspectorSessionImpl;
17 17
18 using protocol::ErrorString;
19 using protocol::Maybe; 18 using protocol::Maybe;
19 using protocol::Response;
20 20
21 class V8HeapProfilerAgentImpl : public protocol::HeapProfiler::Backend { 21 class V8HeapProfilerAgentImpl : public protocol::HeapProfiler::Backend {
22 public: 22 public:
23 V8HeapProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*, 23 V8HeapProfilerAgentImpl(V8InspectorSessionImpl*, protocol::FrontendChannel*,
24 protocol::DictionaryValue* state); 24 protocol::DictionaryValue* state);
25 ~V8HeapProfilerAgentImpl() override; 25 ~V8HeapProfilerAgentImpl() override;
26 void restore(); 26 void restore();
27 27
28 void collectGarbage(ErrorString*) override; 28 Response collectGarbage() override;
29 29
30 void enable(ErrorString*) override; 30 Response enable() override;
31 void startTrackingHeapObjects(ErrorString*, 31 Response startTrackingHeapObjects(Maybe<bool> trackAllocations) override;
32 const Maybe<bool>& trackAllocations) override; 32 Response stopTrackingHeapObjects(Maybe<bool> reportProgress) override;
33 void stopTrackingHeapObjects(ErrorString*,
34 const Maybe<bool>& reportProgress) override;
35 33
36 void disable(ErrorString*) override; 34 Response disable() override;
37 35
38 void takeHeapSnapshot(ErrorString*, 36 Response takeHeapSnapshot(Maybe<bool> reportProgress) override;
39 const Maybe<bool>& reportProgress) override;
40 37
41 void getObjectByHeapObjectId( 38 Response getObjectByHeapObjectId(
42 ErrorString*, const String16& heapSnapshotObjectId, 39 const String16& heapSnapshotObjectId, Maybe<String16> objectGroup,
43 const Maybe<String16>& objectGroup,
44 std::unique_ptr<protocol::Runtime::RemoteObject>* result) override; 40 std::unique_ptr<protocol::Runtime::RemoteObject>* result) override;
45 void addInspectedHeapObject(ErrorString*, 41 Response addInspectedHeapObject(
46 const String16& inspectedHeapObjectId) override; 42 const String16& inspectedHeapObjectId) override;
47 void getHeapObjectId(ErrorString*, const String16& objectId, 43 Response getHeapObjectId(const String16& objectId,
48 String16* heapSnapshotObjectId) override; 44 String16* heapSnapshotObjectId) override;
49 45
50 void startSampling(ErrorString*, 46 Response startSampling(Maybe<double> samplingInterval) override;
51 const Maybe<double>& samplingInterval) override; 47 Response stopSampling(
52 void stopSampling(
53 ErrorString*,
54 std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfile>*) override; 48 std::unique_ptr<protocol::HeapProfiler::SamplingHeapProfile>*) override;
55 49
56 private: 50 private:
57 void startTrackingHeapObjectsInternal(bool trackAllocations); 51 void startTrackingHeapObjectsInternal(bool trackAllocations);
58 void stopTrackingHeapObjectsInternal(); 52 void stopTrackingHeapObjectsInternal();
59 void requestHeapStatsUpdate(); 53 void requestHeapStatsUpdate();
60 static void onTimer(void*); 54 static void onTimer(void*);
61 55
62 V8InspectorSessionImpl* m_session; 56 V8InspectorSessionImpl* m_session;
63 v8::Isolate* m_isolate; 57 v8::Isolate* m_isolate;
64 protocol::HeapProfiler::Frontend m_frontend; 58 protocol::HeapProfiler::Frontend m_frontend;
65 protocol::DictionaryValue* m_state; 59 protocol::DictionaryValue* m_state;
66 bool m_hasTimer; 60 bool m_hasTimer;
67 61
68 DISALLOW_COPY_AND_ASSIGN(V8HeapProfilerAgentImpl); 62 DISALLOW_COPY_AND_ASSIGN(V8HeapProfilerAgentImpl);
69 }; 63 };
70 64
71 } // namespace v8_inspector 65 } // namespace v8_inspector
72 66
73 #endif // V8_INSPECTOR_V8HEAPPROFILERAGENTIMPL_H_ 67 #endif // V8_INSPECTOR_V8HEAPPROFILERAGENTIMPL_H_
OLDNEW
« no previous file with comments | « no previous file | src/inspector/v8-heap-profiler-agent-impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698