Title: [124736] trunk/Source/WebCore
Revision
124736
Author
[email protected]
Date
2012-08-06 00:13:35 -0700 (Mon, 06 Aug 2012)

Log Message

Web Inspector: NMI: replace addString with addMember overload function.
https://bugs.webkit.org/show_bug.cgi?id=93201

Reviewed by Yury Semikhatsky.

It is impossible to implement nice instrumentation for template containers
content when we have different function names for different types.

Drive by: fix the most annoing warning in Element.h detected by our clang plugin.

* css/CSSCharsetRule.cpp:
(WebCore::CSSCharsetRule::reportDescendantMemoryUsage):
* css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::reportMemoryUsage):
* css/MediaQuery.cpp:
(WebCore::MediaQuery::reportMemoryUsage):
* css/MediaQueryExp.cpp:
(WebCore::MediaQueryExp::reportMemoryUsage):
* css/StyleRuleImport.cpp:
(WebCore::StyleRuleImport::reportDescendantMemoryUsage):
* css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::reportMemoryUsage):
* css/WebKitCSSKeyframeRule.cpp:
(WebCore::StyleKeyframe::reportMemoryUsage):
* css/WebKitCSSKeyframesRule.cpp:
(WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
* dom/CharacterData.cpp:
(WebCore::CharacterData::reportMemoryUsage):
* dom/Document.cpp:
(WebCore::Document::reportMemoryUsage):
* dom/Element.h:
(WebCore::Element::reportMemoryUsage):
* dom/ElementAttributeData.cpp:
(WebCore::ElementAttributeData::reportMemoryUsage):
* dom/MemoryInstrumentation.cpp:
(WebCore::MemoryInstrumentation::addObject):
* dom/MemoryInstrumentation.h:
(MemoryInstrumentation):
(WebCore::MemoryClassInfo::addMember):
* dom/QualifiedName.h:
(WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
* loader/DocumentLoader.cpp:
(WebCore::DocumentLoader::reportMemoryUsage):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::reportMemoryUsage):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::reportMemoryUsage):
* rendering/style/StyleRareNonInheritedData.cpp:
(WebCore::StyleRareNonInheritedData::reportMemoryUsage):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (124735 => 124736)


--- trunk/Source/WebCore/ChangeLog	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/ChangeLog	2012-08-06 07:13:35 UTC (rev 124736)
@@ -1,3 +1,55 @@
+2012-08-06  Ilya Tikhonovsky  <[email protected]>
+
+        Web Inspector: NMI: replace addString with addMember overload function.
+        https://bugs.webkit.org/show_bug.cgi?id=93201
+
+        Reviewed by Yury Semikhatsky.
+
+        It is impossible to implement nice instrumentation for template containers
+        content when we have different function names for different types.
+
+        Drive by: fix the most annoing warning in Element.h detected by our clang plugin.
+
+        * css/CSSCharsetRule.cpp:
+        (WebCore::CSSCharsetRule::reportDescendantMemoryUsage):
+        * css/CSSStyleSheet.cpp:
+        (WebCore::CSSStyleSheet::reportMemoryUsage):
+        * css/MediaQuery.cpp:
+        (WebCore::MediaQuery::reportMemoryUsage):
+        * css/MediaQueryExp.cpp:
+        (WebCore::MediaQueryExp::reportMemoryUsage):
+        * css/StyleRuleImport.cpp:
+        (WebCore::StyleRuleImport::reportDescendantMemoryUsage):
+        * css/StyleSheetContents.cpp:
+        (WebCore::StyleSheetContents::reportMemoryUsage):
+        * css/WebKitCSSKeyframeRule.cpp:
+        (WebCore::StyleKeyframe::reportMemoryUsage):
+        * css/WebKitCSSKeyframesRule.cpp:
+        (WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
+        * dom/CharacterData.cpp:
+        (WebCore::CharacterData::reportMemoryUsage):
+        * dom/Document.cpp:
+        (WebCore::Document::reportMemoryUsage):
+        * dom/Element.h:
+        (WebCore::Element::reportMemoryUsage):
+        * dom/ElementAttributeData.cpp:
+        (WebCore::ElementAttributeData::reportMemoryUsage):
+        * dom/MemoryInstrumentation.cpp:
+        (WebCore::MemoryInstrumentation::addObject):
+        * dom/MemoryInstrumentation.h:
+        (MemoryInstrumentation):
+        (WebCore::MemoryClassInfo::addMember):
+        * dom/QualifiedName.h:
+        (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
+        * loader/DocumentLoader.cpp:
+        (WebCore::DocumentLoader::reportMemoryUsage):
+        * loader/FrameLoader.cpp:
+        (WebCore::FrameLoader::reportMemoryUsage):
+        * rendering/style/StyleRareInheritedData.cpp:
+        (WebCore::StyleRareInheritedData::reportMemoryUsage):
+        * rendering/style/StyleRareNonInheritedData.cpp:
+        (WebCore::StyleRareNonInheritedData::reportMemoryUsage):
+
 2012-08-05  Kent Tamura  <[email protected]>
 
         [Chromium-win] Use system locale for number representation

Modified: trunk/Source/WebCore/css/CSSCharsetRule.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/CSSCharsetRule.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/CSSCharsetRule.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -40,7 +40,7 @@
 {
     MemoryClassInfo<CSSCharsetRule> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
-    info.addString(m_encoding);
+    info.addMember(m_encoding);
 }
 
 } // namespace WebCore

Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/CSSStyleSheet.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -179,7 +179,7 @@
 {
     MemoryClassInfo<CSSStyleSheet> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     info.addInstrumentedMember(m_contents);
-    info.addString(m_title);
+    info.addMember(m_title);
     info.addInstrumentedMember(m_mediaQueries);
     info.addInstrumentedMember(m_ownerNode);
     info.addInstrumentedMember(m_ownerRule);

Modified: trunk/Source/WebCore/css/MediaQuery.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/MediaQuery.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/MediaQuery.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -137,9 +137,9 @@
 void MediaQuery::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<MediaQuery> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
-    info.addString(m_mediaType);
+    info.addMember(m_mediaType);
     info.addInstrumentedVectorPtr(m_expressions);
-    info.addString(m_serializationCache);
+    info.addMember(m_serializationCache);
 }
 
 } //namespace

