Title: [138005] trunk/Source
Revision
138005
Author
[email protected]
Date
2012-12-18 03:46:05 -0800 (Tue, 18 Dec 2012)

Log Message

Web Inspector: show cached images under MemoryCache -> Images section
https://bugs.webkit.org/show_bug.cgi?id=105261

Reviewed by Pavel Feldman.

Source/WebCore:

Provided class name and name for several objects related to CachedImage.
Changed native memory snapsho view so that MemoryCache.Image section can
be expanded into individual images.

* inspector/front-end/NativeMemorySnapshotView.js:
(WebInspector.NativeMemorySnapshotView):
(WebInspector.NativeSnapshotNode.prototype._addChildrenFromGraph):
(WebInspector.NativeHeapGraphEdge):
(WebInspector.NativeHeapGraphEdge.prototype.type):
(WebInspector.NativeHeapGraphEdge.prototype.name):
(WebInspector.NativeHeapGraphEdge.prototype.target):
(WebInspector.NativeHeapGraphEdge.prototype._getStringField):
(WebInspector.NativeHeapGraphEdge.prototype.toString):
(WebInspector.NativeHeapGraphNode.prototype.size):
(WebInspector.NativeHeapGraphNode.prototype.referencedNodes):
(WebInspector.NativeHeapGraphNode.prototype.outgoingEdges):
(WebInspector.NativeHeapGraphNode.prototype.targetOfEdge):
(WebInspector.NativeHeapGraphNode.prototype.targetsOfAllEdges):
(WebInspector.NativeHeapGraphNode.prototype._firstEdgePoistion):
(WebInspector.NativeHeapGraphNode.prototype._afterLastEdgePosition):
(WebInspector.NativeHeapGraphNode.prototype._getStringField):
(WebInspector.NativeHeapGraphNode.prototype.toString):
(WebInspector.NativeHeapGraph):
(WebInspector.NativeHeapGraph.prototype.rootNodes):
(WebInspector.NativeHeapGraph.prototype._calculateNodeEdgeIndexes):
(WebInspector.NativeHeapGraph.prototype._addDummyNode):
(WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
(WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
* loader/cache/CachedImage.cpp:
(WebCore::CachedImage::reportMemoryUsage):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::reportMemoryUsage):
* loader/cache/MemoryCache.cpp:
(WebCore::MemoryCache::reportMemoryUsage):
* platform/graphics/BitmapImage.cpp:
(WebCore::BitmapImage::reportMemoryUsage):
(WebCore::FrameData::reportMemoryUsage):
* platform/graphics/Image.cpp:
(WebCore::Image::reportMemoryUsage):
* platform/graphics/skia/MemoryInstrumentationSkia.cpp:
(reportMemoryUsage):

Source/WTF:

Use first provided name and class name. If one of the ancestors tries to overwrite
it just ignore the call.

* wtf/MemoryObjectInfo.h:
(WTF::MemoryObjectInfo::setClassName):
(WTF::MemoryObjectInfo::setName):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (138004 => 138005)


--- trunk/Source/WTF/ChangeLog	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WTF/ChangeLog	2012-12-18 11:46:05 UTC (rev 138005)
@@ -1,3 +1,17 @@
+2012-12-18  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: show cached images under MemoryCache -> Images section
+        https://bugs.webkit.org/show_bug.cgi?id=105261
+
+        Reviewed by Pavel Feldman.
+
+        Use first provided name and class name. If one of the ancestors tries to overwrite
+        it just ignore the call.
+
+        * wtf/MemoryObjectInfo.h:
+        (WTF::MemoryObjectInfo::setClassName):
+        (WTF::MemoryObjectInfo::setName):
+
 2012-12-18  Uli Schlachter  <[email protected]>
 
         Implement uncommitted memory for Linux.

Modified: trunk/Source/WTF/wtf/MemoryObjectInfo.h (138004 => 138005)


--- trunk/Source/WTF/wtf/MemoryObjectInfo.h	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WTF/wtf/MemoryObjectInfo.h	2012-12-18 11:46:05 UTC (rev 138005)
@@ -61,9 +61,17 @@
     bool customAllocation() const { return m_customAllocation; }
     void setCustomAllocation(bool customAllocation) { m_customAllocation = customAllocation; }
 
-    void setClassName(const String& className) { m_className = className; }
+    void setClassName(const String& className)
+    {
+        if (m_className.isEmpty())
+            m_className = className;
+    }
     const String& className() const { return m_className; }
-    void setName(const String& name) { m_name = name; }
+    void setName(const String& name)
+    {
+        if (m_name.isEmpty())
+            m_name = name;
+    }
     const String& name() const { return m_name; }
 
     MemoryInstrumentation* memoryInstrumentation() { return m_memoryInstrumentation; }

Modified: trunk/Source/WebCore/ChangeLog (138004 => 138005)


--- trunk/Source/WebCore/ChangeLog	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/ChangeLog	2012-12-18 11:46:05 UTC (rev 138005)
@@ -1,3 +1,52 @@
+2012-12-18  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: show cached images under MemoryCache -> Images section
+        https://bugs.webkit.org/show_bug.cgi?id=105261
+
+        Reviewed by Pavel Feldman.
+
+        Provided class name and name for several objects related to CachedImage.
+        Changed native memory snapsho view so that MemoryCache.Image section can
+        be expanded into individual images.
+
+        * inspector/front-end/NativeMemorySnapshotView.js:
+        (WebInspector.NativeMemorySnapshotView):
+        (WebInspector.NativeSnapshotNode.prototype._addChildrenFromGraph):
+        (WebInspector.NativeHeapGraphEdge):
+        (WebInspector.NativeHeapGraphEdge.prototype.type):
+        (WebInspector.NativeHeapGraphEdge.prototype.name):
+        (WebInspector.NativeHeapGraphEdge.prototype.target):
+        (WebInspector.NativeHeapGraphEdge.prototype._getStringField):
+        (WebInspector.NativeHeapGraphEdge.prototype.toString):
+        (WebInspector.NativeHeapGraphNode.prototype.size):
+        (WebInspector.NativeHeapGraphNode.prototype.referencedNodes):
+        (WebInspector.NativeHeapGraphNode.prototype.outgoingEdges):
+        (WebInspector.NativeHeapGraphNode.prototype.targetOfEdge):
+        (WebInspector.NativeHeapGraphNode.prototype.targetsOfAllEdges):
+        (WebInspector.NativeHeapGraphNode.prototype._firstEdgePoistion):
+        (WebInspector.NativeHeapGraphNode.prototype._afterLastEdgePosition):
+        (WebInspector.NativeHeapGraphNode.prototype._getStringField):
+        (WebInspector.NativeHeapGraphNode.prototype.toString):
+        (WebInspector.NativeHeapGraph):
+        (WebInspector.NativeHeapGraph.prototype.rootNodes):
+        (WebInspector.NativeHeapGraph.prototype._calculateNodeEdgeIndexes):
+        (WebInspector.NativeHeapGraph.prototype._addDummyNode):
+        (WebInspector.NativeMemoryProfileType.prototype.buttonClicked.didReceiveMemorySnapshot):
+        (WebInspector.NativeMemoryProfileType.prototype.buttonClicked):
+        * loader/cache/CachedImage.cpp:
+        (WebCore::CachedImage::reportMemoryUsage):
+        * loader/cache/CachedResource.cpp:
+        (WebCore::CachedResource::reportMemoryUsage):
+        * loader/cache/MemoryCache.cpp:
+        (WebCore::MemoryCache::reportMemoryUsage):
+        * platform/graphics/BitmapImage.cpp:
+        (WebCore::BitmapImage::reportMemoryUsage):
+        (WebCore::FrameData::reportMemoryUsage):
+        * platform/graphics/Image.cpp:
+        (WebCore::Image::reportMemoryUsage):
+        * platform/graphics/skia/MemoryInstrumentationSkia.cpp:
+        (reportMemoryUsage):
+
 2012-12-18  Eugene Klyuchnikov  <[email protected]>
 
         Web Inspector: Calculate "idle" time for CPU profiles.

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


--- trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js	2012-12-18 11:46:05 UTC (rev 138005)
@@ -39,10 +39,10 @@
     this.registerRequiredCSS("nativeMemoryProfiler.css");
 
     this.element.addStyleClass("native-snapshot-view");
-    this._containmentDataGrid = new WebInspector.NativeSnapshotDataGrid(profile._memoryBlock);
+    this._containmentDataGrid = new WebInspector.NativeSnapshotDataGrid(profile);
     this._containmentDataGrid.show(this.element);
 
-    this._heapGraphDataGrid = new WebInspector.NativeHeapGraphDataGrid(new WebInspector.NativeHeapGraph(profile._graph));
+    this._heapGraphDataGrid = new WebInspector.NativeHeapGraphDataGrid(profile._graph);
 
     this._viewSelectElement = document.createElement("select");
     this._viewSelectElement.className = "status-bar-item";
@@ -90,7 +90,7 @@
 /**
  * @constructor
  * @extends {WebInspector.DataGrid}
- * @param {MemoryAgent.MemoryBlock} profile
+ * @param {WebInspector.NativeMemoryProfileHeader} profile
  */
 WebInspector.NativeSnapshotDataGrid = function(profile)
 {
@@ -99,7 +99,8 @@
         size: { title: WebInspector.UIString("Size"), sortable: true, sort: "descending" },
     };
     WebInspector.DataGrid.call(this, columns);
-    this._totalNode = new WebInspector.NativeSnapshotNode(profile, profile);
+    this._profile = profile;
+    this._totalNode = new WebInspector.NativeSnapshotNode(profile._memoryBlock, profile._memoryBlock);
     if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get()) {
         this.setRootNode(new WebInspector.DataGridNode(null, true));
         this.rootNode().appendChild(this._totalNode)
@@ -145,12 +146,12 @@
  * @constructor
  * @extends {WebInspector.DataGridNode}
  * @param {MemoryAgent.MemoryBlock} nodeData
- * @param {MemoryAgent.MemoryBlock} profile
+ * @param {MemoryAgent.MemoryBlock} rootMemoryBlock
  */
-WebInspector.NativeSnapshotNode = function(nodeData, profile)
+WebInspector.NativeSnapshotNode = function(nodeData, rootMemoryBlock)
 {
     this._nodeData = nodeData;
-    this._profile = profile;
+    this._rootMemoryBlock = rootMemoryBlock;
     var viewProperties = WebInspector.MemoryBlockViewProperties._forMemoryBlock(nodeData);
     var data = { name: viewProperties._description, size: this._nodeData.size };
     var hasChildren = !!nodeData.children && nodeData.children.length !== 0;
@@ -223,7 +224,7 @@
         }
 
         var sizeKB = this._nodeData.size / 1024;
-        var totalSize = this._profile.size;
+        var totalSize = this._rootMemoryBlock.size;
         var percentage = this._nodeData.size / totalSize  * 100;
 
         var cell = document.createElement("td");
@@ -259,13 +260,66 @@
     _populate: function() {
         this.removeEventListener("populate", this._populate, this);
         this._nodeData.children.sort(this.dataGrid._sortingFunction.bind(this.dataGrid));
+
         for (var node in this._nodeData.children) {
             var nodeData = this._nodeData.children[node];
+            this._addChildrenFromGraph(nodeData);
             if (WebInspector.settings.showNativeSnapshotUninstrumentedSize.get() || nodeData.name !== "Other")
-                this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._profile));
+                this.appendChild(new WebInspector.NativeSnapshotNode(nodeData, this._rootMemoryBlock));
         }
     },
 
