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

Side by Side Diff: Source/core/inspector/InspectorHeapProfilerAgent.cpp

Issue 323043002: Oilpan: Prepare moving InspectorAgent related classes to oilpan (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months 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 | Annotate | Revision Log
OLDNEW
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
41 namespace blink { 41 namespace blink {
42 42
43 typedef uint32_t SnapshotObjectId; 43 typedef uint32_t SnapshotObjectId;
44 44
45 namespace HeapProfilerAgentState { 45 namespace HeapProfilerAgentState {
46 static const char heapProfilerEnabled[] = "heapProfilerEnabled"; 46 static const char heapProfilerEnabled[] = "heapProfilerEnabled";
47 static const char heapObjectsTrackingEnabled[] = "heapObjectsTrackingEnabled"; 47 static const char heapObjectsTrackingEnabled[] = "heapObjectsTrackingEnabled";
48 static const char allocationTrackingEnabled[] = "allocationTrackingEnabled"; 48 static const char allocationTrackingEnabled[] = "allocationTrackingEnabled";
49 } 49 }
50 50
51 class InspectorHeapProfilerAgent::HeapStatsUpdateTask { 51 class InspectorHeapProfilerAgent::HeapStatsUpdateTask FINAL : public NoBaseWillB eGarbageCollectedFinalized<InspectorHeapProfilerAgent::HeapStatsUpdateTask> {
52 public: 52 public:
53 HeapStatsUpdateTask(InspectorHeapProfilerAgent*); 53 explicit HeapStatsUpdateTask(InspectorHeapProfilerAgent*);
54 void startTimer(); 54 void startTimer();
55 void resetTimer() { m_timer.stop(); } 55 void resetTimer() { m_timer.stop(); }
56 void onTimer(Timer<HeapStatsUpdateTask>*); 56 void onTimer(Timer<HeapStatsUpdateTask>*);
57 void trace(Visitor*);
57 58
58 private: 59 private:
59 InspectorHeapProfilerAgent* m_heapProfilerAgent; 60 RawPtrWillBeMember<InspectorHeapProfilerAgent> m_heapProfilerAgent;
60 Timer<HeapStatsUpdateTask> m_timer; 61 Timer<HeapStatsUpdateTask> m_timer;
61 }; 62 };
62 63
63 PassOwnPtrWillBeRawPtr<InspectorHeapProfilerAgent> InspectorHeapProfilerAgent::c reate(InjectedScriptManager* injectedScriptManager) 64 PassOwnPtrWillBeRawPtr<InspectorHeapProfilerAgent> InspectorHeapProfilerAgent::c reate(InjectedScriptManager* injectedScriptManager)
64 { 65 {
65 return adoptPtrWillBeNoop(new InspectorHeapProfilerAgent(injectedScriptManag er)); 66 return adoptPtrWillBeNoop(new InspectorHeapProfilerAgent(injectedScriptManag er));
66 } 67 }
67 68
68 InspectorHeapProfilerAgent::InspectorHeapProfilerAgent(InjectedScriptManager* in jectedScriptManager) 69 InspectorHeapProfilerAgent::InspectorHeapProfilerAgent(InjectedScriptManager* in jectedScriptManager)
69 : InspectorBaseAgent<InspectorHeapProfilerAgent>("HeapProfiler") 70 : InspectorBaseAgent<InspectorHeapProfilerAgent>("HeapProfiler")
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
119 // so this method will never be called after m_heapProfilerAgent has been de stroyed. 120 // so this method will never be called after m_heapProfilerAgent has been de stroyed.
120 m_heapProfilerAgent->requestHeapStatsUpdate(); 121 m_heapProfilerAgent->requestHeapStatsUpdate();
121 } 122 }
122 123
123 void InspectorHeapProfilerAgent::HeapStatsUpdateTask::startTimer() 124 void InspectorHeapProfilerAgent::HeapStatsUpdateTask::startTimer()
124 { 125 {
125 ASSERT(!m_timer.isActive()); 126 ASSERT(!m_timer.isActive());
126 m_timer.startRepeating(0.05, FROM_HERE); 127 m_timer.startRepeating(0.05, FROM_HERE);
127 } 128 }
128 129
130 void InspectorHeapProfilerAgent::HeapStatsUpdateTask::trace(Visitor* visitor)
131 {
132 visitor->trace(m_heapProfilerAgent);
133 }
134
129 class InspectorHeapProfilerAgent::HeapStatsStream FINAL : public ScriptProfiler: :OutputStream { 135 class InspectorHeapProfilerAgent::HeapStatsStream FINAL : public ScriptProfiler: :OutputStream {
130 public: 136 public:
131 HeapStatsStream(InspectorHeapProfilerAgent* heapProfilerAgent) 137 HeapStatsStream(InspectorHeapProfilerAgent* heapProfilerAgent)
132 : m_heapProfilerAgent(heapProfilerAgent) 138 : m_heapProfilerAgent(heapProfilerAgent)
133 { 139 {
134 } 140 }
135 141
136 virtual void write(const uint32_t* chunk, const int size) OVERRIDE 142 virtual void write(const uint32_t* chunk, const int size) OVERRIDE
137 { 143 {
138 ASSERT(chunk); 144 ASSERT(chunk);
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 requestHeapStatsUpdate(); 185 requestHeapStatsUpdate();
180 takeHeapSnapshot(error, reportProgress); 186 takeHeapSnapshot(error, reportProgress);
181 stopTrackingHeapObjectsInternal(); 187 stopTrackingHeapObjectsInternal();
182 } 188 }
183 189
184 void InspectorHeapProfilerAgent::startTrackingHeapObjectsInternal(bool trackAllo cations) 190 void InspectorHeapProfilerAgent::startTrackingHeapObjectsInternal(bool trackAllo cations)
185 { 191 {
186 if (m_heapStatsUpdateTask) 192 if (m_heapStatsUpdateTask)
187 return; 193 return;
188 ScriptProfiler::startTrackingHeapObjects(trackAllocations); 194 ScriptProfiler::startTrackingHeapObjects(trackAllocations);
189 m_heapStatsUpdateTask = adoptPtr(new HeapStatsUpdateTask(this)); 195 m_heapStatsUpdateTask = adoptPtrWillBeNoop(new HeapStatsUpdateTask(this));
190 m_heapStatsUpdateTask->startTimer(); 196 m_heapStatsUpdateTask->startTimer();
191 } 197 }
192 198
193 void InspectorHeapProfilerAgent::stopTrackingHeapObjectsInternal() 199 void InspectorHeapProfilerAgent::stopTrackingHeapObjectsInternal()
194 { 200 {
195 if (!m_heapStatsUpdateTask) 201 if (!m_heapStatsUpdateTask)
196 return; 202 return;
197 ScriptProfiler::stopTrackingHeapObjects(); 203 ScriptProfiler::stopTrackingHeapObjects();
198 m_heapStatsUpdateTask->resetTimer(); 204 m_heapStatsUpdateTask->resetTimer();
199 m_heapStatsUpdateTask.clear(); 205 m_heapStatsUpdateTask.clear();
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
305 ScriptValue value = injectedScript.findObjectById(objectId); 311 ScriptValue value = injectedScript.findObjectById(objectId);
306 ScriptState::Scope scope(injectedScript.scriptState()); 312 ScriptState::Scope scope(injectedScript.scriptState());
307 if (value.isEmpty() || value.isUndefined()) { 313 if (value.isEmpty() || value.isUndefined()) {
308 *errorString = "Object with given id not found"; 314 *errorString = "Object with given id not found";
309 return; 315 return;
310 } 316 }
311 unsigned id = ScriptProfiler::getHeapObjectId(value); 317 unsigned id = ScriptProfiler::getHeapObjectId(value);
312 *heapSnapshotObjectId = String::number(id); 318 *heapSnapshotObjectId = String::number(id);
313 } 319 }
314 320
321 void InspectorHeapProfilerAgent::trace(Visitor* visitor)
322 {
323 visitor->trace(m_injectedScriptManager);
324 visitor->trace(m_heapStatsUpdateTask);
325 InspectorBaseAgent::trace(visitor);
326 }
327
315 } // namespace blink 328 } // namespace blink
316 329
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorHeapProfilerAgent.h ('k') | Source/core/inspector/InspectorInspectorAgent.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698