Changeset 119386 in webkit


Ignore:
Timestamp:
Jun 4, 2012 5:02:24 AM (12 years ago)
Author:
loislo@chromium.org
Message:

Web Inspector: add unknown size to the memory pie-chart legend
https://bugs.webkit.org/show_bug.cgi?id=88081

Patch by Yury Semikhatsky <yurys@chromium.org> on 2012-06-04
Reviewed by Pavel Feldman.

Added "Unknown" part size to the memory pie-chart legend.

  • inspector/front-end/NativeMemorySnapshotView.js:

(WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
(WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
(WebInspector.MemoryBlockViewProperties._initialize):
(WebInspector.NativeMemoryPieChart.prototype._paint):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r119380 r119386  
     12012-06-04  Yury Semikhatsky  <yurys@chromium.org>
     2
     3        Web Inspector: add unknown size to the memory pie-chart legend
     4        https://bugs.webkit.org/show_bug.cgi?id=88081
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Added "Unknown" part size to the memory pie-chart legend.
     9
     10        * inspector/front-end/NativeMemorySnapshotView.js:
     11        (WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
     12        (WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
     13        (WebInspector.MemoryBlockViewProperties._initialize):
     14        (WebInspector.NativeMemoryPieChart.prototype._paint):
     15
    1162012-06-04  Mike West  <mkwst@chromium.org>
    217
  • trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js

    r119203 r119386  
    9494        function didReceiveMemorySnapshot(error, memoryBlock)
    9595        {
     96            if (memoryBlock.size && memoryBlock.children) {
     97                var knownSize = 0;
     98                for (var i = 0; i < memoryBlock.children.length; i++) {
     99                    var size = memoryBlock.children[i].size;
     100                    if (size)
     101                        knownSize += size;
     102                }
     103                var unknownSize = memoryBlock.size - knownSize;
     104
     105                if (unknownSize) {
     106                    memoryBlock.children.push({
     107                        name: "Unknown",
     108                        size: unknownSize
     109                    });
     110                }
     111            }
    96112            profileHeader._memoryBlock = memoryBlock;
    97113            profileHeader.isTemporary = false;
     
    199215        WebInspector.MemoryBlockViewProperties._standardBlocks[name] = new WebInspector.MemoryBlockViewProperties(fillStyle, name, WebInspector.UIString(description));
    200216    }
    201     addBlock("rgba(240, 240, 250, 0.8)", "ProcessPrivateMemory", "Total");
     217    addBlock("rgba(255, 255, 255, 0.8)", "ProcessPrivateMemory", "Total");
     218    addBlock("rgba(240, 240, 250, 0.8)", "Unknown", "Unknown");
    202219    addBlock("rgba(250, 200, 200, 0.8)", "JSHeapAllocated", "JavaScript heap");
    203220    addBlock("rgba(200, 250, 200, 0.8)", "JSHeapUsed", "Used JavaScript heap");
     
    282299        ctx.arc(x, y, radius, 0, Math.PI*2, false);
    283300        ctx.lineWidth = 1;
    284         ctx.fillStyle = WebInspector.MemoryBlockViewProperties._forMemoryBlock(this._memorySnapshot)._fillStyle;
    285301        ctx.strokeStyle = "rgba(130, 130, 130, 0.8)";
    286         ctx.fill();
    287302        ctx.stroke();
    288303        ctx.closePath();
     
    315330        }
    316331
    317         if (memoryBlock.children) {
    318             var total = memoryBlock.size;
    319             for (var i = 0; i < memoryBlock.children.length; i++) {
    320                 var child = memoryBlock.children[i];
    321                 if (!child.size)
    322                     continue;
    323                 var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child);
    324                 var angleSpan = Math.PI * 2 * (child.size / total);
    325                 ctx.beginPath();
    326                 ctx.moveTo(x, y);
    327                 ctx.lineTo(x + radius * Math.cos(currentAngle), y + radius * Math.sin(currentAngle));
    328                 ctx.arc(x, y, radius, currentAngle, currentAngle + angleSpan, false);
    329                 ctx.lineWidth = 0.5;
    330                 ctx.lineTo(x, y);
    331                 ctx.fillStyle = viewProperties._fillStyle;
    332                 ctx.strokeStyle = "rgba(100, 100, 100, 0.8)";
    333                 ctx.fill();
    334                 ctx.stroke();
    335                 ctx.closePath();
    336 
    337                 paintPercentAndLabel(child.size / total, viewProperties._description, currentAngle + angleSpan / 2);
    338 
    339                 currentAngle += angleSpan;
    340             }
     332        if (!memoryBlock.children)
     333            return;
     334        var total = memoryBlock.size;
     335        for (var i = 0; i < memoryBlock.children.length; i++) {
     336            var child = memoryBlock.children[i];
     337            if (!child.size)
     338                continue;
     339            var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(child);
     340            var angleSpan = Math.PI * 2 * (child.size / total);
     341            ctx.beginPath();
     342            ctx.moveTo(x, y);
     343            ctx.lineTo(x + radius * Math.cos(currentAngle), y + radius * Math.sin(currentAngle));
     344            ctx.arc(x, y, radius, currentAngle, currentAngle + angleSpan, false);
     345            ctx.lineWidth = 0.5;
     346            ctx.lineTo(x, y);
     347            ctx.fillStyle = viewProperties._fillStyle;
     348            ctx.strokeStyle = "rgba(100, 100, 100, 0.8)";
     349            ctx.fill();
     350            ctx.stroke();
     351            ctx.closePath();
     352
     353            paintPercentAndLabel(child.size / total, viewProperties._description, currentAngle + angleSpan / 2);
     354
     355            currentAngle += angleSpan;
    341356        }
    342 
    343         var fraction = 1 - (currentAngle - startAngle) / (2 * Math.PI);
    344         var midAngle = (currentAngle + startAngle + 2 * Math.PI) / 2;
    345         paintPercentAndLabel(fraction, WebInspector.UIString("Unknown"), midAngle);
    346357    },
    347358
Note: See TracChangeset for help on using the changeset viewer.