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