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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 namespace WebCore { | 44 namespace WebCore { |
45 | 45 |
46 class HeapObjectsStatsStream; | 46 class HeapObjectsStatsStream; |
47 class InjectedScriptManager; | 47 class InjectedScriptManager; |
48 class HeapStatsUpdateTask; | 48 class HeapStatsUpdateTask; |
49 class ScriptHeapSnapshot; | 49 class ScriptHeapSnapshot; |
50 class ScriptProfile; | 50 class ScriptProfile; |
51 | 51 |
52 typedef String ErrorString; | 52 typedef String ErrorString; |
53 | 53 |
54 class InspectorHeapProfilerAgent : public InspectorBaseAgent<InspectorHeapProfil
erAgent>, public InspectorBackendDispatcher::HeapProfilerCommandHandler { | 54 class InspectorHeapProfilerAgent : public InspectorBaseAgent, public InspectorBa
ckendDispatcher::HeapProfilerCommandHandler { |
55 WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED; | 55 WTF_MAKE_NONCOPYABLE(InspectorHeapProfilerAgent); WTF_MAKE_FAST_ALLOCATED; |
56 public: | 56 public: |
57 static PassOwnPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, I
nspectorCompositeState*, InjectedScriptManager*); | 57 static PassRefPtr<InspectorHeapProfilerAgent> create(InstrumentingAgents*, I
nspectorState*, InjectedScriptManager*); |
58 virtual ~InspectorHeapProfilerAgent(); | 58 virtual ~InspectorHeapProfilerAgent(); |
59 | 59 |
60 virtual void collectGarbage(ErrorString*); | 60 virtual void collectGarbage(ErrorString*); |
61 virtual void clearProfiles(ErrorString*); | 61 virtual void clearProfiles(ErrorString*); |
62 | 62 |
63 virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeB
uilder::HeapProfiler::ProfileHeader> >&); | 63 virtual void getProfileHeaders(ErrorString*, RefPtr<TypeBuilder::Array<TypeB
uilder::HeapProfiler::ProfileHeader> >&); |
64 virtual void getHeapSnapshot(ErrorString*, int uid); | 64 virtual void getHeapSnapshot(ErrorString*, int uid); |
65 virtual void removeProfile(ErrorString*, int uid); | 65 virtual void removeProfile(ErrorString*, int uid); |
66 virtual void startTrackingHeapObjects(ErrorString*); | 66 virtual void startTrackingHeapObjects(ErrorString*); |
67 virtual void stopTrackingHeapObjects(ErrorString*); | 67 virtual void stopTrackingHeapObjects(ErrorString*); |
68 | 68 |
69 virtual void setFrontend(InspectorFrontend*); | 69 virtual void setFrontend(InspectorFrontend*); |
70 virtual void clearFrontend(); | 70 virtual void clearFrontend(); |
71 virtual void restore(); | 71 virtual void restore(); |
72 | 72 |
73 virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress); | 73 virtual void takeHeapSnapshot(ErrorString*, const bool* reportProgress); |
74 | 74 |
75 virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapsho
tObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
& result); | 75 virtual void getObjectByHeapObjectId(ErrorString*, const String& heapSnapsho
tObjectId, const String* objectGroup, RefPtr<TypeBuilder::Runtime::RemoteObject>
& result); |
76 virtual void getHeapObjectId(ErrorString*, const String& objectId, String* h
eapSnapshotObjectId); | 76 virtual void getHeapObjectId(ErrorString*, const String& objectId, String* h
eapSnapshotObjectId); |
77 | 77 |
78 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; | 78 virtual void reportMemoryUsage(MemoryObjectInfo*) const OVERRIDE; |
79 | 79 |
80 | 80 |
81 private: | 81 private: |
82 class HeapStatsStream; | 82 class HeapStatsStream; |
83 class HeapStatsUpdateTask; | 83 class HeapStatsUpdateTask; |
84 | 84 |
85 InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorCompositeState*, I
njectedScriptManager*); | 85 InspectorHeapProfilerAgent(InstrumentingAgents*, InspectorState*, InjectedSc
riptManager*); |
86 | 86 |
87 typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap; | 87 typedef HashMap<unsigned, RefPtr<ScriptHeapSnapshot> > IdToHeapSnapshotMap; |
88 | 88 |
89 void resetFrontendProfiles(); | 89 void resetFrontendProfiles(); |
90 void requestHeapStatsUpdate(); | 90 void requestHeapStatsUpdate(); |
91 void pushHeapStatsUpdate(const uint32_t* const data, const int size); | 91 void pushHeapStatsUpdate(const uint32_t* const data, const int size); |
92 | 92 |
93 PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(co
nst ScriptHeapSnapshot&); | 93 PassRefPtr<TypeBuilder::HeapProfiler::ProfileHeader> createSnapshotHeader(co
nst ScriptHeapSnapshot&); |
94 | 94 |
95 InjectedScriptManager* m_injectedScriptManager; | 95 InjectedScriptManager* m_injectedScriptManager; |
96 InspectorFrontend::HeapProfiler* m_frontend; | 96 InspectorFrontend::HeapProfiler* m_frontend; |
97 unsigned m_nextUserInitiatedHeapSnapshotNumber; | 97 unsigned m_nextUserInitiatedHeapSnapshotNumber; |
98 IdToHeapSnapshotMap m_snapshots; | 98 IdToHeapSnapshotMap m_snapshots; |
99 OwnPtr<HeapStatsUpdateTask> m_heapStatsUpdateTask; | 99 OwnPtr<HeapStatsUpdateTask> m_heapStatsUpdateTask; |
100 }; | 100 }; |
101 | 101 |
| 102 class InspectorHeapProfilerController: public InspectorBaseController<InspectorH
eapProfilerController, InspectorHeapProfilerAgent> { |
| 103 public: |
| 104 |
| 105 static PassOwnPtr<InspectorHeapProfilerController> create(InstrumentingAgent
s* instrumentingAgents, InspectorCompositeState* compositeState, InjectedScriptM
anager* injectedScriptManager) |
| 106 { |
| 107 return adoptPtr(new InspectorHeapProfilerController(instrumentingAgents,
compositeState, injectedScriptManager)); |
| 108 } |
| 109 |
| 110 protected: |
| 111 InspectorHeapProfilerController(InstrumentingAgents* instrumentingAgents, In
spectorCompositeState* compositeState, InjectedScriptManager* injectedScriptMana
ger) |
| 112 : InspectorBaseController<InspectorHeapProfilerController, InspectorHeap
ProfilerAgent>("HeapProfiler", instrumentingAgents, compositeState) |
| 113 { |
| 114 setAgent(InspectorHeapProfilerAgent::create(m_instrumentingAgents, m_sta
te, injectedScriptManager)); |
| 115 } |
| 116 }; |
| 117 |
102 } // namespace WebCore | 118 } // namespace WebCore |
103 | 119 |
104 | 120 |
105 #endif // !defined(InspectorHeapProfilerAgent_h) | 121 #endif // !defined(InspectorHeapProfilerAgent_h) |
OLD | NEW |