Title: [110128] trunk/Source/WebCore
Revision
110128
Author
caio.olive...@openbossa.org
Date
2012-03-07 18:22:05 -0800 (Wed, 07 Mar 2012)

Log Message

Make Node::dumpStatistics() work again
https://bugs.webkit.org/show_bug.cgi?id=80327

Reviewed by Ryosuke Niwa.

Update the code in dumpStatistics() to the latest attribute storage changes. Also
move the DUMP_NODE_STATISTICS define here from the Node.cpp, since its also used
by Document.h.

* dom/Node.cpp:
(WebCore::Node::dumpStatistics): Use more self-describing variable names.
* dom/Node.h:

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (110127 => 110128)


--- trunk/Source/WebCore/ChangeLog	2012-03-08 02:14:38 UTC (rev 110127)
+++ trunk/Source/WebCore/ChangeLog	2012-03-08 02:22:05 UTC (rev 110128)
@@ -1,3 +1,18 @@
+2012-03-05  Caio Marcelo de Oliveira Filho  <caio.olive...@openbossa.org>
+
+        Make Node::dumpStatistics() work again
+        https://bugs.webkit.org/show_bug.cgi?id=80327
+
+        Reviewed by Ryosuke Niwa.
+
+        Update the code in dumpStatistics() to the latest attribute storage changes. Also
+        move the DUMP_NODE_STATISTICS define here from the Node.cpp, since its also used
+        by Document.h.
+
+        * dom/Node.cpp:
+        (WebCore::Node::dumpStatistics): Use more self-describing variable names.
+        * dom/Node.h:
+
 2012-03-07  Mike Lawther  <mikelawt...@chromium.org>
 
         CSS3 calc: mixed absolute/percentages work for width, height, margin and padding

Modified: trunk/Source/WebCore/dom/Node.cpp (110127 => 110128)


--- trunk/Source/WebCore/dom/Node.cpp	2012-03-08 02:14:38 UTC (rev 110127)
+++ trunk/Source/WebCore/dom/Node.cpp	2012-03-08 02:22:05 UTC (rev 110128)
@@ -120,8 +120,6 @@
 #include "HTMLPropertiesCollection.h"
 #endif
 
-#define DUMP_NODE_STATISTICS 0
-
 using namespace std;
 
 namespace WebCore {
@@ -161,7 +159,8 @@
 
     size_t attributes = 0;
     size_t attributesWithAttr = 0;
-    size_t attrMaps = 0;
+    size_t elementsWithAttributeStorage = 0;
+    size_t elementsWithNamedNodeMap = 0;
 
     for (HashSet<Node*>::iterator it = liveNodeSet.begin(); it != liveNodeSet.end(); ++it) {
         Node* node = *it;
@@ -179,12 +178,13 @@
                 if (!result.second)
                     result.first->second++;
 
-                // AttributeMap stats
-                if (NamedNodeMap* attrMap = element->attributes(true)) {
-                    attributes += attrMap->length();
-                    ++attrMaps;
-                    for (unsigned i = 0; i < attrMap->length(); ++i) {
-                        Attribute* attr = attrMap->attributeItem(i);
+                if (ElementAttributeData* attributeData = element->attributeData()) {
+                    attributes += attributeData->length();
+                    ++elementsWithAttributeStorage;
+                    // FIXME: This will change once attribute storage goes out of NamedNodeMap.
+                    ++elementsWithNamedNodeMap;
+                    for (unsigned i = 0; i < attributeData->length(); ++i) {
+                        Attribute* attr = attributeData->attributeItem(i);
                         if (attr->attr())
                             ++attributesWithAttr;
                     }
@@ -248,7 +248,7 @@
     printf("Number of Nodes: %d\n\n", liveNodeSet.size());
     printf("Number of Nodes with RareData: %zu\n\n", nodesWithRareData);
 
-    printf("NodeType distrubution:\n");
+    printf("NodeType distribution:\n");
     printf("  Number of Element nodes: %zu\n", elementNodes);
     printf("  Number of Attribute nodes: %zu\n", attrNodes);
     printf("  Number of Text nodes: %zu\n", textNodes);
@@ -268,10 +268,11 @@
     for (HashMap<String, size_t>::iterator it = perTagCount.begin(); it != perTagCount.end(); ++it)
         printf("  Number of <%s> tags: %zu\n", it->first.utf8().data(), it->second);
 
-    printf("Attribute Maps:\n");
+    printf("Attributes:\n");
     printf("  Number of Attributes (non-Node and Node): %zu [%zu]\n", attributes, sizeof(Attribute));
     printf("  Number of Attributes with an Attr: %zu\n", attributesWithAttr);
-    printf("  Number of NamedNodeMaps: %zu [%zu]\n", attrMaps, sizeof(NamedNodeMap));
+    printf("  Number of Elements with attribute storage: %zu [%zu]\n", elementsWithAttributeStorage, sizeof(ElementAttributeData));
+    printf("  Number of Elements with NamedNodeMap: %zu [%zu]\n", elementsWithNamedNodeMap, sizeof(NamedNodeMap));
 #endif
 }
 

Modified: trunk/Source/WebCore/dom/Node.h (110127 => 110128)


--- trunk/Source/WebCore/dom/Node.h	2012-03-08 02:14:38 UTC (rev 110127)
+++ trunk/Source/WebCore/dom/Node.h	2012-03-08 02:22:05 UTC (rev 110128)
@@ -44,6 +44,9 @@
 }
 #endif
 
+// This needs to be here because Document.h also depends on it.
+#define DUMP_NODE_STATISTICS 0
+
 namespace WebCore {
 
 class Attribute;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to