OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2013 Google Inc. All rights reserved. | 2 * Copyright (C) 2013 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 30 matching lines...) Expand all Loading... |
41 #include "wtf/text/WTFString.h" | 41 #include "wtf/text/WTFString.h" |
42 | 42 |
43 namespace WebCore { | 43 namespace WebCore { |
44 | 44 |
45 class InjectedScriptManager; | 45 class InjectedScriptManager; |
46 class HeapStatsUpdateTask; | 46 class HeapStatsUpdateTask; |
47 class ScriptHeapSnapshot; | 47 class ScriptHeapSnapshot; |
48 | 48 |
49 typedef String ErrorString; | 49 typedef String ErrorString; |
50 | 50 |
51 class InspectorHeapProfilerAgent : public InspectorBaseAgent<InspectorHeapProfil
erAgent>, public InspectorBackendDispatcher::HeapProfilerCommandHandler { | 51 class InspectorHeapProfilerAgent FINAL : public InspectorBaseAgent<InspectorHeap
ProfilerAgent>, public InspectorBackendDispatcher::HeapProfilerCommandHandler { |
52 WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED; | 52 WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED; |
53 public: | 53 public: |
54 static PassOwnPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, I
nspectorCompositeState*, InjectedScriptManager*); | 54 static PassOwnPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, I
nspectorCompositeState*, InjectedScriptManager*); |
55 virtual ~InspectorHeapProfilerAgent(); | 55 virtual ~InspectorHeapProfilerAgent(); |
56 | 56 |
57 virtual void collectGarbage(ErrorString*); | 57 virtual void collectGarbage(ErrorString*) OVERRIDE; |
58 virtual void clearProfiles(ErrorString*); | 58 virtual void clearProfiles(ErrorString*) OVERRIDE; |
59 | 59 |
60 virtual void enable(ErrorString*); | 60 virtual void enable(ErrorString*) OVERRIDE; |
61 virtual void disable(ErrorString*); | 61 virtual void disable(ErrorString*) OVERRIDE; |
62 virtual void getHeapSnapshot(ErrorString*, int uid); | 62 virtual void getHeapSnapshot(ErrorString*, int uid) OVERRIDE; |
63 virtual void removeProfile(ErrorString*, int uid); | 63 virtual void removeProfile(ErrorString*, int uid) OVERRIDE; |
64 virtual void startTrackingHeapObjects(ErrorString*); | 64 virtual void startTrackingHeapObjects(ErrorString*) OVERRIDE; |
65 virtual void stopTrackingHeapObjects(ErrorString*, const bool* reportProgres
s); | 65 virtual void stopTrackingHeapObjects(ErrorString*, const bool* reportProgres
s) OVERRIDE; |
66 | 66 |
67 virtual void setFrontend(InspectorFrontend*); | 67 virtual void setFrontend(InspectorFrontend*) OVERRIDE; |
68 virtual void clearFrontend(); | 68 virtual void clearFrontend() OVERRIDE; |
69 virtual void restore(); | 69 virtual void restore() OVERRIDE; |
70 | 70 |
71 virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress); | 71 virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress) OVER
RIDE; |
72 | 72 |
73 virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapsho
tObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
& result); | 73 virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapsho
tObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
& result) OVERRIDE; |
74 virtual void getHeapObjectId(ErrorString*, const String& objectId, String* h
eapSnapshotObjectId); | 74 virtual void getHeapObjectId(ErrorString*, const String& objectId, String* h
eapSnapshotObjectId) OVERRIDE; |
75 | 75 |
76 private: | 76 private: |
77 class HeapStatsStream; | 77 class HeapStatsStream; |
78 class HeapStatsUpdateTask; | 78 class HeapStatsUpdateTask; |
79 | 79 |
80 InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorCompositeState*, I
njectedScriptManager*); | 80 InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorCompositeState*, I
njectedScriptManager*); |
81 | 81 |
82 typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap; | 82 typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap; |
83 | 83 |
84 void resetFrontendProfiles(); | 84 void resetFrontendProfiles(); |
85 void requestHeapStatsUpdate(); | 85 void requestHeapStatsUpdate(); |
86 void pushHeapStatsUpdate(const uint32_t* const data, const int size); | 86 void pushHeapStatsUpdate(const uint32_t* const data, const int size); |
87 | 87 |
88 PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(co
nst ScriptHeapSnapshot&); | 88 PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(co
nst ScriptHeapSnapshot&); |
89 void stopTrackingHeapObjectsInternal(); | 89 void stopTrackingHeapObjectsInternal(); |
90 | 90 |
91 InjectedScriptManager* m_injectedScriptManager; | 91 InjectedScriptManager* m_injectedScriptManager; |
92 InspectorFrontend::HeapProfiler* m_frontend; | 92 InspectorFrontend::HeapProfiler* m_frontend; |
93 unsigned m_nextUserInitiatedHeapSnapshotNumber; | 93 unsigned m_nextUserInitiatedHeapSnapshotNumber; |
94 IdToHeapSnapshotMap m_snapshots; | 94 IdToHeapSnapshotMap m_snapshots; |
95 OwnPtr<HeapStatsUpdateTask> m_heapStatsUpdateTask; | 95 OwnPtr<HeapStatsUpdateTask> m_heapStatsUpdateTask; |
96 }; | 96 }; |
97 | 97 |
98 } // namespace WebCore | 98 } // namespace WebCore |
99 | 99 |
100 | 100 |
101 #endif // !defined(InspectorHeapProfilerAgent_h) | 101 #endif // !defined(InspectorHeapProfilerAgent_h) |
OLD | NEW |