+    /**
+     * @param {MemoryAgent.MemoryBlock} memoryBlock
+     */
+    _addChildrenFromGraph: function(memoryBlock)
+    {
+        if (memoryBlock.children)
+            return;
+        if (memoryBlock.name !== "Image" || this._nodeData.name !== "MemoryCache")
+            return;
+
+        // Collect objects on the path MemoryCache -> CachedImage -m_image-> BitmapImage -m_frames-> FrameData -m_frame-> SkBitmap -> SkPixelRef
+        var graph = this.dataGrid._profile._graph;
+        var roots = graph.rootNodes();
+        var memoryCache;
+        for (var i = 0; i < roots.length; i++) {
+            var root = roots[i];
+            if (root.className() === "MemoryCache") {
+                memoryCache = root;
+                break;
+            }
+        }
+        var edges = memoryCache.outgoingEdges();
+        var cachedImages = [];
+        for (var i = 0; i < edges.length; i++) {
+            var target = edges[i].target();
+            if (target.className() === "CachedImage") {
+                var cachedImage = {
+                    name: target.name(),
+                    size: target.size(),
+                    children: []
+                };
+                cachedImages.push(cachedImage);
+                var image = target.targetOfEdge("m_image");
+                if (image.className() === "BitmapImage") {
+                    var frames = image.targetsOfAllEdges("m_frame");
+                    for (var j = 0; j < frames.length; j++) {
+                        var pixels = frames[j].targetOfEdge("pixels");
+                        if (pixels) {
+                            cachedImage.size += pixels.size();
+                            cachedImage.children.push({
+                                name: "Bitmap pixels",
+                                size: pixels.size()
+                            });
+                        }
+                    }
+                }
+            }
+        }
+        memoryBlock.children = cachedImages;
+    },
+
     __proto__: WebInspector.DataGridNode.prototype
 }
 
