Title: [120829] trunk/Source/WebCore
Revision
120829
Author
[email protected]
Date
2012-06-20 09:33:27 -0700 (Wed, 20 Jun 2012)

Log Message

Web Inspector: mark used/allocated JS heap on the native memory bar chart.
https://bugs.webkit.org/show_bug.cgi?id=89476

Patch by Alexei Filippov <[email protected]> on 2012-06-20
Reviewed by Yury Semikhatsky.

* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.NativeMemoryBarChart):
(WebInspector.NativeMemoryBarChart.prototype._updateView):
* inspector/front-end/nativeMemoryProfiler.css:
(.memory-bar-chart-bar):
(.memory-bar-chart-unused):
(.memory-bar-chart-percent):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (120828 => 120829)


--- trunk/Source/WebCore/ChangeLog	2012-06-20 16:17:50 UTC (rev 120828)
+++ trunk/Source/WebCore/ChangeLog	2012-06-20 16:33:27 UTC (rev 120829)
@@ -1,3 +1,18 @@
+2012-06-20  Alexei Filippov  <[email protected]>
+
+        Web Inspector: mark used/allocated JS heap on the native memory bar chart.
+        https://bugs.webkit.org/show_bug.cgi?id=89476
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        (WebInspector.NativeMemoryBarChart):
+        (WebInspector.NativeMemoryBarChart.prototype._updateView):
+        * inspector/front-end/nativeMemoryProfiler.css:
+        (.memory-bar-chart-bar):
+        (.memory-bar-chart-unused):
+        (.memory-bar-chart-percent):
+
 2012-06-20  Joshua Bell  <[email protected]>
 
         [Chromium] IndexedDB: Don't close database if pending connections are in flight

Modified: trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js (120828 => 120829)


--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-06-20 16:17:50 UTC (rev 120828)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-06-20 16:33:27 UTC (rev 120829)
@@ -377,8 +377,7 @@
     this._memorySnapshot = null;
     this.element = document.createElement("div");
     this._table = this.element.createChild("table");
-    this._bars = {};
-    this._sizes = {};
+    this._divs = {};
     var row = this._table.insertRow();
     this._totalDiv = row.insertCell().createChild("div");
     this._totalDiv.addStyleClass("memory-bar-chart-total");
@@ -444,8 +443,8 @@
         for (var i = memoryBlock.children.length - 1; i >= 0 ; --i) {
             var child = memoryBlock.children[i];
             var name = child.name;
-            var barDiv = this._bars[name];
-            if (!barDiv) {
+            var divs = this._divs[name];
+            if (!divs) {
                 var row = this._table.insertRow();
                 var nameDiv = row.insertCell(-1).createChild("div");
                 var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child);
@@ -457,15 +456,27 @@
                 barDiv.addStyleClass("memory-bar-chart-bar");
                 var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child);
                 barDiv.style.backgroundColor = viewProperties._fillStyle;
-                this._bars[name] = barDiv;
+                var unusedDiv = barDiv.createChild("div");
+                unusedDiv.addStyleClass("memory-bar-chart-unused");
+                var percentDiv = barDiv.createChild("div");
+                percentDiv.addStyleClass("memory-bar-chart-percent");
                 var sizeDiv = barCell.createChild("div");
                 sizeDiv.addStyleClass("memory-bar-chart-size");
-                this._sizes[name] = sizeDiv;
+                divs = this._divs[name] = { barDiv: barDiv, unusedDiv: unusedDiv, percentDiv: percentDiv, sizeDiv: sizeDiv };
             }
-            barDiv.style.width = child.size * barLengthSizeRatio + "px";
-            barDiv.textContent = (child.size / memoryBlock.size * 100).toFixed(0) + "%";
-            var sizeDiv = this._sizes[name];
-            sizeDiv.textContent = (child.size / MB).toFixed(1) + "\u2009MB";
+            var unusedSize = 0;
+            if (!!child.children) {
+                unusedSize = child.size;
+                for (var j = 0; j < child.children.length; ++j)
+                    unusedSize -= child.children[j].size;
+            }
+            var unusedLength = unusedSize * barLengthSizeRatio;
+            var barLength = child.size * barLengthSizeRatio;
+
+            divs.barDiv.style.width = barLength + "px";
+            divs.unusedDiv.style.width = unusedLength + "px";
+            divs.percentDiv.textContent = barLength > 20 ? (child.size / memoryBlock.size * 100).toFixed(0) + "%" : "";
+            divs.sizeDiv.textContent = (child.size / MB).toFixed(1) + "\u2009MB";
         }
 
         var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(memoryBlock);

Modified: trunk/Source/WebCore/inspector/front-end/nativeMemoryProfiler.css (120828 => 120829)


--- trunk/Source/WebCore/inspector/front-end/nativeMemoryProfiler.css	2012-06-20 16:17:50 UTC (rev 120828)
+++ trunk/Source/WebCore/inspector/front-end/nativeMemoryProfiler.css	2012-06-20 16:33:27 UTC (rev 120829)
@@ -57,13 +57,25 @@
 
 .memory-bar-chart-bar {
     border: 1px solid #bbb;
-    border-radius: 3px;
+    border-radius: 2px;
     float: left;
     height: 20px;
-    text-align: center;
     overflow: hidden;
+    position: relative;
 }
 
+.memory-bar-chart-unused {
+    background-color: rgba(255, 255, 255, 0.5);
+    float: right;
+    height: 100%;
+}
+
+.memory-bar-chart-percent {
+    position: absolute;
+    text-align: center;
+    width: 100%;
+}
+
 .memory-bar-chart-size {
     text-indent: 6px;
     white-space: nowrap;
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to