Modified: trunk/Source/WebCore/css/MediaQueryExp.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/MediaQueryExp.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/MediaQueryExp.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -112,8 +112,8 @@
 void MediaQueryExp::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<MediaQueryExp> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
-    info.addString(m_mediaFeature);
-    info.addString(m_serializationCache);
+    info.addMember(m_mediaFeature);
+    info.addMember(m_serializationCache);
 }
 
 } // namespace

Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/StyleRuleImport.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -131,7 +131,7 @@
 void StyleRuleImport::reportDescendantMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<StyleRuleImport> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
-    info.addString(m_strHref);
+    info.addMember(m_strHref);
     info.addInstrumentedMember(m_mediaQueries);
     info.addInstrumentedMember(m_styleSheet);
 }

Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/StyleSheetContents.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -485,8 +485,8 @@
 void StyleSheetContents::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
 {
     MemoryClassInfo<StyleSheetContents> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
-    info.addString(m_originalURL);
-    info.addString(m_encodingFromCharsetRule);
+    info.addMember(m_originalURL);
+    info.addMember(m_encodingFromCharsetRule);
     info.addVector(m_importRules);
     info.addInstrumentedVector(m_childRules);
     info.addHashMap(m_namespaces);

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -90,7 +90,7 @@
 {
     MemoryClassInfo<StyleKeyframe> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     info.addInstrumentedMember(m_properties);
-    info.addString(m_key);
+    info.addMember(m_key);
 }
 
 WebKitCSSKeyframeRule::WebKitCSSKeyframeRule(StyleKeyframe* keyframe, WebKitCSSKeyframesRule* parent)

Modified: trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp (124735 => 124736)


--- trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -91,7 +91,7 @@
 {
     MemoryClassInfo<StyleRuleKeyframes> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     info.addInstrumentedVector(m_keyframes);
-    info.addString(m_name);
+    info.addMember(m_name);
 }
 
 WebKitCSSKeyframesRule::WebKitCSSKeyframesRule(StyleRuleKeyframes* keyframesRule, CSSStyleSheet* parent)

Modified: trunk/Source/WebCore/dom/CharacterData.cpp (124735 => 124736)


--- trunk/Source/WebCore/dom/CharacterData.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/CharacterData.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -96,7 +96,7 @@
 {
     MemoryClassInfo<CharacterData> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
     Node::reportMemoryUsage(memoryObjectInfo);
-    info.addString(m_data);
+    info.addMember(m_data);
 }
 
 void CharacterData::appendData(const String& data, ExceptionCode&)

Modified: trunk/Source/WebCore/dom/Document.cpp (124735 => 124736)


--- trunk/Source/WebCore/dom/Document.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/Document.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -6093,8 +6093,8 @@
     info.addInstrumentedMember(m_styleResolver);
     ContainerNode::reportMemoryUsage(memoryObjectInfo);
     info.addVector(m_customFonts);
-    info.addString(m_documentURI);
-    info.addString(m_baseTarget);
+    info.addMember(m_documentURI);
+    info.addMember(m_baseTarget);
     info.addInstrumentedMember(m_elemSheet);
     info.addInstrumentedMember(m_pageUserSheet);
     if (m_pageGroupUserSheets)
@@ -6104,13 +6104,13 @@
     info.addHashSet(m_nodeIterators);
     info.addHashSet(m_ranges);
     info.addListHashSet(m_styleSheetCandidateNodes);
-    info.addString(m_preferredStylesheetSet);
-    info.addString(m_selectedStylesheetSet);
-    info.addString(m_title.string());
-    info.addString(m_rawTitle.string());
-    info.addString(m_xmlEncoding);
-    info.addString(m_xmlVersion);
-    info.addString(m_contentLanguage);
+    info.addMember(m_preferredStylesheetSet);
+    info.addMember(m_selectedStylesheetSet);
+    info.addMember(m_title.string());
+    info.addMember(m_rawTitle.string());
+    info.addMember(m_xmlEncoding);
+    info.addMember(m_xmlVersion);
+    info.addMember(m_contentLanguage);
     info.addHashMap(m_documentNamedItemCollections);
     info.addHashMap(m_windowNamedItemCollections);
 #if ENABLE(DASHBOARD_SUPPORT)

Modified: trunk/Source/WebCore/dom/Element.h (124735 => 124736)


--- trunk/Source/WebCore/dom/Element.h	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/Element.h	2012-08-06 07:13:35 UTC (rev 124736)
@@ -439,7 +439,7 @@
         MemoryClassInfo<Element> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
         ContainerNode::reportMemoryUsage(memoryObjectInfo);
         info.addInstrumentedMember(m_tagName);
-        info.addInstrumentedMember(attributeData());
+        info.addInstrumentedMember(m_attributeData);
     }
 
 #if ENABLE(UNDO_MANAGER)