@@ -275,6 +329,49 @@
  * @param {WebInspector.NativeHeapGraph} graph
  * @param {number} position
  */
+WebInspector.NativeHeapGraphEdge = function(graph, position)
+{
+    this._graph = graph;
+    this._position = position;
+}
+
+WebInspector.NativeHeapGraphEdge.prototype = {
+    type: function()
+    {
+        return this._getStringField(this._graph._edgeTypeOffset);
+    },
+
+    name: function()
+    {
+        return this._getStringField(this._graph._edgeNameOffset);
+    },
+
+    target: function()
+    {
+        var edges = this._graph._edges;
+        var targetPosition = edges[this._position + this._graph._edgeTargetOffset] * this._graph._nodeFieldCount;
+        return new WebInspector.NativeHeapGraphNode(this._graph, targetPosition);
+    },
+
+    _getStringField: function(offset)
+    {
+        var typeIndex = this._graph._edges[this._position + offset];
+        return this._graph._rawGraph.strings[typeIndex];
+    },
+
+    toString: function()
+    {
+        return "Edge#" + this._position + " -" + this.name() + "-> " + this.target();
+    }
+
+}
+
+
+/**
+ * @constructor
+ * @param {WebInspector.NativeHeapGraph} graph
+ * @param {number} position
+ */
 WebInspector.NativeHeapGraphNode = function(graph, position)
 {
     this._graph = graph;
@@ -294,7 +391,7 @@
 
     size: function()
     {
-        return this._graph._rawGraph.nodes[this._position + this._graph._nodeSizeOffset];
+        return this._graph._nodes[this._position + this._graph._nodeSizeOffset];
     },
 
     className: function()
@@ -314,8 +411,8 @@
 
     referencedNodes: function()
     {
-        var edges = this._graph._rawGraph.edges;
-        var nodes = this._graph._rawGraph.nodes;
+        var edges = this._graph._edges;
+        var nodes = this._graph._nodes;
         var edgeFieldCount = this._graph._edgeFieldCount;
         var nodeFieldCount = this._graph._nodeFieldCount;
 
@@ -327,27 +424,61 @@
         return result;
     },
 
+    outgoingEdges: function()
+    {
+        var edges = this._graph._edges;
+        var edgeFieldCount = this._graph._edgeFieldCount;
+
+        var firstEdgePosition = this._firstEdgePoistion();
+        var afterLastEdgePosition = this._afterLastEdgePosition();
+        var result = [];
+        for (var i = firstEdgePosition; i < afterLastEdgePosition; i += edgeFieldCount)
+            result.push(new WebInspector.NativeHeapGraphEdge(this._graph, i));
+        return result;
+    },
+
+    targetOfEdge: function(edgeName)
+    {
+        return this.targetsOfAllEdges(edgeName)[0];
+    },
+
+    targetsOfAllEdges: function(edgeName)
+    {
+        var edges = this._graph._edges;
+        var edgeFieldCount = this._graph._edgeFieldCount;
+
+        var firstEdgePosition = this._firstEdgePoistion();
+        var afterLastEdgePosition = this._afterLastEdgePosition();
+
+        var edge = new WebInspector.NativeHeapGraphEdge(this._graph, firstEdgePosition)
+        var result = [];
+        for (var i = firstEdgePosition; i < afterLastEdgePosition; i += edgeFieldCount) {
+            edge._position = i;
+            if (edge.name() === edgeName)
+                result.push(edge.target());
+        }
+        return result;
+    },
+
     _firstEdgePoistion: function()
     {
-        return this._graph._rawGraph.nodes[this._position + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
+        return this._graph._nodes[this._position + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
     },
 
     _afterLastEdgePosition: function()
     {
-        var edges = this._graph._rawGraph.edges;
-        var nodes = this._graph._rawGraph.nodes;
-        var afterLastEdgePosition = nodes[this._position + this._graph._nodeFieldCount + this._graph._nodeFirstEdgeOffset];
-        if (afterLastEdgePosition)
-            afterLastEdgePosition *= this._graph._edgeFieldCount;
-        else
-            afterLastEdgePosition = edges.length;
-        return afterLastEdgePosition;
+        return this._graph._nodes[this._position + this._graph._nodeFieldCount + this._graph._nodeFirstEdgeOffset] * this._graph._edgeFieldCount;
     },
 
     _getStringField: function(offset)
     {
-        var typeIndex = this._graph._rawGraph.nodes[this._position + offset];
+        var typeIndex = this._graph._nodes[this._position + offset];
         return this._graph._rawGraph.strings[typeIndex];
+    },
+
+    toString: function()
+    {
+        return "Node#" + this.id() + " " + this.name() + "(" + this.className() + ")";
     }
 }
 
@@ -372,14 +503,19 @@
     this._edgeTargetOffset = 1;
     this._edgeNameOffset = 2;
 
+    this._nodeCount = rawGraph.nodes.length / this._nodeFieldCount;
+    this._nodes = rawGraph.nodes;
+    this._edges = rawGraph.edges;
+    this._strings = rawGraph.strings;
+
     this._calculateNodeEdgeIndexes();
 }
 
 WebInspector.NativeHeapGraph.prototype = {
     rootNodes: function()
     {
-        var nodeHasIncomingEdges = new Uint8Array(this._rawGraph.nodes.length / this._nodeFieldCount);
-        var edges = this._rawGraph.edges;
+        var nodeHasIncomingEdges = new Uint8Array(this._nodeCount);
+        var edges = this._edges;
         var edgesLength = edges.length;
         var edgeFieldCount = this._edgeFieldCount;
         var nodeFieldCount = this._nodeFieldCount;
@@ -398,7 +534,7 @@
 
     _calculateNodeEdgeIndexes: function()
     {
-        var nodes = this._rawGraph.nodes;
+        var nodes = this._nodes;
         var nodeFieldCount = this._nodeFieldCount;
         var nodeLength = nodes.length;
         var firstEdgeIndex = 0;
@@ -407,6 +543,15 @@
             nodes[i] = firstEdgeIndex;
             firstEdgeIndex += count;
         }
+        this._addDummyNode();
+    },
+
+    _addDummyNode: function()
+    {
+        var firstEdgePosition = this._nodes.length + this._nodeFirstEdgeOffset;
+        for (var i = 0; i < this._nodeFieldCount; i++)
+            this._nodes.push(0);
+        this._nodes[firstEdgePosition] = this._edges.length;
     }
 }
 
@@ -545,7 +690,7 @@
                 }
             }
             profileHeader._memoryBlock = memoryBlock;
