diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /WebCore/inspector/InspectorProfilerAgent.cpp | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'WebCore/inspector/InspectorProfilerAgent.cpp')
-rw-r--r-- | WebCore/inspector/InspectorProfilerAgent.cpp | 25 |
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() |