summaryrefslogtreecommitdiffstats
path: root/WebCore/inspector/InspectorProfilerAgent.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/inspector/InspectorProfilerAgent.cpp')
-rw-r--r--WebCore/inspector/InspectorProfilerAgent.cpp25
1 files changed, 22 insertions, 3 deletions
diff --git a/WebCore/inspector/InspectorProfilerAgent.cpp b/WebCore/inspector/InspectorProfilerAgent.cpp
index 1248677..ac67a1a 100644
--- a/WebCore/inspector/InspectorProfilerAgent.cpp
+++ b/WebCore/inspector/InspectorProfilerAgent.cpp
@@ -156,6 +156,21 @@ void InspectorProfilerAgent::getProfileHeaders(RefPtr<InspectorArray>* headers)
(*headers)->pushObject(createSnapshotHeader(*it->second));
}
+namespace {
+
+class OutputStream : public ScriptHeapSnapshot::OutputStream {
+public:
+ OutputStream(InspectorFrontend* frontend, unsigned long uid)
+ : m_frontend(frontend), m_uid(uid) { }
+ void Write(const String& chunk) { m_frontend->addHeapSnapshotChunk(m_uid, chunk); }
+ void Close() { m_frontend->finishHeapSnapshot(m_uid); }
+private:
+ InspectorFrontend* m_frontend;
+ unsigned long m_uid;
+};
+
+} // namespace
+
void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr<InspectorObject>* profileObject)
{
if (type == CPUProfileType) {
@@ -167,8 +182,12 @@ void InspectorProfilerAgent::getProfile(const String& type, unsigned uid, RefPtr
} else if (type == HeapProfileType) {
HeapSnapshotsMap::iterator it = m_snapshots.find(uid);
if (it != m_snapshots.end()) {
- *profileObject = createSnapshotHeader(*it->second);
- (*profileObject)->setObject("head", it->second->buildInspectorObjectForHead());
+ RefPtr<ScriptHeapSnapshot> snapshot = it->second;
+ *profileObject = createSnapshotHeader(*snapshot);
+ if (m_frontend) {
+ OutputStream stream(m_frontend, uid);
+ snapshot->writeJSON(&stream);
+ }
}
}
}
@@ -192,7 +211,7 @@ void InspectorProfilerAgent::resetState()
m_nextUserInitiatedProfileNumber = 1;
m_nextUserInitiatedHeapSnapshotNumber = 1;
if (m_frontend)
- m_frontend->resetProfilesPanel();
+ m_frontend->resetProfiles();
}
void InspectorProfilerAgent::startUserInitiatedProfiling()