-            profileHeader._graph = graph;
+            profileHeader._graph = new WebInspector.NativeHeapGraph(graph);
             profileHeader.isTemporary = false;
             profileHeader.sidebarElement.subtitle = Number.bytesToString(/** @type{number} */(memoryBlock.size));
         }

Modified: trunk/Source/WebCore/loader/cache/CachedImage.cpp (138004 => 138005)


--- trunk/Source/WebCore/loader/cache/CachedImage.cpp	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/loader/cache/CachedImage.cpp	2012-12-18 11:46:05 UTC (rev 138005)
@@ -39,6 +39,7 @@
 #include "Settings.h"
 #include "SubresourceLoader.h"
 #include <wtf/CurrentTime.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/Vector.h>
 
@@ -482,8 +483,9 @@
 void CachedImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceImage);
+    memoryObjectInfo->setClassName("CachedImage");
     CachedResource::reportMemoryUsage(memoryObjectInfo);
-    info.addMember(m_image);
+    info.addMember(m_image, "m_image");
 #if ENABLE(SVG)
     info.addMember(m_svgImageCache);
 #endif

Modified: trunk/Source/WebCore/loader/cache/CachedResource.cpp (138004 => 138005)


--- trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/loader/cache/CachedResource.cpp	2012-12-18 11:46:05 UTC (rev 138005)
@@ -51,6 +51,7 @@
 #include <wtf/MathExtras.h>
 #include <wtf/MemoryInstrumentationHashCountedSet.h>
 #include <wtf/MemoryInstrumentationHashSet.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/RefCountedLeakCounter.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
