Changeset 107225 in webkit


Ignore:
Timestamp:
Feb 9, 2012 5:23:58 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Source/WebCore: Web Inspector: Show percentage by default in heap profiler.
https://bugs.webkit.org/show_bug.cgi?id=78103

Patch by Alexei Filippov <alexeif@chromium.org> on 2012-02-09
Reviewed by Pavel Feldman.

  • inspector/front-end/DetailedHeapshotGridNodes.js:

(WebInspector.HeapSnapshotGridNode.prototype._toPercentString):
(WebInspector.HeapSnapshotGridNode.prototype._createValueCell):
(WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
(WebInspector.HeapSnapshotConstructorNode.prototype.get data):

  • inspector/front-end/DetailedHeapshotView.js:

(WebInspector.DetailedHeapshotView.profileCallback):
(WebInspector.DetailedHeapshotView):
(WebInspector.DetailedHeapshotView.prototype.get statusBarItems):
(WebInspector.DetailedHeapshotView.prototype._mouseDownInContentsGrid):
(WebInspector.DetailedHeapshotView.prototype._updateFilterOptions):

  • inspector/front-end/UIUtils.js:

(Number.withThousandsSeparator):

  • inspector/front-end/heapProfiler.css:

(.detailed-heapshot-view .data-grid span.percent-column):

LayoutTests: WebInspector: Show percentage by default in heap profiler.
https://bugs.webkit.org/show_bug.cgi?id=78103

Patch by Alexei Filippov <alexeif@chromium.org> on 2012-02-09
Reviewed by Pavel Feldman.

  • inspector/profiler/detailed-heapshots-test.js:
Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r107224 r107225  
     12012-02-09  Alexei Filippov  <alexeif@chromium.org>
     2
     3        WebInspector: Show percentage by default in heap profiler.
     4        https://bugs.webkit.org/show_bug.cgi?id=78103
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/profiler/detailed-heapshots-test.js:
     9
    1102012-02-09  Csaba Osztrogonác  <ossy@webkit.org>
    211
  • trunk/LayoutTests/inspector/profiler/detailed-heapshots-test.js

    r106808 r107225  
    1313        // so we provide synthetic snapshots.
    1414        InspectorTest._panelReset = InspectorTest.override(WebInspector.panels.profiles, "_reset", function(){}, true);
    15         InspectorTest.addSniffer(WebInspector.DetailedHeapshotView.prototype, "_updatePercentButton", InspectorTest._snapshotViewShown, true);
     15        InspectorTest.addSniffer(WebInspector.DetailedHeapshotView.prototype, "_loadProfile", InspectorTest._snapshotViewShown, true);
    1616
    1717        detailedHeapProfilesEnabled();
  • trunk/Source/WebCore/ChangeLog

    r107223 r107225  
     12012-02-09  Alexei Filippov  <alexeif@chromium.org>
     2
     3        Web Inspector: Show percentage by default in heap profiler.
     4        https://bugs.webkit.org/show_bug.cgi?id=78103
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/DetailedHeapshotGridNodes.js:
     9        (WebInspector.HeapSnapshotGridNode.prototype._toPercentString):
     10        (WebInspector.HeapSnapshotGridNode.prototype._createValueCell):
     11        (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
     12        (WebInspector.HeapSnapshotConstructorNode.prototype.get data):
     13        * inspector/front-end/DetailedHeapshotView.js:
     14        (WebInspector.DetailedHeapshotView.profileCallback):
     15        (WebInspector.DetailedHeapshotView):
     16        (WebInspector.DetailedHeapshotView.prototype.get statusBarItems):
     17        (WebInspector.DetailedHeapshotView.prototype._mouseDownInContentsGrid):
     18        (WebInspector.DetailedHeapshotView.prototype._updateFilterOptions):
     19        * inspector/front-end/UIUtils.js:
     20        (Number.withThousandsSeparator):
     21        * inspector/front-end/heapProfiler.css:
     22        (.detailed-heapshot-view .data-grid span.percent-column):
     23
    1242012-02-09  Ilya Tikhonovsky  <loislo@chromium.org>
    225
  • trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js

    r107106 r107225  
    6363    _toPercentString: function(num)
    6464    {
    65         return num.toFixed(2) + "%";
     65        return num.toFixed(0) + "\u2009%"; // \u2009 is a thin space.
    6666    },
    6767
     
    7373        var valueSpan = document.createElement("span");
    7474        valueSpan.textContent = this.data[columnIdentifier];
     75        div.appendChild(valueSpan);
    7576        var percentColumn = columnIdentifier + "-percent";
    7677        if (percentColumn in this.data) {
     
    8081            div.appendChild(percentSpan);
    8182        }
    82         div.appendChild(valueSpan);
    8383        cell.appendChild(div);
    8484        return cell;
     
    301301        data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize);
    302302        data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize);
    303         if (view._showPercentage) {
    304             data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent);
    305             data["retainedSize-percent"] = this._toPercentString(this._retainedSizePercent);
    306         }
     303        data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent);
     304        data["retainedSize-percent"] = this._toPercentString(this._retainedSizePercent);
    307305
    308306        return this._enhanceData ? this._enhanceData(data) : data;
     
    626624        data["shallowSize"] = Number.withThousandsSeparator(this._shallowSize);
    627625        data["retainedSize"] = Number.withThousandsSeparator(this._retainedSize);
    628         if (view._showPercentage) {
    629             data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent);
    630             data["retainedSize-percent"] = this._toPercentString(this._retainedSizePercent);
    631         }
     626        data["count-percent"] =  this._toPercentString(this._countPercent);
     627        data["shallowSize-percent"] = this._toPercentString(this._shallowSizePercent);
     628        data["retainedSize-percent"] = this._toPercentString(this._retainedSizePercent);
    632629        return data;
    633630    },
  • trunk/Source/WebCore/inspector/front-end/DetailedHeapshotView.js

    r107106 r107225  
    431431    this.parent.addEventListener("profile added", this._updateFilterOptions, this);
    432432
    433     this._showPercentage = false;
    434 
    435433    this.viewsContainer = document.createElement("div");
    436434    this.viewsContainer.addStyleClass("views-container");
     
    515513    this._updateFilterOptions();
    516514
    517     this.percentButton = new WebInspector.StatusBarButton("", "percent-time-status-bar-item status-bar-item");
    518     this.percentButton.addEventListener("click", this._percentClicked.bind(this), false);
    519515    this.helpButton = new WebInspector.StatusBarButton("", "heapshot-help-status-bar-item status-bar-item");
    520516    this.helpButton.addEventListener("click", this._helpClicked.bind(this), false);
     
    540536            this.baseSelectElement.selectedIndex = profileIndex;
    541537        this.dataGrid.setDataSource(this, this.profileWrapper);
    542         this._updatePercentButton();
    543538    }
    544539}
     
    559554    get statusBarItems()
    560555    {
    561         return [this.viewSelectElement, this.baseSelectElement, this.filterSelectElement, this.percentButton.element, this.helpButton.element];
     556        return [this.viewSelectElement, this.baseSelectElement, this.filterSelectElement, this.helpButton.element];
    562557    },
    563558
     
    611606        var height = this.retainmentView.element.clientHeight;
    612607        this._updateRetainmentViewHeight(height);
    613     },
    614 
    615     refreshShowPercents: function()
    616     {
    617         this._updatePercentButton();
    618         this.refreshVisibleData();
    619608    },
    620609
     
    843832        if (!cell || (!cell.hasStyleClass("count-column") && !cell.hasStyleClass("shallowSize-column") && !cell.hasStyleClass("retainedSize-column")))
    844833            return;
    845 
    846         this.refreshShowPercents();
    847834
    848835        event.preventDefault();
     
    945932        span.node = gridNode;
    946933        return span;
    947     },
    948 
    949     _percentClicked: function(event)
    950     {
    951         this._showPercentage = !this._showPercentage;
    952         this.refreshShowPercents();
    953934    },
    954935
     
    10961077            this.filterSelectElement.appendChild(filterOption);
    10971078        }
    1098     },
    1099 
    1100     _updatePercentButton: function()
    1101     {
    1102         if (this._showPercentage) {
    1103             this.percentButton.title = WebInspector.UIString("Hide percentages of counts and sizes.");
    1104             this.percentButton.toggled = true;
    1105         } else {
    1106             this.percentButton.title = WebInspector.UIString("Show percentages of counts and sizes.");
    1107             this.percentButton.toggled = false;
    1108         }
    11091079    }
    11101080};
  • trunk/Source/WebCore/inspector/front-end/UIUtils.js

    r107217 r107225  
    448448    var re = /(\d+)(\d{3})/;
    449449    while (str.match(re))
    450         str = str.replace(re, "$1,$2");
     450        str = str.replace(re, "$1\u2009$2"); // \u2009 is a thin space.
    451451    return str;
    452452}
  • trunk/Source/WebCore/inspector/front-end/heapProfiler.css

    r107106 r107225  
    122122.detailed-heapshot-view .data-grid span.percent-column {
    123123    color: grey;
    124     width: 42px;
    125     float: left;
     124    width: 32px;
     125    float: right;
    126126}
    127127
Note: See TracChangeset for help on using the changeset viewer.