Index: WebCore/inspector/front-end/ProfilesPanel.js |
=================================================================== |
--- WebCore/inspector/front-end/ProfilesPanel.js (revision 73362) |
+++ WebCore/inspector/front-end/ProfilesPanel.js (working copy) |
@@ -411,6 +411,50 @@ |
} |
}, |
+ loadHeapSnapshot: function(uid, callback) |
+ { |
+ var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; |
+ if (!profile) |
+ return; |
+ |
+ if (profile._loaded) |
+ callback(profile); |
+ else if (profile._is_loading) |
+ profile._callbacks.push(callback); |
+ else { |
+ profile._is_loading = true; |
+ profile._callbacks = [callback]; |
+ profile._json = ""; |
+ InspectorBackend.getProfile(profile.typeId, profile.uid); |
+ } |
+ }, |
+ |
+ addHeapSnapshotChunk: function(uid, chunk) |
+ { |
+ var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; |
+ if (!profile || profile._loaded || !profile._is_loading) |
+ return; |
+ |
+ profile._json += chunk; |
+ }, |
+ |
+ finishHeapSnapshot: function(uid) |
+ { |
+ var profile = this._profilesIdMap[this._makeKey(uid, WebInspector.HeapSnapshotProfileType.TypeId)]; |
+ if (!profile || profile._loaded || !profile._is_loading) |
+ return; |
+ |
+ var callbacks = profile._callbacks; |
+ delete profile._callbacks; |
+ var loadedSnapshot = JSON.parse(profile._json); |
+ delete profile._json; |
+ delete profile._is_loading; |
+ profile._loaded = true; |
+ WebInspector.HeapSnapshotView.prototype.processLoadedSnapshot(profile, loadedSnapshot); |
+ for (var i = 0; i < callbacks.length; ++i) |
+ callbacks[i](profile); |
+ }, |
+ |
showView: function(view) |
{ |
this.showProfile(view.profile); |