@@ -888,6 +889,7 @@
 void CachedResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResource);
+    memoryObjectInfo->setName(url().string());
     info.addMember(m_resourceRequest);
     info.addMember(m_clients);
     info.addMember(m_accept);

Modified: trunk/Source/WebCore/loader/cache/MemoryCache.cpp (138004 => 138005)


--- trunk/Source/WebCore/loader/cache/MemoryCache.cpp	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/loader/cache/MemoryCache.cpp	2012-12-18 11:46:05 UTC (rev 138005)
@@ -47,6 +47,7 @@
 #include <wtf/CurrentTime.h>
 #include <wtf/MemoryInstrumentationHashMap.h>
 #include <wtf/MemoryInstrumentationVector.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/TemporaryChange.h>
 #include <wtf/text/CString.h>
 
@@ -723,6 +724,7 @@
 void MemoryCache::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::MemoryCacheStructures);
+    memoryObjectInfo->setClassName("MemoryCache");
     info.addMember(m_resources);
     info.addMember(m_allResources);
     info.addMember(m_liveDecodedResources);

Modified: trunk/Source/WebCore/platform/graphics/BitmapImage.cpp (138004 => 138005)


--- trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/platform/graphics/BitmapImage.cpp	2012-12-18 11:46:05 UTC (rev 138005)
@@ -35,6 +35,7 @@
 #include "Timer.h"
 #include <wtf/CurrentTime.h>
 #include <wtf/MemoryInstrumentationVector.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/Vector.h>
 #include <wtf/text/WTFString.h>
 
