Changeset 145367 in webkit
- Timestamp:
- Mar 11, 2013, 8:47:44 AM (14 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
inspector/front-end/HeapSnapshotProxy.js (modified) (8 diffs)
-
inspector/front-end/HeapSnapshotView.js (modified) (2 diffs)
-
inspector/front-end/NativeHeapSnapshot.js (modified) (1 diff)
-
inspector/front-end/NativeMemorySnapshotView.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r145366 r145367 1 2013-03-11 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: add per image statistics to the native memory snapshot 4 https://bugs.webkit.org/show_bug.cgi?id=112011 5 6 Reviewed by Pavel Feldman. 7 8 Added per-image statistics to the native memory distribution table. 9 10 * inspector/front-end/HeapSnapshotProxy.js: 11 (WebInspector.HeapSnapshotWorker): 12 (WebInspector.HeapSnapshotWorker.prototype.createLoader): 13 (WebInspector.HeapSnapshotWorker.prototype.wrapCallback): 14 (WebInspector.HeapSnapshotWorker.prototype.callFactoryMethod): 15 (WebInspector.HeapSnapshotProxyObject.prototype.callFactoryMethod): the method now accepts 16 proxy constructor function instead of its name. This eliminates unnecessary function lookup. 17 (WebInspector.HeapSnapshotLoaderProxy): 18 (WebInspector.HeapSnapshotLoaderProxy.prototype.close): 19 (WebInspector.HeapSnapshotProxy.prototype.createEdgesProvider): 20 (WebInspector.HeapSnapshotProxy.prototype.createRetainingEdgesProvider): 21 (WebInspector.HeapSnapshotProxy.prototype.createAddedNodesProvider): 22 (WebInspector.HeapSnapshotProxy.prototype.createDeletedNodesProvider): 23 (WebInspector.HeapSnapshotProxy.prototype.createNodesProvider): 24 (WebInspector.HeapSnapshotProxy.prototype.createNodesProviderForClass): 25 (WebInspector.HeapSnapshotProxy.prototype.createNodesProviderForDominator): 26 (WebInspector.NativeHeapSnapshotProxy): 27 (WebInspector.NativeHeapSnapshotProxy.prototype.images): 28 * inspector/front-end/HeapSnapshotView.js: 29 (WebInspector.HeapProfileHeader.prototype.snapshotProxyConstructor): 30 (WebInspector.HeapProfileHeader.prototype._setupWorker): 31 * inspector/front-end/NativeHeapSnapshot.js: 32 (WebInspector.NativeHeapSnapshot.prototype.images): 33 * inspector/front-end/NativeMemorySnapshotView.js: 34 (WebInspector.NativeSnapshotNode): 35 (WebInspector.NativeSnapshotNode.prototype._createSizeCell): 36 (WebInspector.NativeSnapshotNode.prototype._populate): 37 (WebInspector.NativeSnapshotNode.prototype._addChildrenFromGraph): 38 (WebInspector.NativeSnapshotNode.prototype._addImageDetails.didLoad.didReceiveImages): 39 (WebInspector.NativeSnapshotNode.prototype._addImageDetails): 40 (WebInspector.NativeSnapshotProfileHeader.prototype.snapshotProxyConstructor): 41 1 42 2013-03-11 Allan Sandfeld Jensen <allan.jensen@digia.com> 2 43 -
trunk/Source/WebCore/inspector/front-end/HeapSnapshotProxy.js
r140953 r145367 189 189 190 190 WebInspector.HeapSnapshotWorker.prototype = { 191 createLoader: function(snapshotConstructorName )191 createLoader: function(snapshotConstructorName, proxyConstructor) 192 192 { 193 193 var objectId = this._nextObjectId++; 194 var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, snapshotConstructorName );194 var proxy = new WebInspector.HeapSnapshotLoaderProxy(this, objectId, snapshotConstructorName, proxyConstructor); 195 195 this._postMessage({callId: this._nextCallId++, disposition: "create", objectId: objectId, methodName: "WebInspector.HeapSnapshotLoader"}); 196 196 return proxy; … … 216 216 }, 217 217 218 callFactoryMethod: function(callback, objectId, methodName, proxyConstructor Name)218 callFactoryMethod: function(callback, objectId, methodName, proxyConstructor) 219 219 { 220 220 var callId = this._nextCallId++; 221 221 var methodArguments = Array.prototype.slice.call(arguments, 4); 222 222 var newObjectId = this._nextObjectId++; 223 var proxyConstructorFunction = this._findFunction(proxyConstructorName);224 223 if (callback) { 225 224 function wrapCallback(remoteResult) 226 225 { 227 callback(remoteResult ? new proxyConstructor Function(this, newObjectId) : null);226 callback(remoteResult ? new proxyConstructor(this, newObjectId) : null); 228 227 } 229 228 this._callbacks[callId] = wrapCallback.bind(this); … … 232 231 } else { 233 232 this._postMessage({callId: callId, disposition: "factory", objectId: objectId, methodName: methodName, methodArguments: methodArguments, newObjectId: newObjectId}); 234 return new proxyConstructor Function(this, newObjectId);233 return new proxyConstructor(this, newObjectId); 235 234 } 236 235 }, … … 332 331 * @param {...*} var_args 333 332 */ 334 callFactoryMethod: function(callback, methodName, proxyConstructor Name, var_args)333 callFactoryMethod: function(callback, methodName, proxyConstructor, var_args) 335 334 { 336 335 return this._callWorker("callFactoryMethod", Array.prototype.slice.call(arguments, 0)); … … 360 359 * @implements {WebInspector.OutputStream} 361 360 */ 362 WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, snapshotConstructorName )361 WebInspector.HeapSnapshotLoaderProxy = function(worker, objectId, snapshotConstructorName, proxyConstructor) 363 362 { 364 363 WebInspector.HeapSnapshotProxyObject.call(this, worker, objectId); 365 364 this._snapshotConstructorName = snapshotConstructorName; 365 this._proxyConstructor = proxyConstructor; 366 366 this._pendingSnapshotConsumers = []; 367 367 } … … 389 389 function buildSnapshot() 390 390 { 391 this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", "WebInspector.HeapSnapshotProxy", this._snapshotConstructorName);391 this.callFactoryMethod(updateStaticData.bind(this), "buildSnapshot", this._proxyConstructor, this._snapshotConstructorName); 392 392 } 393 393 function updateStaticData(snapshotProxy) … … 446 446 createEdgesProvider: function(nodeIndex, showHiddenData) 447 447 { 448 return this.callFactoryMethod(null, "createEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, showHiddenData);448 return this.callFactoryMethod(null, "createEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex, showHiddenData); 449 449 }, 450 450 451 451 createRetainingEdgesProvider: function(nodeIndex, showHiddenData) 452 452 { 453 return this.callFactoryMethod(null, "createRetainingEdgesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndex, showHiddenData);453 return this.callFactoryMethod(null, "createRetainingEdgesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndex, showHiddenData); 454 454 }, 455 455 456 456 createAddedNodesProvider: function(baseSnapshotId, className) 457 457 { 458 return this.callFactoryMethod(null, "createAddedNodesProvider", "WebInspector.HeapSnapshotProviderProxy", baseSnapshotId, className);458 return this.callFactoryMethod(null, "createAddedNodesProvider", WebInspector.HeapSnapshotProviderProxy, baseSnapshotId, className); 459 459 }, 460 460 461 461 createDeletedNodesProvider: function(nodeIndexes) 462 462 { 463 return this.callFactoryMethod(null, "createDeletedNodesProvider", "WebInspector.HeapSnapshotProviderProxy", nodeIndexes);463 return this.callFactoryMethod(null, "createDeletedNodesProvider", WebInspector.HeapSnapshotProviderProxy, nodeIndexes); 464 464 }, 465 465 466 466 createNodesProvider: function(filter) 467 467 { 468 return this.callFactoryMethod(null, "createNodesProvider", "WebInspector.HeapSnapshotProviderProxy", filter);468 return this.callFactoryMethod(null, "createNodesProvider", WebInspector.HeapSnapshotProviderProxy, filter); 469 469 }, 470 470 471 471 createNodesProviderForClass: function(className, aggregatesKey) 472 472 { 473 return this.callFactoryMethod(null, "createNodesProviderForClass", "WebInspector.HeapSnapshotProviderProxy", className, aggregatesKey);473 return this.callFactoryMethod(null, "createNodesProviderForClass", WebInspector.HeapSnapshotProviderProxy, className, aggregatesKey); 474 474 }, 475 475 476 476 createNodesProviderForDominator: function(nodeIndex) 477 477 { 478 return this.callFactoryMethod(null, "createNodesProviderForDominator", "WebInspector.HeapSnapshotProviderProxy", nodeIndex);478 return this.callFactoryMethod(null, "createNodesProviderForDominator", WebInspector.HeapSnapshotProviderProxy, nodeIndex); 479 479 }, 480 480 … … 520 520 /** 521 521 * @constructor 522 * @extends {WebInspector.HeapSnapshotProxy} 523 */ 524 WebInspector.NativeHeapSnapshotProxy = function(worker, objectId) 525 { 526 WebInspector.HeapSnapshotProxy.call(this, worker, objectId); 527 } 528 529 WebInspector.NativeHeapSnapshotProxy.prototype = { 530 images: function(callback) 531 { 532 this.callMethod(callback, "images"); 533 }, 534 535 __proto__: WebInspector.HeapSnapshotProxy.prototype 536 } 537 538 /** 539 * @constructor 522 540 * @extends {WebInspector.HeapSnapshotProxyObject} 523 541 */ -
trunk/Source/WebCore/inspector/front-end/HeapSnapshotView.js
r145074 r145367 979 979 }, 980 980 981 snapshotProxyConstructor: function() 982 { 983 return WebInspector.HeapSnapshotProxy; 984 }, 985 981 986 _setupWorker: function() 982 987 { … … 987 992 var worker = new WebInspector.HeapSnapshotWorker(); 988 993 worker.addEventListener("wait", setProfileWait, this); 989 var loaderProxy = worker.createLoader(this.snapshotConstructorName() );994 var loaderProxy = worker.createLoader(this.snapshotConstructorName(), this.snapshotProxyConstructor()); 990 995 loaderProxy.addConsumer(this._snapshotReceived.bind(this)); 991 996 this._receiver = loaderProxy; -
trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js
r143317 r145367 70 70 }, 71 71 72 images: function() 73 { 74 var aggregatesByClassName = this.aggregates(false, "allObjects"); 75 var images = aggregatesByClassName["WebCore::CachedImage"]; 76 var result = []; 77 if (!images) 78 return result; 79 var node = this.rootNode(); 80 for (var i = 0; i < images.idxs.length; i++) { 81 node.nodeIndex = images.idxs[i]; 82 result.push({ 83 name: node.name(), 84 size: node.retainedSize(), 85 }); 86 } 87 return result; 88 }, 89 72 90 __proto__: WebInspector.HeapSnapshot.prototype 73 91 }; -
trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js
r145357 r145367 62 62 WebInspector.DataGrid.call(this, columns); 63 63 this._profile = profile; 64 this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile ._memoryBlock);64 this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile); 65 65 if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get()) { 66 66 this.setRootNode(new WebInspector.DataGridNode(null, true)); … … 108 108 * @extends {WebInspector.DataGridNode} 109 109 * @param {MemoryAgent.MemoryBlock} nodeData 110 * @param {MemoryAgent.MemoryBlock} rootMemoryBlock 111 */ 112 WebInspector.NativeSnapshotNode = function(nodeData, rootMemoryBlock) 110 */ 111 WebInspector.NativeSnapshotNode = function(nodeData, profile) 113 112 { 114 113 this._nodeData = nodeData; 115 this._ rootMemoryBlock = rootMemoryBlock;114 this._profile = profile; 116 115 var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(nodeData); 117 116 var data = { name: viewProperties._description, size: this._nodeData.size }; 118 var hasChildren = !!nodeData.children && nodeData.children.length !== 0;117 var hasChildren = this._addChildrenFromGraph(); 119 118 WebInspector.DataGridNode.call(this, data, hasChildren); 120 119 this.addEventListener("populate", this._populate, this); … … 186 185 187 186 var sizeKB = this._nodeData.size / 1024; 188 var totalSize = this._ rootMemoryBlock.size;187 var totalSize = this._profile._memoryBlock.size; 189 188 var percentage = this._nodeData.size / totalSize * 100; 190 189 … … 221 220 _populate: function() { 222 221 this.removeEventListener("populate", this._populate, this); 222 if (this._nodeData.children) 223 this._addChildren(); 224 }, 225 226 _addChildren: function() 227 { 223 228 this._nodeData.children.sort(this.dataGrid._sortingFunction.bind(this.dataGrid)); 224 229 … … 226 231 var nodeData = this._nodeData.children[node]; 227 232 if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get() || nodeData.name !== "Other") 228 this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._ rootMemoryBlock));233 this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._profile)); 229 234 } 235 }, 236 237 _addChildrenFromGraph: function() 238 { 239 var memoryBlock = this._nodeData; 240 if (memoryBlock.children) 241 return memoryBlock.children.length > 0; 242 if (memoryBlock.name === "Image") { 243 this._addImageDetails(); 244 return true; 245 } 246 return false; 247 }, 248 249 _addImageDetails: function() 250 { 251 /** 252 * @param {WebInspector.NativeHeapSnapshotProxy} proxy 253 */ 254 function didLoad(proxy) 255 { 256 function didReceiveImages(result) 257 { 258 this._nodeData.children = result; 259 if (this.expanded) 260 this._addChildren(); 261 } 262 proxy.images(didReceiveImages.bind(this)); 263 264 } 265 this._profile.load(didLoad.bind(this)); 230 266 }, 231 267 … … 427 463 { 428 464 return "NativeHeapSnapshot"; 465 }, 466 467 snapshotProxyConstructor: function() 468 { 469 return WebInspector.NativeHeapSnapshotProxy; 429 470 }, 430 471
Note:
See TracChangeset
for help on using the changeset viewer.