Title: [122735] trunk/Source/WebCore
Revision
122735
Author
[email protected]
Date
2012-07-16 09:23:59 -0700 (Mon, 16 Jul 2012)

Log Message

Web Inspector: native memory: fix instrumentation for string members
https://bugs.webkit.org/show_bug.cgi?id=91384

Reviewed by Pavel Feldman.

It was possible to report a string member via addMember instead of addString.
This patch is fixing the problem and adding a link time guard.

Covered by existing inspector performance tests infrastructure.

* dom/ElementAttributeData.h:
(WebCore::ElementAttributeData::reportMemoryUsage):
* dom/MemoryInstrumentation.h:
(WebCore):
(WebCore::MemoryClassInfo::addString):
* dom/QualifiedName.h:
(WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (122734 => 122735)


--- trunk/Source/WebCore/ChangeLog	2012-07-16 16:16:03 UTC (rev 122734)
+++ trunk/Source/WebCore/ChangeLog	2012-07-16 16:23:59 UTC (rev 122735)
@@ -1,3 +1,23 @@
+2012-07-16  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: native memory: fix instrumentation for string members
+        https://bugs.webkit.org/show_bug.cgi?id=91384
+
+        Reviewed by Pavel Feldman.
+
+        It was possible to report a string member via addMember instead of addString.
+        This patch is fixing the problem and adding a link time guard.
+
+        Covered by existing inspector performance tests infrastructure.
+
+        * dom/ElementAttributeData.h:
+        (WebCore::ElementAttributeData::reportMemoryUsage):
+        * dom/MemoryInstrumentation.h:
+        (WebCore):
+        (WebCore::MemoryClassInfo::addString):
+        * dom/QualifiedName.h:
+        (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
+
 2012-07-16  Zoltan Horvath  <[email protected]>
 
         Unreviewed. Remove unnecessary executable bits after r122720.

Modified: trunk/Source/WebCore/dom/ElementAttributeData.h (122734 => 122735)


--- trunk/Source/WebCore/dom/ElementAttributeData.h	2012-07-16 16:16:03 UTC (rev 122734)
+++ trunk/Source/WebCore/dom/ElementAttributeData.h	2012-07-16 16:23:59 UTC (rev 122735)
@@ -106,7 +106,7 @@
         info.addInstrumentedMember(m_inlineStyleDecl.get());
         info.addInstrumentedMember(m_attributeStyle.get());
         info.addMember(m_classNames);
-        info.addMember(m_idForStyleResolution);
+        info.addString(m_idForStyleResolution);
         info.addVector(m_attributes);
     }
 

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (122734 => 122735)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-07-16 16:16:03 UTC (rev 122734)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-07-16 16:23:59 UTC (rev 122735)
@@ -31,6 +31,7 @@
 #ifndef MemoryInstrumentation_h
 #define MemoryInstrumentation_h
 
+#include <wtf/Assertions.h>
 #include <wtf/Forward.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
@@ -159,6 +160,10 @@
     size_t m_objectSize;
 };
 
+// Link time guard for string members. They produce link error is a string is reported via addMember.
+template <> void MemoryInstrumentation::addMemberImpl<AtomicString>(const AtomicString* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType);
+template <> void MemoryInstrumentation::addMemberImpl<String>(const String* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType);
+
 template <typename T>
 void MemoryInstrumentation::addInstrumentedMemberImpl(const T* const& object, MemoryInstrumentation::OwningType owningType)
 {
@@ -193,6 +198,7 @@
     template <typename VectorType> void addVector(const VectorType& vector) { m_memoryInstrumentation->addVector(vector, m_objectType, true); }
 
     void addString(const String& string) { m_memoryInstrumentation->addString(string, m_objectType); }
+    void addString(const AtomicString& string) { m_memoryInstrumentation->addString((const String&)string, m_objectType); }
 
 private:
     MemoryObjectInfo* m_memoryObjectInfo;

Modified: trunk/Source/WebCore/dom/QualifiedName.h (122734 => 122735)


--- trunk/Source/WebCore/dom/QualifiedName.h	2012-07-16 16:16:03 UTC (rev 122734)
+++ trunk/Source/WebCore/dom/QualifiedName.h	2012-07-16 16:23:59 UTC (rev 122735)
@@ -53,10 +53,10 @@
         void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
         {
             MemoryClassInfo<QualifiedNameImpl> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-            info.addMember(m_prefix);
-            info.addMember(m_localName);
-            info.addMember(m_namespace);
-            info.addMember(m_localNameUpper);
+            info.addString(m_prefix);
+            info.addString(m_localName);
+            info.addString(m_namespace);
+            info.addString(m_localNameUpper);
         }
     private:
         QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI)
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to