@@ -576,21 +577,23 @@
 void BitmapImage::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
+    memoryObjectInfo->setClassName("BitmapImage");
     Image::reportMemoryUsage(memoryObjectInfo);
-    info.addMember(m_source);
+    info.addMember(m_source, "m_source");
     info.addMember(m_frameTimer);
-    info.addMember(m_frames);
+    info.addMember(m_frames, "m_frames");
 }
 
 void FrameData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
+    memoryObjectInfo->setClassName("FrameData");
 #if OS(WINCE) && !PLATFORM(QT)
     info.addRawBuffer(m_frame.get(), m_frameBytes);
 #elif USE(SKIA)
-    info.addMember(m_frame);
+    info.addMember(m_frame, "m_frame");
 #else
-    info.addRawBuffer(m_frame, m_frameBytes);
+    info.addRawBuffer(m_frame, m_frameBytes, "m_frame");
 #endif
 }
 

Modified: trunk/Source/WebCore/platform/graphics/Image.cpp (138004 => 138005)


--- trunk/Source/WebCore/platform/graphics/Image.cpp	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/platform/graphics/Image.cpp	2012-12-18 11:46:05 UTC (rev 138005)
@@ -38,6 +38,7 @@
 #include "SharedBuffer.h"
 #include <math.h>
 #include <wtf/MainThread.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/StdLibExtras.h>
 
 #if USE(CG)
@@ -201,7 +202,8 @@
 void Image::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Image);
-    info.addMember(m_data);
+    memoryObjectInfo->setClassName("Image");
+    info.addMember(m_data, "m_data");
     info.addWeakPointer(m_imageObserver);
 }
 

Modified: trunk/Source/WebCore/platform/graphics/skia/MemoryInstrumentationSkia.cpp (138004 => 138005)


--- trunk/Source/WebCore/platform/graphics/skia/MemoryInstrumentationSkia.cpp	2012-12-18 11:43:35 UTC (rev 138004)
+++ trunk/Source/WebCore/platform/graphics/skia/MemoryInstrumentationSkia.cpp	2012-12-18 11:46:05 UTC (rev 138005)
@@ -36,14 +36,17 @@
 #include "SkCanvas.h"
 #include "SkDevice.h"
 #include "SkPixelRef.h"
+#include <wtf/MemoryObjectInfo.h>
 
 void reportMemoryUsage(const SkBitmap* const& image, WTF::MemoryObjectInfo* memoryObjectInfo)
 {
     WTF::MemoryClassInfo info(memoryObjectInfo, image);
+    memoryObjectInfo->setClassName("SkBitmap");
+
     SkPixelRef* pixelRef = image->pixelRef();
     info.addMember(pixelRef);
     if (pixelRef)
-        info.addRawBuffer(pixelRef->pixels(), image->getSize());
+        info.addRawBuffer(pixelRef->pixels(), image->getSize(), 0, "pixels");
 }
 
 void reportMemoryUsage(const SkDevice* const& device, WTF::MemoryObjectInfo* memoryObjectInfo)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to