Title: [145540] trunk/Source/WebCore
Revision
145540
Author
[email protected]
Date
2013-03-12 07:35:33 -0700 (Tue, 12 Mar 2013)

Log Message

Web Inspector: add html canvas memory details to the native memory overview
https://bugs.webkit.org/show_bug.cgi?id=112123

Reviewed by Alexander Pavlov.

Show memory occupied vby HTMLCanvasElements under Image category
in the native memory overview.

* inspector/front-end/NativeHeapSnapshot.js:
(WebInspector.NativeHeapSnapshot.prototype.images.getImageName):
(WebInspector.NativeHeapSnapshot.prototype.images.getCanvasName):
(WebInspector.NativeHeapSnapshot.prototype.images):
(WebInspector.NativeHeapSnapshot.prototype._addNodes):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (145539 => 145540)


--- trunk/Source/WebCore/ChangeLog	2013-03-12 13:10:40 UTC (rev 145539)
+++ trunk/Source/WebCore/ChangeLog	2013-03-12 14:35:33 UTC (rev 145540)
@@ -1,3 +1,19 @@
+2013-03-12  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: add html canvas memory details to the native memory overview
+        https://bugs.webkit.org/show_bug.cgi?id=112123
+
+        Reviewed by Alexander Pavlov.
+
+        Show memory occupied vby HTMLCanvasElements under Image category
+        in the native memory overview.
+
+        * inspector/front-end/NativeHeapSnapshot.js:
+        (WebInspector.NativeHeapSnapshot.prototype.images.getImageName):
+        (WebInspector.NativeHeapSnapshot.prototype.images.getCanvasName):
+        (WebInspector.NativeHeapSnapshot.prototype.images):
+        (WebInspector.NativeHeapSnapshot.prototype._addNodes):
+
 2013-03-12  Vsevolod Vlasov  <[email protected]>
 
         Web Inspector: ResourceScriptFile diverged state should be correctly reset after debugger reset.

Modified: trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js (145539 => 145540)


--- trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js	2013-03-12 13:10:40 UTC (rev 145539)
+++ trunk/Source/WebCore/inspector/front-end/NativeHeapSnapshot.js	2013-03-12 14:35:33 UTC (rev 145540)
@@ -72,19 +72,35 @@
     images: function()
     {
         var aggregatesByClassName = this.aggregates(false, "allObjects");
-        var images = aggregatesByClassName["WebCore::CachedImage"];
         var result = [];
-        if (!images)
-            return result;
+        var cachedImages = aggregatesByClassName["WebCore::CachedImage"];
+        function getImageName(node)
+        {
+            return node.name();
+        }
+        this._addNodes(cachedImages, getImageName, result);
+
+        var canvases = aggregatesByClassName["WebCore::HTMLCanvasElement"];
+        function getCanvasName(node)
+        {
+            return "HTMLCanvasElement";
+        }
+        this._addNodes(canvases, getCanvasName, result);
+        return result;
+    },
+
+    _addNodes: function(classData, nameResolver, result)
+    {
+        if (!classData)
+            return;
         var node = this.rootNode();
-        for (var i = 0; i < images.idxs.length; i++) {
-            node.nodeIndex = images.idxs[i];
+        for (var i = 0; i < classData.idxs.length; i++) {
+            node.nodeIndex = classData.idxs[i];
             result.push({
-                name: node.name(),
+                name: nameResolver(node),
                 size: node.retainedSize(),
             });
         }
-        return result;
     },
 
     __proto__: WebInspector.HeapSnapshot.prototype
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to