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

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

Issue 17030009: Inspector: wrapped inspector agent instances into factory-like wrappers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Made InspectorBaseAgent RefCounted Created 7 years, 6 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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 HeapStatsUpdateTask(InspectorHeapProfilerAgent*); 53 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 57
58 private: 58 private:
59 InspectorHeapProfilerAgent* m_heapProfilerAgent; 59 InspectorHeapProfilerAgent* m_heapProfilerAgent;
60 Timer<HeapStatsUpdateTask> m_timer; 60 Timer<HeapStatsUpdateTask> m_timer;
61 }; 61 };
62 62
63 PassOwnPtr<InspectorHeapProfilerAgent> InspectorHeapProfilerAgent::create(Instru mentingAgents* instrumentingAgents, InspectorCompositeState* inspectorState, Inj ectedScriptManager* injectedScriptManager) 63 PassRefPtr<InspectorHeapProfilerAgent> InspectorHeapProfilerAgent::create(Instru mentingAgents* instrumentingAgents, InspectorState* inspectorState, InjectedScri ptManager* injectedScriptManager)
64 { 64 {
65 return adoptPtr(new InspectorHeapProfilerAgent(instrumentingAgents, inspecto rState, injectedScriptManager)); 65 return adoptRef(new InspectorHeapProfilerAgent(instrumentingAgents, inspecto rState, injectedScriptManager));
66 } 66 }
67 67
68 InspectorHeapProfilerAgent::InspectorHeapProfilerAgent(InstrumentingAgents* inst rumentingAgents, InspectorCompositeState* inspectorState, InjectedScriptManager* injectedScriptManager) 68 InspectorHeapProfilerAgent::InspectorHeapProfilerAgent(InstrumentingAgents* inst rumentingAgents, InspectorState* inspectorState, InjectedScriptManager* injected ScriptManager)
69 : InspectorBaseAgent<InspectorHeapProfilerAgent>("HeapProfiler", instrumenti ngAgents, inspectorState) 69 : InspectorBaseAgent(instrumentingAgents, inspectorState)
70 , m_injectedScriptManager(injectedScriptManager) 70 , m_injectedScriptManager(injectedScriptManager)
71 , m_frontend(0) 71 , m_frontend(0)
72 , m_nextUserInitiatedHeapSnapshotNumber(1) 72 , m_nextUserInitiatedHeapSnapshotNumber(1)
73 { 73 {
74 } 74 }
75 75
76 InspectorHeapProfilerAgent::~InspectorHeapProfilerAgent() 76 InspectorHeapProfilerAgent::~InspectorHeapProfilerAgent()
77 { 77 {
78 } 78 }
79 79
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
311 *errorString = "Object with given id not found"; 311 *errorString = "Object with given id not found";
312 return; 312 return;
313 } 313 }
314 unsigned id = ScriptProfiler::getHeapObjectId(value); 314 unsigned id = ScriptProfiler::getHeapObjectId(value);
315 *heapSnapshotObjectId = String::number(id); 315 *heapSnapshotObjectId = String::number(id);
316 } 316 }
317 317
318 void InspectorHeapProfilerAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjec tInfo) const 318 void InspectorHeapProfilerAgent::reportMemoryUsage(MemoryObjectInfo* memoryObjec tInfo) const
319 { 319 {
320 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorPr ofilerAgent); 320 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::InspectorPr ofilerAgent);
321 InspectorBaseAgent<InspectorHeapProfilerAgent>::reportMemoryUsage(memoryObje ctInfo); 321 InspectorBaseAgent::reportMemoryUsage(memoryObjectInfo);
322 info.addMember(m_injectedScriptManager, "injectedScriptManager"); 322 info.addMember(m_injectedScriptManager, "injectedScriptManager");
323 info.addWeakPointer(m_frontend); 323 info.addWeakPointer(m_frontend);
324 info.addMember(m_snapshots, "snapshots"); 324 info.addMember(m_snapshots, "snapshots");
325 } 325 }
326 326
327 } // namespace WebCore 327 } // namespace WebCore
328 328
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698