Modified: trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js (145366 => 145367)
--- trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js 2013-03-11 15:43:06 UTC (rev 145366)
+++ trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js 2013-03-11 15:47:44 UTC (rev 145367)
@@ -188,10 +188,10 @@
}
WebInspector.HeapSnapshotWorker.prototype = {
- createLoader: function(snapshotConstructorName)
+ createLoader: function(snapshotConstructorName, proxyConstructor)
{
var objectId = this._nextObjectId++;
- var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, snapshotConstructorName);
+ var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, snapshotConstructorName, proxyConstructor);
this._postMessage({callId: this._nextCallId++, disposition: "create", objectId: objectId, methodName: "WebInspector.HeapSnapshotLoader"});
return proxy;
},
@@ -215,23 +215,22 @@
this._postMessage({callId: callId, disposition: "getter", objectId: objectId, methodName: getterName});
},
- callFactoryMethod: function(callback, objectId, methodName, proxyConstructorName)
+ callFactoryMethod: function(callback, objectId, methodName, proxyConstructor)
{
var callId = this._nextCallId++;
var methodArguments = Array.prototype.slice.call(arguments, 4);
var newObjectId = this._nextObjectId++;
- var proxyConstructorFunction = this._findFunction(proxyConstructorName);
if (callback) {
function wrapCallback(remoteResult)
{
- callback(remoteResult ? new proxyConstructorFunction(this, newObjectId) : null);
+ callback(remoteResult ? new proxyConstructor(this, newObjectId) : null);
}
this._callbacks[callId] = wrapCallback.bind(this);
this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId});
return null;
} else {
this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId});
- return new proxyConstructorFunction(this, newObjectId);
+ return new proxyConstructor(this, newObjectId);
}
},
@@ -331,7 +330,7 @@
/**
* @param {...*} var_args
*/
- callFactoryMethod: function(callback, methodName, proxyConstructorName, var_args)
+ callFactoryMethod: function(callback, methodName, proxyConstructor, var_args)
{
return this._callWorker("callFactoryMethod", Array.prototype.slice.call(arguments, 0));
},
@@ -359,10 +358,11 @@
* @extends {WebInspector.HeapSnapshotProxyObject}
* @implements {WebInspector.OutputStream}
*/
-WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, snapshotConstructorName)
+WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, snapshotConstructorName, proxyConstructor)
{
WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId);
this._snapshotConstructorName = snapshotConstructorName;
+ this._proxyConstructor = proxyConstructor;
this._pendingSnapshotConsumers = [];
}
@@ -388,7 +388,7 @@
{
function buildSnapshot()
{
- this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", "WebInspector.HeapSnapshotProxy", this._snapshotConstructorName);
+ this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", this._proxyConstructor, this._snapshotConstructorName);
}
function updateStaticData(snapshotProxy)
{
@@ -445,37 +445,37 @@
createEdgesProvider: function(nodeIndex, showHiddenData)
{
- return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, showHiddenData);
+ return this.callFactoryMethod(null, "createEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex, showHiddenData);
},
createRetainingEdgesProvider: function(nodeIndex, showHiddenData)
{
- return this.callFactoryMethod(null, "createRetainingEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, showHiddenData);
+ return this.callFactoryMethod(null, "createRetainingEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex, showHiddenData);
},
createAddedNodesProvider: function(baseSnapshotId, className)
{
- return this.callFactoryMethod(null, "createAddedNodesProvider", "WebInspector.HeapSnapshotProviderProxy", baseSnapshotId, className);
+ return this.callFactoryMethod(null, "createAddedNodesProvider", WebInspector.HeapSnapshotProviderProxy, baseSnapshotId, className);
},
createDeletedNodesProvider: function(nodeIndexes)
{
- return this.callFactoryMethod(null, "createDeletedNodesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndexes);
+ return this.callFactoryMethod(null, "createDeletedNodesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndexes);
},
createNodesProvider: function(filter)
{
- return this.callFactoryMethod(null, "createNodesProvider", "WebInspector.HeapSnapshotProviderProxy", filter);
+ return this.callFactoryMethod(null, "createNodesProvider", WebInspector.HeapSnapshotProviderProxy, filter);
},
createNodesProviderForClass: function(className, aggregatesKey)
{
- return this.callFactoryMethod(null, "createNodesProviderForClass", "WebInspector.HeapSnapshotProviderProxy", className, aggregatesKey);
+ return this.callFactoryMethod(null, "createNodesProviderForClass", WebInspector.HeapSnapshotProviderProxy, className, aggregatesKey);
},
createNodesProviderForDominator: function(nodeIndex)
{
- return this.callFactoryMethod(null, "createNodesProviderForDominator", "WebInspector.HeapSnapshotProviderProxy", nodeIndex);
+ return this.callFactoryMethod(null, "createNodesProviderForDominator", WebInspector.HeapSnapshotProviderProxy, nodeIndex);
},
dispose: function()
@@ -519,6 +519,24 @@
/**
* @constructor
+ * @extends {WebInspector.HeapSnapshotProxy}
+ */
+WebInspector.NativeHeapSnapshotProxy = function(worker, objectId)
+{
+ WebInspector.HeapSnapshotProxy.call(this, worker, objectId);
+}
+
+WebInspector.NativeHeapSnapshotProxy.prototype = {
+ images: function(callback)
+ {
+ this.callMethod(callback, "images");
+ },
+
+ __proto__: WebInspector.HeapSnapshotProxy.prototype
+}
+
+/**
+ * @constructor
* @extends {WebInspector.HeapSnapshotProxyObject}
*/
WebInspector.HeapSnapshotProviderProxy = function(worker, objectId)
Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (145366 => 145367)
--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2013-03-11 15:43:06 UTC (rev 145366)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js 2013-03-11 15:47:44 UTC (rev 145367)
@@ -61,7 +61,7 @@
};
WebInspector.DataGrid.call(this, columns);
this._profile = profile;
- this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile._memoryBlock);
+ this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile);
if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get()) {
this.setRootNode(new WebInspector.DataGridNode(null, true));
this.rootNode().appendChild(this._totalNode)
@@ -107,15 +107,14 @@
* @constructor
* @extends {WebInspector.DataGridNode}
* @param {MemoryAgent.MemoryBlock} nodeData
- * @param {MemoryAgent.MemoryBlock} rootMemoryBlock
*/
-WebInspector.NativeSnapshotNode = function(nodeData, rootMemoryBlock)
+WebInspector.NativeSnapshotNode = function(nodeData, profile)
{
this._nodeData = nodeData;
- this._rootMemoryBlock = rootMemoryBlock;
+ this._profile = profile;
var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(nodeData);
var data = { name: viewProperties._description, size: this._nodeData.size };
- var hasChildren = !!nodeData.children && nodeData.children.length !== 0;
+ var hasChildren = this._addChildrenFromGraph();
WebInspector.DataGridNode.call(this, data, hasChildren);
this.addEventListener("populate", this._populate, this);
}
@@ -185,7 +184,7 @@
}
var sizeKB = this._nodeData.size / 1024;
- var totalSize = this._rootMemoryBlock.size;
+ var totalSize = this._profile._memoryBlock.size;
var percentage = this._nodeData.size / totalSize * 100;
var cell = document.createElement("td");
@@ -220,15 +219,52 @@
_populate: function() {
this.removeEventListener("populate", this._populate, this);
+ if (this._nodeData.children)
+ this._addChildren();
+ },
+
+ _addChildren: function()
+ {
this._nodeData.children.sort(this.dataGrid._sortingFunction.bind(this.dataGrid));
for (var node in this._nodeData.children) {
var nodeData = this._nodeData.children[node];
if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get() || nodeData.name !== "Other")
- this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._rootMemoryBlock));
+ this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._profile));
}
},
+ _addChildrenFromGraph: function()
+ {
+ var memoryBlock = this._nodeData;
+ if (memoryBlock.children)
+ return memoryBlock.children.length > 0;
+ if (memoryBlock.name === "Image") {
+ this._addImageDetails();
+ return true;
+ }
+ return false;
+ },
+
+ _addImageDetails: function()
+ {
+ /**
+ * @param {WebInspector.NativeHeapSnapshotProxy} proxy
+ */
+ function didLoad(proxy)
+ {
+ function didReceiveImages(result)
+ {
+ this._nodeData.children = result;
+ if (this.expanded)
+ this._addChildren();
+ }
+ proxy.images(didReceiveImages.bind(this));
+
+ }
+ this._profile.load(didLoad.bind(this));
+ },
+
__proto__: WebInspector.DataGridNode.prototype
}
@@ -428,6 +464,11 @@
return "NativeHeapSnapshot";
},
+ snapshotProxyConstructor: function()
+ {
+ return WebInspector.NativeHeapSnapshotProxy;
+ },
+
addNativeSnapshotChunk: function(chunk)
{
this._strings = this._strings.concat(chunk.strings);