Changeset 146448 in webkit
- Timestamp:
- Mar 21, 2013, 1:02:10 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r146442 r146448 1 2013-03-20 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: Flame Chart. draw background for the FlameChart overview pane with the CPU aggregated data. 4 https://bugs.webkit.org/show_bug.cgi?id=112823 5 6 Reviewed by Yury Semikhatsky. 7 8 The idea of the patch is to collect the data about stack depth for the each X 9 and draw a line with help of this data. 10 11 * inspector/front-end/FlameChart.js: 12 (WebInspector.FlameChart): 13 (WebInspector.FlameChart.prototype.onResize): 14 (WebInspector.FlameChart.prototype._drawOverviewCanvas): 15 (WebInspector.FlameChart.prototype.update): 16 1 17 2013-03-21 Eugene Klyuchnikov <eustas@chromium.org> 2 18 -
trunk/Source/WebCore/inspector/front-end/FlameChart.js
r146354 r146448 46 46 this._overviewCalculator = new WebInspector.FlameChart.OverviewCalculator(); 47 47 this._overviewGrid.addEventListener(WebInspector.OverviewGrid.Events.WindowChanged, this._onWindowChanged, this); 48 this._overviewCanvas = this._overviewContainer.createChild("canvas"); 48 49 49 50 this._chartContainer = this.element.createChild("div", "chart-container"); … … 433 434 onResize: function() 434 435 { 436 this._updateOverviewCanvas = true; 435 437 this._hidePopover(); 436 438 this._scheduleUpdate(); 439 }, 440 441 _drawOverviewCanvas: function(width, height) 442 { 443 this._overviewCanvas.width = width; 444 this._overviewCanvas.height = height; 445 446 if (!this._timelineData) 447 return; 448 449 var nodeCount = this._timelineData.nodeCount; 450 var depths = this._timelineData.depths; 451 var startTimes = this._timelineData.startTimes; 452 var durations = this._timelineData.durations; 453 var drawData = new Uint8Array(width); 454 var scaleFactor = width / this._timelineData.totalTime; 455 456 for (var nodeIndex = 0; nodeIndex < nodeCount; ++nodeIndex) { 457 var start = Math.floor(startTimes[nodeIndex] * scaleFactor); 458 var finish = Math.floor((startTimes[nodeIndex] + durations[nodeIndex]) * scaleFactor); 459 for (var x = start; x < finish; ++x) 460 drawData[x] = Math.max(drawData[x], depths[nodeIndex] + 1); 461 } 462 463 var context = this._overviewCanvas.getContext("2d"); 464 var yScaleFactor = 2; 465 context.lineWidth = 0.5; 466 context.strokeStyle = "rgba(20,0,0,0.8)"; 467 context.fillStyle="rgba(214,225,254, 0.8)"; 468 context.moveTo(0, height - 1); 469 for (var x = 0; x < width; ++x) 470 context.lineTo(x, height - drawData[x] * yScaleFactor - 1); 471 context.moveTo(width - 1, height - 1); 472 context.moveTo(0, height - 1); 473 context.fill(); 474 context.stroke(); 475 context.closePath(); 437 476 }, 438 477 … … 497 536 this._overviewGrid.updateDividers(this._overviewCalculator); 498 537 } 538 if (this._updateOverviewCanvas) { 539 this._drawOverviewCanvas(this._overviewContainer.clientWidth, this._overviewContainer.clientHeight); 540 this._updateOverviewCanvas = false; 541 } 499 542 }, 500 543
Note:
See TracChangeset
for help on using the changeset viewer.