Changeset 147109 in webkit


Ignore:
Timestamp:
Mar 28, 2013 6:46:13 AM (11 years ago)
Author:
caseq@chromium.org
Message:

Web Inspector: name timeline overview controls consistently
https://bugs.webkit.org/show_bug.cgi?id=113503

Reviewed by Yury Semikhatsky.

Refactoring, covered by existing tests.

  • rename HeapGraph to TimelineMemoryOverview;
  • rename TimelineCategoryStrips to TimelineEventOvrview.
  • inspector/front-end/TimelineOverviewPane.js:

(WebInspector.TimelineOverviewPane):
(WebInspector.TimelineOverviewPane.prototype.setMode):
(WebInspector.TimelineOverviewPane.prototype._setFrameMode):
(WebInspector.TimelineOverviewPane.prototype._onCategoryVisibilityChanged):
(WebInspector.TimelineOverviewPane.prototype._update):
(WebInspector.TimelineOverviewPane.prototype.setMinimumRecordDuration):
(WebInspector.TimelineMemoryOverview):
(WebInspector.TimelineEventOverview):
(WebInspector.TimelineEventOverview.prototype._renderBar):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r147107 r147109  
     12013-03-28  Andrey Kosyakov  <caseq@chromium.org>
     2
     3        Web Inspector: name timeline overview controls consistently
     4        https://bugs.webkit.org/show_bug.cgi?id=113503
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Refactoring, covered by existing tests.
     9
     10        - rename HeapGraph to TimelineMemoryOverview;
     11        - rename TimelineCategoryStrips to TimelineEventOvrview.
     12
     13        * inspector/front-end/TimelineOverviewPane.js:
     14        (WebInspector.TimelineOverviewPane):
     15        (WebInspector.TimelineOverviewPane.prototype.setMode):
     16        (WebInspector.TimelineOverviewPane.prototype._setFrameMode):
     17        (WebInspector.TimelineOverviewPane.prototype._onCategoryVisibilityChanged):
     18        (WebInspector.TimelineOverviewPane.prototype._update):
     19        (WebInspector.TimelineOverviewPane.prototype.setMinimumRecordDuration):
     20        (WebInspector.TimelineMemoryOverview):
     21        (WebInspector.TimelineEventOverview):
     22        (WebInspector.TimelineEventOverview.prototype._renderBar):
     23
    1242013-03-28  Eli Fidler  <efidler@blackberry.com>
    225
  • trunk/Source/WebCore/inspector/front-end/TimelineOverviewPane.js

    r146970 r147109  
    7878    this.element.appendChild(this._overviewGrid.element);
    7979
    80     this._heapGraph = new WebInspector.HeapGraph(this._model);
    81     this._heapGraph.element.id = "timeline-overview-memory";
    82     this._overviewGrid.insertBeforeItemsGraphsElement(this._heapGraph.element);
     80    this._memoryOverview = new WebInspector.TimelineMemoryOverview(this._model);
     81    this._memoryOverview.element.id = "timeline-overview-memory";
     82    this._overviewGrid.insertBeforeItemsGraphsElement(this._memoryOverview.element);
    8383
    8484    var separatorElement = document.createElement("div");
     
    8686    this.element.appendChild(separatorElement);
    8787
    88     this._categoryStrips = new WebInspector.TimelineCategoryStrips(this._model);
    89     this._overviewGrid.itemsGraphsElement().appendChild(this._categoryStrips.element);
     88    this._eventOverview = new WebInspector.TimelineEventOverview(this._model);
     89    this._overviewGrid.itemsGraphsElement().appendChild(this._eventOverview.element);
    9090 
    9191    var categories = WebInspector.TimelinePresentationModel.categories();
     
    132132            case WebInspector.TimelineOverviewPane.Mode.Events:
    133133            case WebInspector.TimelineOverviewPane.Mode.Frames:
    134                 this._heapGraph.hide();
     134                this._memoryOverview.hide();
    135135                this._overviewGrid.showItemsGraphsElement();
    136136                break;
    137137            case WebInspector.TimelineOverviewPane.Mode.Memory:
    138138                this._overviewGrid.hideItemsGraphsElement();
    139                 this._heapGraph.show();
     139                this._memoryOverview.show();
    140140        }
    141141        this._overviewItems[this._currentMode].revealAndSelect(false);
     
    155155            this._frameOverview = null;
    156156            this._overviewGrid.showItemsGraphsElement();
    157             this._categoryStrips.update();
     157            this._eventOverview.update();
    158158        }
    159159    },
     
    162162    {
    163163        if (this._currentMode === WebInspector.TimelineOverviewPane.Mode.Events)
    164             this._categoryStrips.update();
     164            this._eventOverview.update();
    165165    },
    166166
     
    173173        this._overviewCalculator.setDisplayWindow(0, this._overviewGrid.clientWidth());
    174174
    175         if (this._heapGraph.visible)
    176             this._heapGraph.update();
     175        if (this._memoryOverview.visible)
     176            this._memoryOverview.update();
    177177        else if (this._frameOverview)
    178178            this._frameOverview.update();
    179179        else
    180             this._categoryStrips.update();
     180            this._eventOverview.update();
    181181
    182182        this._overviewGrid.updateDividers(this._overviewCalculator);
     
    323323    setMinimumRecordDuration: function(value)
    324324    {
    325         this._categoryStrips.setMinimumRecordDuration(value);
     325        this._eventOverview.setMinimumRecordDuration(value);
    326326    },
    327327
     
    417417 * @param {WebInspector.TimelineModel} model
    418418 */
    419 WebInspector.HeapGraph = function(model)
     419WebInspector.TimelineMemoryOverview = function(model)
    420420{
    421421    this._canvas = document.createElement("canvas");
     
    436436}
    437437
    438 WebInspector.HeapGraph.prototype = {
     438WebInspector.TimelineMemoryOverview.prototype = {
    439439    /**
    440440     * @return {Node}
     
    546546 * @param {WebInspector.TimelineModel} model
    547547 */
    548 WebInspector.TimelineCategoryStrips = function(model)
     548WebInspector.TimelineEventOverview = function(model)
    549549{
    550550    this._model = model;
     
    556556    var categories = WebInspector.TimelinePresentationModel.categories();
    557557    for (var category in categories)
    558         this._fillStyles[category] = WebInspector.TimelinePresentationModel.createFillStyleForCategory(this._context, 0, WebInspector.TimelineCategoryStrips._innerStripHeight, categories[category]);
    559 
    560     this._disabledCategoryFillStyle = WebInspector.TimelinePresentationModel.createFillStyle(this._context, 0, WebInspector.TimelineCategoryStrips._innerStripHeight,
     558        this._fillStyles[category] = WebInspector.TimelinePresentationModel.createFillStyleForCategory(this._context, 0, WebInspector.TimelineEventOverview._innerStripHeight, categories[category]);
     559
     560    this._disabledCategoryFillStyle = WebInspector.TimelinePresentationModel.createFillStyle(this._context, 0, WebInspector.TimelineEventOverview._innerStripHeight,
    561561        "rgb(218, 218, 218)", "rgb(170, 170, 170)", "rgb(143, 143, 143)");
    562562
     
    565565
    566566/** @const */
    567 WebInspector.TimelineCategoryStrips._canvasHeight = 60;
     567WebInspector.TimelineEventOverview._canvasHeight = 60;
    568568/** @const */
    569 WebInspector.TimelineCategoryStrips._numberOfStrips = 3;
     569WebInspector.TimelineEventOverview._numberOfStrips = 3;
    570570/** @const */
    571 WebInspector.TimelineCategoryStrips._stripHeight = Math.round(WebInspector.TimelineCategoryStrips._canvasHeight  / WebInspector.TimelineCategoryStrips._numberOfStrips);
     571WebInspector.TimelineEventOverview._stripHeight = Math.round(WebInspector.TimelineEventOverview._canvasHeight  / WebInspector.TimelineEventOverview._numberOfStrips);
    572572/** @const */
    573 WebInspector.TimelineCategoryStrips._stripPadding = 4;
     573WebInspector.TimelineEventOverview._stripPadding = 4;
    574574/** @const */
    575 WebInspector.TimelineCategoryStrips._innerStripHeight = WebInspector.TimelineCategoryStrips._stripHeight - 2 * WebInspector.TimelineCategoryStrips._stripPadding;
    576 
    577 WebInspector.TimelineCategoryStrips.prototype = {
     575WebInspector.TimelineEventOverview._innerStripHeight = WebInspector.TimelineEventOverview._stripHeight - 2 * WebInspector.TimelineEventOverview._stripPadding;
     576
     577WebInspector.TimelineEventOverview.prototype = {
    578578    update: function()
    579579    {
    580580        // Use real world, 1:1 coordinates in canvas. This will also take care of clearing it.
    581581        this.element.width = this.element.parentElement.clientWidth;
    582         this.element.height = WebInspector.TimelineCategoryStrips._canvasHeight;
     582        this.element.height = WebInspector.TimelineEventOverview._canvasHeight;
    583583
    584584        var timeOffset = this._model.minimumRecordTime();
     
    589589
    590590        this._context.fillStyle = "rgba(0, 0, 0, 0.05)";
    591         for (var i = 1; i < WebInspector.TimelineCategoryStrips._numberOfStrips; i += 2)
    592             this._context.fillRect(0.5, i * WebInspector.TimelineCategoryStrips._stripHeight + 0.5, this.element.width, WebInspector.TimelineCategoryStrips._stripHeight);
     591        for (var i = 1; i < WebInspector.TimelineEventOverview._numberOfStrips; i += 2)
     592            this._context.fillRect(0.5, i * WebInspector.TimelineEventOverview._stripHeight + 0.5, this.element.width, WebInspector.TimelineEventOverview._stripHeight);
    593593
    594594        function appendRecord(record)
     
    634634    {
    635635        var x = begin + 0.5;
    636         var y = category.overviewStripGroupIndex * WebInspector.TimelineCategoryStrips._stripHeight + WebInspector.TimelineCategoryStrips._stripPadding + 0.5;
     636        var y = category.overviewStripGroupIndex * WebInspector.TimelineEventOverview._stripHeight + WebInspector.TimelineEventOverview._stripPadding + 0.5;
    637637        var width = Math.max(end - begin, 1);
    638638
     
    640640        this._context.translate(x, y);
    641641        this._context.fillStyle = category.hidden ? this._disabledCategoryFillStyle : this._fillStyles[category.name];
    642         this._context.fillRect(0, 0, width, WebInspector.TimelineCategoryStrips._innerStripHeight);
     642        this._context.fillRect(0, 0, width, WebInspector.TimelineEventOverview._innerStripHeight);
    643643        this._context.strokeStyle = category.hidden ? this._disabledCategoryBorderStyle : category.borderColor;
    644         this._context.strokeRect(0, 0, width, WebInspector.TimelineCategoryStrips._innerStripHeight);
     644        this._context.strokeRect(0, 0, width, WebInspector.TimelineEventOverview._innerStripHeight);
    645645        this._context.restore();
    646646    }
Note: See TracChangeset for help on using the changeset viewer.