Changeset 140332 in webkit
- Timestamp:
- Jan 21, 2013 7:30:26 AM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r140331 r140332 1 2013-01-21 Yury Semikhatsky <yurys@chromium.org> 2 3 Web Inspector: do not serialize native heap graph when collecting information about memory distribution 4 https://bugs.webkit.org/show_bug.cgi?id=107450 5 6 Reviewed by Pavel Feldman. 7 8 Native heap graph is not reported when we need to show only high-level memory distribution. 9 10 * inspector/front-end/NativeMemorySnapshotView.js: 11 (WebInspector.NativeMemorySnapshotView): 12 (WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot): 13 (WebInspector.NativeMemoryProfileType.prototype.buttonClicked): 14 1 15 2013-01-21 Alexander Pavlov <apavlov@chromium.org> 2 16 -
trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js
r138475 r140332 42 42 this._containmentDataGrid = new WebInspector.NativeSnapshotDataGrid(profile); 43 43 this._containmentDataGrid.show(this.element); 44 45 this._heapGraphDataGrid = new WebInspector.NativeHeapGraphDataGrid(profile._graph);46 47 this._viewSelectElement = document.createElement("select");48 this._viewSelectElement.className = "status-bar-item";49 this._viewSelectElement.addEventListener("change", this._onSelectedViewChanged.bind(this), false);50 51 this._views = [{title: "Aggregated", view: this._containmentDataGrid},52 {title: "Graph", view: this._heapGraphDataGrid}];53 this._currentViewIndex = 0;54 for (var i = 0; i < this._views.length; ++i) {55 var view = this._views[i];56 var option = document.createElement("option");57 option.label = WebInspector.UIString(view.title);58 this._viewSelectElement.appendChild(option);59 }60 44 } 61 45 62 46 WebInspector.NativeMemorySnapshotView.prototype = { 63 _onSelectedViewChanged: function(event)64 {65 var index = event.target.selectedIndex;66 if (index === this._currentViewIndex)67 return;68 69 var currentView = this._views[this._currentViewIndex].view;70 currentView.detach();71 72 this._currentViewIndex = index;73 var selectedView = this._views[index].view;74 selectedView.show(this.element);75 },76 77 get statusBarItems()78 {79 var span = document.createElement("span");80 span.className = "status-bar-select-container";81 span.appendChild(this._viewSelectElement);82 return [span];83 },84 85 47 __proto__: WebInspector.View.prototype 86 48 } 87 88 49 89 50 … … 264 225 for (var node in this._nodeData.children) { 265 226 var nodeData = this._nodeData.children[node]; 266 this._addChildrenFromGraph(nodeData);267 227 if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get() || nodeData.name !== "Other") 268 228 this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._rootMemoryBlock)); 269 229 } 270 },271 272 /**273 * @param {MemoryAgent.MemoryBlock} memoryBlock274 */275 _addChildrenFromGraph: function(memoryBlock)276 {277 if (memoryBlock.children)278 return;279 if (memoryBlock.name !== "Image" || this._nodeData.name !== "MemoryCache")280 return;281 282 // Collect objects on the path MemoryCache -> CachedImage -m_image-> BitmapImage -m_frames-> FrameData -m_frame-> SkBitmap -> SkPixelRef283 var graph = this.dataGrid._profile._graph;284 var roots = graph.root().referencedNodes();285 var memoryCache;286 for (var i = 0; i < roots.length; i++) {287 var root = roots[i];288 if (root.className() === "MemoryCache") {289 memoryCache = root;290 break;291 }292 }293 var edges = memoryCache.outgoingEdges();294 var cachedImages = [];295 for (var i = 0; i < edges.length; i++) {296 var target = edges[i].target();297 if (target.className() === "CachedImage") {298 var cachedImage = {299 name: target.name(),300 size: target.size(),301 children: []302 };303 cachedImages.push(cachedImage);304 var image = target.targetOfEdge("m_image");305 if (image.className() === "BitmapImage") {306 var frames = image.targetsOfAllEdges("m_frame");307 for (var j = 0; j < frames.length; j++) {308 var pixels = frames[j].targetOfEdge("pixels");309 if (pixels) {310 cachedImage.size += pixels.size();311 cachedImage.children.push({312 name: "Bitmap pixels",313 size: pixels.size()314 });315 }316 }317 }318 }319 }320 memoryBlock.children = cachedImages;321 },322 323 __proto__: WebInspector.DataGridNode.prototype324 }325 326 327 /**328 * @constructor329 * @extends {WebInspector.DataGrid}330 * @param {WebInspector.NativeHeapGraph} nativeHeapGraph331 */332 WebInspector.NativeHeapGraphDataGrid = function(nativeHeapGraph)333 {334 var columns = {335 id: { title: WebInspector.UIString("id"), width: "80px", disclosure: true, sortable: true },336 type: { title: WebInspector.UIString("Type"), width: "200px", sortable: true },337 className: { title: WebInspector.UIString("Class name"), width: "200px", sortable: true },338 name: { title: WebInspector.UIString("Name"), width: "200px", sortable: true },339 size: { title: WebInspector.UIString("Size"), sortable: true, sort: "descending" },340 };341 WebInspector.DataGrid.call(this, columns);342 this._nativeHeapGraph = nativeHeapGraph;343 this._root = new WebInspector.NativeHeapGraphDataGridRoot(this._nativeHeapGraph);344 this.setRootNode(this._root);345 this._root._populate();346 }347 348 WebInspector.NativeHeapGraphDataGrid.prototype = {349 __proto__: WebInspector.DataGrid.prototype350 }351 352 353 /**354 * @constructor355 * @extends {WebInspector.DataGridNode}356 * @param {WebInspector.NativeHeapGraph} graph357 */358 WebInspector.NativeHeapGraphDataGridRoot = function(graph)359 {360 WebInspector.DataGridNode.call(this, { id: "root" }, true);361 this._graph = graph;362 this.addEventListener("populate", this._populate, this);363 }364 365 WebInspector.NativeHeapGraphDataGridRoot.prototype = {366 _populate: function() {367 this.removeEventListener("populate", this._populate, this);368 var roots = this._graph.root().referencedNodes();369 for (var i = 0; i < roots.length; i++)370 this.appendChild(new WebInspector.NativeHeapGraphDataGridNode(roots[i]));371 },372 373 __proto__: WebInspector.DataGridNode.prototype374 }375 376 377 /**378 * @constructor379 * @extends {WebInspector.DataGridNode}380 * @param {WebInspector.NativeHeapGraph.Node} node381 */382 WebInspector.NativeHeapGraphDataGridNode = function(node)383 {384 var data = {385 id: node.id(),386 size: node.size(),387 type: node.type(),388 className: node.className(),389 name: node.name(),390 };391 WebInspector.DataGridNode.call(this, data, node.hasReferencedNodes());392 this._node = node;393 this.addEventListener("populate", this._populate, this);394 }395 396 WebInspector.NativeHeapGraphDataGridNode.prototype = {397 _populate: function() {398 this.removeEventListener("populate", this._populate, this);399 var children = this._node.referencedNodes();400 for (var i = 0; i < children.length; i++)401 this.appendChild(new WebInspector.NativeHeapGraphDataGridNode(children[i]));402 230 }, 403 231 … … 459 287 } 460 288 profileHeader._memoryBlock = memoryBlock; 461 profileHeader._graph = new WebInspector.NativeHeapGraph(graph);462 289 profileHeader.isTemporary = false; 463 290 profileHeader.sidebarElement.subtitle = Number.bytesToString(/** @type{number} */(memoryBlock.size)); 464 291 } 465 MemoryAgent.getProcessMemoryDistribution( true, didReceiveMemorySnapshot.bind(this));292 MemoryAgent.getProcessMemoryDistribution(false, didReceiveMemorySnapshot.bind(this)); 466 293 return false; 467 294 },
Note: See TracChangeset
for help on using the changeset viewer.