Modified: trunk/Source/WebCore/dom/ElementAttributeData.cpp (124735 => 124736)


--- trunk/Source/WebCore/dom/ElementAttributeData.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/ElementAttributeData.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -290,7 +290,7 @@
     info.addInstrumentedMember(m_inlineStyleDecl);
     info.addInstrumentedMember(m_attributeStyle);
     info.addMember(m_classNames);
-    info.addString(m_idForStyleResolution);
+    info.addMember(m_idForStyleResolution);
     if (m_isMutable)
         info.addVectorPtr(m_mutableAttributeVector);
     else

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.cpp (124735 => 124736)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -36,7 +36,7 @@
 
 namespace WebCore {
 
-void MemoryInstrumentation::addString(const String& string, ObjectType objectType)
+void MemoryInstrumentation::addObject(const String& string, ObjectType objectType)
 {
     if (string.isNull() || visited(string.impl()))
         return;

Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (124735 => 124736)


--- trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h	2012-08-06 07:13:35 UTC (rev 124736)
@@ -91,7 +91,7 @@
     {
         OwningTraits<T>::addObject(this, t, ownerObjectType);
     }
-    void addString(const String&, ObjectType);
+    void addObject(const String&, ObjectType);
     template <typename T> void addInstrumentedObject(const T& t, ObjectType ownerObjectType) { OwningTraits<T>::addInstrumentedObject(this, t, ownerObjectType); }
 
     template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
@@ -189,8 +189,8 @@
     template <typename VectorType> void addVectorPtr(const VectorType* const vector) { m_memoryInstrumentation->addVector(*vector, m_objectType, false); }
     void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
 
-    void addString(const String& string) { m_memoryInstrumentation->addString(string, m_objectType); }
-    void addString(const AtomicString& string) { m_memoryInstrumentation->addString((const String&)string, m_objectType); }
+    void addMember(const String& string) { m_memoryInstrumentation->addObject(string, m_objectType); }
+    void addMember(const AtomicString& string) { m_memoryInstrumentation->addObject((const String&)string, m_objectType); }
 
 private:
     MemoryObjectInfo* m_memoryObjectInfo;
@@ -259,10 +259,6 @@
     addObjectImpl(object->get(), ownerObjectType, byPointer);
 }
 
-// Link time guard for string members. They produce link error is a string is reported via addObject.
-template <> void MemoryInstrumentation::addObjectImpl<AtomicString>(const AtomicString* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType);
-template <> void MemoryInstrumentation::addObjectImpl<String>(const String* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType);
-
 template <typename T>
 void MemoryInstrumentation::addObjectImpl(const T* const& object, ObjectType ownerObjectType, OwningType owningType)
 {

Modified: trunk/Source/WebCore/dom/QualifiedName.h (124735 => 124736)


--- trunk/Source/WebCore/dom/QualifiedName.h	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/dom/QualifiedName.h	2012-08-06 07:13:35 UTC (rev 124736)
@@ -53,10 +53,10 @@
         void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
         {
             MemoryClassInfo<QualifiedNameImpl> info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
-            info.addString(m_prefix);
-            info.addString(m_localName);
-            info.addString(m_namespace);
-            info.addString(m_localNameUpper);
+            info.addMember(m_prefix);
+            info.addMember(m_localName);
+            info.addMember(m_namespace);
+            info.addMember(m_localNameUpper);
         }
     private:
         QualifiedNameImpl(const AtomicString& prefix, const AtomicString& localName, const AtomicString& namespaceURI)

Modified: trunk/Source/WebCore/loader/DocumentLoader.cpp (124735 => 124736)


--- trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/loader/DocumentLoader.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -363,13 +363,13 @@
     info.addInstrumentedHashSet(m_subresourceLoaders);
     info.addInstrumentedHashSet(m_multipartSubresourceLoaders);
     info.addInstrumentedHashSet(m_plugInStreamLoaders);
-    info.addString(m_pageTitle.string());
-    info.addString(m_overrideEncoding);
+    info.addMember(m_pageTitle.string());
+    info.addMember(m_overrideEncoding);
     info.addVector(m_responses);
     info.addHashMap(m_pendingSubstituteResources);
     info.addHashSet(m_resourcesClientKnowsAbout);
     info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification);
-    info.addString(m_clientRedirectSourceForHistory);
+    info.addMember(m_clientRedirectSourceForHistory);
     info.addInstrumentedMember(m_mainResourceData);
 }
 

Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (124735 => 124736)


