Changeset 106354 in webkit


Ignore:
Timestamp:
Jan 31, 2012 4:11:35 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: show sizes in bytes instead of KB, MB in heap profiler.
https://bugs.webkit.org/show_bug.cgi?id=77199

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

  • inspector/front-end/DetailedHeapshotGridNodes.js:

(WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
(WebInspector.HeapSnapshotInstanceNode.prototype._enhanceData):
(WebInspector.HeapSnapshotConstructorNode.prototype.get data):
(WebInspector.HeapSnapshotDiffNode.prototype.get data):

  • inspector/front-end/UIUtils.js:

(Number.withThousandsSeparator):

Location:
trunk/Source/WebCore
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r106353 r106354  
     12012-01-31  Alexei Filippov  <alexeif@chromium.org>
     2
     3        Web Inspector: show sizes in bytes instead of KB, MB in heap profiler.
     4        https://bugs.webkit.org/show_bug.cgi?id=77199
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/front-end/DetailedHeapshotGridNodes.js:
     9        (WebInspector.HeapSnapshotGenericObjectNode.prototype.get data):
     10        (WebInspector.HeapSnapshotInstanceNode.prototype._enhanceData):
     11        (WebInspector.HeapSnapshotConstructorNode.prototype.get data):
     12        (WebInspector.HeapSnapshotDiffNode.prototype.get data):
     13        * inspector/front-end/UIUtils.js:
     14        (Number.withThousandsSeparator):
     15
    1162012-01-26  Hans Wennborg  <hans@chromium.org>
    217
  • trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js

    r105865 r106354  
    269269
    270270        var view = this.dataGrid.snapshotView;
    271         data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize);
    272         data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retainedSize);
     271        data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.withThousandsSeparator(this._shallowSize);
     272        data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.withThousandsSeparator(this._retainedSize);
    273273
    274274        return this._enhanceData ? this._enhanceData(data) : data;
     
    504504            data["addedSize"] = "";
    505505            data["removedCount"] = "\u2022";
    506             data["removedSize"] = Number.bytesToString(this._shallowSize);
     506            data["removedSize"] = Number.withThousandsSeparator(this._shallowSize);
    507507        } else {
    508508            data["addedCount"] = "\u2022";
    509             data["addedSize"] = Number.bytesToString(this._shallowSize);
     509            data["addedSize"] = Number.withThousandsSeparator(this._shallowSize);
    510510            data["removedCount"] = "";
    511511            data["removedSize"] = "";
     
    571571        var view = this.dataGrid.snapshotView;
    572572        data["count"] = view.showCountAsPercent ? WebInspector.UIString("%.2f%%", this._countPercent) : this._count;
    573         data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize);
    574         data["retainedSize"] = "> " + (view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retainedSize));
     573        data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.withThousandsSeparator(this._shallowSize);
     574        data["retainedSize"] = view.showRetainedSizeAsPercent ? "~" + WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.withThousandsSeparator(this._retainedSize) + "+";
    575575        return data;
    576576    },
     
    752752        data["removedCount"] = this._removedCount;
    753753        data["countDelta"] = WebInspector.UIString("%s%d", this._signForDelta(this._countDelta), Math.abs(this._countDelta));
    754         data["addedSize"] = Number.bytesToString(this._addedSize);
    755         data["removedSize"] = Number.bytesToString(this._removedSize);
    756         data["sizeDelta"] = WebInspector.UIString("%s%s", this._signForDelta(this._sizeDelta), Number.bytesToString(Math.abs(this._sizeDelta)));
     754        data["addedSize"] = Number.withThousandsSeparator(this._addedSize);
     755        data["removedSize"] = Number.withThousandsSeparator(this._removedSize);
     756        data["sizeDelta"] = WebInspector.UIString("%s%s", this._signForDelta(this._sizeDelta), Number.withThousandsSeparator(Math.abs(this._sizeDelta)));
    757757
    758758        return data;
  • trunk/Source/WebCore/inspector/front-end/UIUtils.js

    r105488 r106354  
    443443}
    444444
     445Number.withThousandsSeparator = function(num)
     446{
     447    var str = num + "";
     448    var re = /(\d+)(\d{3})/;
     449    while (str.match(re))
     450        str = str.replace(re, "$1,$2");
     451    return str;
     452}
     453
    445454WebInspector._missingLocalizedStrings = {};
    446455
Note: See TracChangeset for help on using the changeset viewer.