Title: [106354] trunk/Source/WebCore
Revision
106354
Author
[email protected]
Date
2012-01-31 04:11:35 -0800 (Tue, 31 Jan 2012)

Log 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 <[email protected]> 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):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (106353 => 106354)


--- trunk/Source/WebCore/ChangeLog	2012-01-31 11:59:43 UTC (rev 106353)
+++ trunk/Source/WebCore/ChangeLog	2012-01-31 12:11:35 UTC (rev 106354)
@@ -1,3 +1,18 @@
+2012-01-31  Alexei Filippov  <[email protected]>
+
+        Web Inspector: show sizes in bytes instead of KB, MB in heap profiler.
+        https://bugs.webkit.org/show_bug.cgi?id=77199
+
+        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):
+
 2012-01-26  Hans Wennborg  <[email protected]>
 
         Speech Input: move MockSpeechInputClient into Chromium DumpRenderTree implementation

Modified: trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js (106353 => 106354)


--- trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-01-31 11:59:43 UTC (rev 106353)
+++ trunk/Source/WebCore/inspector/front-end/DetailedHeapshotGridNodes.js	2012-01-31 12:11:35 UTC (rev 106354)
@@ -268,8 +268,8 @@
         data["object"] = { valueStyle: valueStyle, value: value + ": @" + this.snapshotNodeId };
 
         var view = this.dataGrid.snapshotView;
-        data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize);
-        data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retainedSize);
+        data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.withThousandsSeparator(this._shallowSize);
+        data["retainedSize"] = view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.withThousandsSeparator(this._retainedSize);
 
         return this._enhanceData ? this._enhanceData(data) : data;
     },
@@ -503,10 +503,10 @@
             data["addedCount"] = "";
             data["addedSize"] = "";
             data["removedCount"] = "\u2022";
-            data["removedSize"] = Number.bytesToString(this._shallowSize);
+            data["removedSize"] = Number.withThousandsSeparator(this._shallowSize);
         } else {
             data["addedCount"] = "\u2022";
-            data["addedSize"] = Number.bytesToString(this._shallowSize);
+            data["addedSize"] = Number.withThousandsSeparator(this._shallowSize);
             data["removedCount"] = "";
             data["removedSize"] = "";
         }
@@ -570,8 +570,8 @@
         var data = "" this._name, count: this._count};
         var view = this.dataGrid.snapshotView;
         data["count"] = view.showCountAsPercent ? WebInspector.UIString("%.2f%%", this._countPercent) : this._count;
-        data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.bytesToString(this._shallowSize);
-        data["retainedSize"] = "> " + (view.showRetainedSizeAsPercent ? WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.bytesToString(this._retainedSize));
+        data["shallowSize"] = view.showShallowSizeAsPercent ? WebInspector.UIString("%.2f%%", this._shallowSizePercent) : Number.withThousandsSeparator(this._shallowSize);
+        data["retainedSize"] = view.showRetainedSizeAsPercent ? "~" + WebInspector.UIString("%.2f%%", this._retainedSizePercent) : Number.withThousandsSeparator(this._retainedSize) + "+";
         return data;
     },
 
@@ -751,9 +751,9 @@
         data["addedCount"] = this._addedCount;
         data["removedCount"] = this._removedCount;
         data["countDelta"] = WebInspector.UIString("%s%d", this._signForDelta(this._countDelta), Math.abs(this._countDelta));
-        data["addedSize"] = Number.bytesToString(this._addedSize);
-        data["removedSize"] = Number.bytesToString(this._removedSize);
-        data["sizeDelta"] = WebInspector.UIString("%s%s", this._signForDelta(this._sizeDelta), Number.bytesToString(Math.abs(this._sizeDelta)));
+        data["addedSize"] = Number.withThousandsSeparator(this._addedSize);
+        data["removedSize"] = Number.withThousandsSeparator(this._removedSize);
+        data["sizeDelta"] = WebInspector.UIString("%s%s", this._signForDelta(this._sizeDelta), Number.withThousandsSeparator(Math.abs(this._sizeDelta)));
 
         return data;
     }

Modified: trunk/Source/WebCore/inspector/front-end/UIUtils.js (106353 => 106354)


--- trunk/Source/WebCore/inspector/front-end/UIUtils.js	2012-01-31 11:59:43 UTC (rev 106353)
+++ trunk/Source/WebCore/inspector/front-end/UIUtils.js	2012-01-31 12:11:35 UTC (rev 106354)
@@ -442,6 +442,15 @@
         return WebInspector.UIString("%.0fMB", megabytes);
 }
 
+Number.withThousandsSeparator = function(num)
+{
+    var str = num + "";
+    var re = /(\d+)(\d{3})/;
+    while (str.match(re))
+        str = str.replace(re, "$1,$2");
+    return str;
+}
+
 WebInspector._missingLocalizedStrings = {};
 
 /**
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to