--- trunk/Source/WebCore/loader/FrameLoader.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -3229,7 +3229,7 @@
     info.addInstrumentedMember(m_documentLoader.get());
     info.addInstrumentedMember(m_provisionalDocumentLoader.get());
     info.addInstrumentedMember(m_policyDocumentLoader.get());
-    info.addString(m_outgoingReferrer);
+    info.addMember(m_outgoingReferrer);
     info.addInstrumentedHashSet(m_openedFrames);
 }
 

Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (124735 => 124736)


--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -266,13 +266,13 @@
 {
     MemoryClassInfo<StyleRareInheritedData> info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
     info.addMember(textShadow);
-    info.addString(highlight);
+    info.addMember(highlight);
     info.addMember(cursorData);
-    info.addString(hyphenationString);
-    info.addString(locale);
-    info.addString(textEmphasisCustomMark);
+    info.addMember(hyphenationString);
+    info.addMember(locale);
+    info.addMember(textEmphasisCustomMark);
     info.addMember(quotes);
-    info.addString(m_lineGrid);
+    info.addMember(m_lineGrid);
 #if ENABLE(CSS_VARIABLES)
     info.addMember(m_variables);
 #endif

Modified: trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp (124735 => 124736)


--- trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2012-08-06 06:39:49 UTC (rev 124735)
+++ trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp	2012-08-06 07:13:35 UTC (rev 124736)
@@ -311,8 +311,8 @@
     info.addMember(m_transitions);
     info.addMember(m_wrapShapeInside);
     info.addMember(m_wrapShapeOutside);
-    info.addString(m_flowThread);
-    info.addString(m_regionThread);
+    info.addMember(m_flowThread);
+    info.addMember(m_regionThread);
 }
 
 } // namespace WebCore
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to