Changeset 126154 in webkit


Ignore:
Timestamp:
Aug 21, 2012, 6:41:00 AM (13 years ago)
Author:
loislo@chromium.org
Message:

Web Inspector: NMI: rename addMember for strings and KURL to addInstrumentedMember.
https://bugs.webkit.org/show_bug.cgi?id=94580

Reviewed by Yury Semikhatsky.

Drive by fix: immutable ElementAttrybuteData uses the same trick with placement new as in StylePropertySet.

Source/WebCore:

  • css/CSSCanvasValue.cpp:

(WebCore::CSSCanvasValue::reportDescendantMemoryUsage):

  • css/CSSCharsetRule.cpp:

(WebCore::CSSCharsetRule::reportDescendantMemoryUsage):

  • css/CSSFontFaceSrcValue.cpp:

(WebCore::CSSFontFaceSrcValue::reportDescendantMemoryUsage):

  • css/CSSFunctionValue.cpp:

(WebCore::CSSFunctionValue::reportDescendantMemoryUsage):

  • css/CSSImageSetValue.cpp:

(WebCore::CSSImageSetValue::ImageWithScale::reportMemoryUsage):

  • css/CSSImageValue.cpp:

(WebCore::CSSImageValue::reportDescendantMemoryUsage):

  • css/CSSPrimitiveValue.cpp:

(WebCore::CSSPrimitiveValue::reportDescendantMemoryUsage):

  • css/CSSStyleSheet.cpp:

(WebCore::CSSStyleSheet::reportMemoryUsage):

  • css/CSSValue.cpp:

(WebCore::TextCloneCSSValue::reportDescendantMemoryUsage):

  • css/CSSVariableValue.h:

(WebCore::CSSVariableValue::reportDescendantMemoryUsage):

  • css/FontFeatureValue.cpp:

(WebCore::FontFeatureValue::reportDescendantMemoryUsage):

  • 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):

  • css/WebKitCSSSVGDocumentValue.cpp:

(WebCore::WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage):

  • css/WebKitCSSShaderValue.cpp:

(WebCore::WebKitCSSShaderValue::reportDescendantMemoryUsage):

  • dom/Attribute.h:

(WebCore::Attribute::reportMemoryUsage):

  • dom/CharacterData.cpp:

(WebCore::CharacterData::reportMemoryUsage):

  • dom/Document.cpp:

(WebCore::Document::reportMemoryUsage):

  • dom/ElementAttributeData.cpp:

(WebCore::immutableElementAttributeDataSize):
(WebCore):
(WebCore::ElementAttributeData::createImmutable):
(WebCore::ElementAttributeData::reportMemoryUsage):

  • dom/Event.cpp:

(WebCore::Event::reportMemoryUsage):

  • dom/MemoryInstrumentation.cpp:

(WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):

  • dom/MemoryInstrumentation.h:

(MemoryInstrumentation):

  • dom/QualifiedName.h:

(WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):

  • loader/DocumentLoader.cpp:

(WebCore::DocumentLoader::reportMemoryUsage):

  • loader/FrameLoader.cpp:

(WebCore::FrameLoader::reportMemoryUsage):

  • loader/SubstituteData.cpp:

(WebCore::SubstituteData::reportMemoryUsage):

  • loader/cache/CachedCSSStyleSheet.cpp:

(WebCore::CachedCSSStyleSheet::reportMemoryUsage):

  • loader/cache/CachedResource.cpp:

(WebCore::CachedResource::reportMemoryUsage):

  • loader/cache/CachedResourceLoader.cpp:

(WebCore::CachedResourceLoader::reportMemoryUsage):

  • loader/cache/CachedScript.cpp:

(WebCore::CachedScript::reportMemoryUsage):

  • loader/cache/CachedShader.cpp:

(WebCore::CachedShader::reportMemoryUsage):

  • loader/cache/CachedXSLStyleSheet.cpp:

(WebCore::CachedXSLStyleSheet::reportMemoryUsage):

  • loader/cache/MemoryCache.cpp:

(WebCore::MemoryCache::reportMemoryUsage):

  • platform/network/ResourceRequestBase.cpp:

(WebCore::ResourceRequestBase::reportMemoryUsage):

  • platform/network/ResourceResponseBase.cpp:

(WebCore::ResourceResponseBase::reportMemoryUsage):

  • rendering/style/StyleRareInheritedData.cpp:

(WebCore::StyleRareInheritedData::reportMemoryUsage):

  • rendering/style/StyleRareNonInheritedData.cpp:

(WebCore::StyleRareNonInheritedData::reportMemoryUsage):

  • svg/SVGPaint.cpp:

(WebCore::SVGPaint::reportDescendantMemoryUsage):

Source/WebKit/chromium:

  • tests/MemoryInstrumentationTest.cpp:

(WebCore::TEST):
(WebCore):

Location:
trunk/Source
Files:
45 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r126150 r126154  
     12012-08-21  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: NMI: rename addMember for strings and KURL to addInstrumentedMember.
     4        https://bugs.webkit.org/show_bug.cgi?id=94580
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Drive by fix: immutable ElementAttrybuteData uses the same trick with placement new as in StylePropertySet.
     9
     10        * css/CSSCanvasValue.cpp:
     11        (WebCore::CSSCanvasValue::reportDescendantMemoryUsage):
     12        * css/CSSCharsetRule.cpp:
     13        (WebCore::CSSCharsetRule::reportDescendantMemoryUsage):
     14        * css/CSSFontFaceSrcValue.cpp:
     15        (WebCore::CSSFontFaceSrcValue::reportDescendantMemoryUsage):
     16        * css/CSSFunctionValue.cpp:
     17        (WebCore::CSSFunctionValue::reportDescendantMemoryUsage):
     18        * css/CSSImageSetValue.cpp:
     19        (WebCore::CSSImageSetValue::ImageWithScale::reportMemoryUsage):
     20        * css/CSSImageValue.cpp:
     21        (WebCore::CSSImageValue::reportDescendantMemoryUsage):
     22        * css/CSSPrimitiveValue.cpp:
     23        (WebCore::CSSPrimitiveValue::reportDescendantMemoryUsage):
     24        * css/CSSStyleSheet.cpp:
     25        (WebCore::CSSStyleSheet::reportMemoryUsage):
     26        * css/CSSValue.cpp:
     27        (WebCore::TextCloneCSSValue::reportDescendantMemoryUsage):
     28        * css/CSSVariableValue.h:
     29        (WebCore::CSSVariableValue::reportDescendantMemoryUsage):
     30        * css/FontFeatureValue.cpp:
     31        (WebCore::FontFeatureValue::reportDescendantMemoryUsage):
     32        * css/MediaQuery.cpp:
     33        (WebCore::MediaQuery::reportMemoryUsage):
     34        * css/MediaQueryExp.cpp:
     35        (WebCore::MediaQueryExp::reportMemoryUsage):
     36        * css/StyleRuleImport.cpp:
     37        (WebCore::StyleRuleImport::reportDescendantMemoryUsage):
     38        * css/StyleSheetContents.cpp:
     39        (WebCore::StyleSheetContents::reportMemoryUsage):
     40        * css/WebKitCSSKeyframeRule.cpp:
     41        (WebCore::StyleKeyframe::reportMemoryUsage):
     42        * css/WebKitCSSKeyframesRule.cpp:
     43        (WebCore::StyleRuleKeyframes::reportDescendantMemoryUsage):
     44        * css/WebKitCSSSVGDocumentValue.cpp:
     45        (WebCore::WebKitCSSSVGDocumentValue::reportDescendantMemoryUsage):
     46        * css/WebKitCSSShaderValue.cpp:
     47        (WebCore::WebKitCSSShaderValue::reportDescendantMemoryUsage):
     48        * dom/Attribute.h:
     49        (WebCore::Attribute::reportMemoryUsage):
     50        * dom/CharacterData.cpp:
     51        (WebCore::CharacterData::reportMemoryUsage):
     52        * dom/Document.cpp:
     53        (WebCore::Document::reportMemoryUsage):
     54        * dom/ElementAttributeData.cpp:
     55        (WebCore::immutableElementAttributeDataSize):
     56        (WebCore):
     57        (WebCore::ElementAttributeData::createImmutable):
     58        (WebCore::ElementAttributeData::reportMemoryUsage):
     59        * dom/Event.cpp:
     60        (WebCore::Event::reportMemoryUsage):
     61        * dom/MemoryInstrumentation.cpp:
     62        (WebCore::MemoryInstrumentation::addInstrumentedObjectImpl):
     63        * dom/MemoryInstrumentation.h:
     64        (MemoryInstrumentation):
     65        * dom/QualifiedName.h:
     66        (WebCore::QualifiedName::QualifiedNameImpl::reportMemoryUsage):
     67        * loader/DocumentLoader.cpp:
     68        (WebCore::DocumentLoader::reportMemoryUsage):
     69        * loader/FrameLoader.cpp:
     70        (WebCore::FrameLoader::reportMemoryUsage):
     71        * loader/SubstituteData.cpp:
     72        (WebCore::SubstituteData::reportMemoryUsage):
     73        * loader/cache/CachedCSSStyleSheet.cpp:
     74        (WebCore::CachedCSSStyleSheet::reportMemoryUsage):
     75        * loader/cache/CachedResource.cpp:
     76        (WebCore::CachedResource::reportMemoryUsage):
     77        * loader/cache/CachedResourceLoader.cpp:
     78        (WebCore::CachedResourceLoader::reportMemoryUsage):
     79        * loader/cache/CachedScript.cpp:
     80        (WebCore::CachedScript::reportMemoryUsage):
     81        * loader/cache/CachedShader.cpp:
     82        (WebCore::CachedShader::reportMemoryUsage):
     83        * loader/cache/CachedXSLStyleSheet.cpp:
     84        (WebCore::CachedXSLStyleSheet::reportMemoryUsage):
     85        * loader/cache/MemoryCache.cpp:
     86        (WebCore::MemoryCache::reportMemoryUsage):
     87        * platform/network/ResourceRequestBase.cpp:
     88        (WebCore::ResourceRequestBase::reportMemoryUsage):
     89        * platform/network/ResourceResponseBase.cpp:
     90        (WebCore::ResourceResponseBase::reportMemoryUsage):
     91        * rendering/style/StyleRareInheritedData.cpp:
     92        (WebCore::StyleRareInheritedData::reportMemoryUsage):
     93        * rendering/style/StyleRareNonInheritedData.cpp:
     94        (WebCore::StyleRareNonInheritedData::reportMemoryUsage):
     95        * svg/SVGPaint.cpp:
     96        (WebCore::SVGPaint::reportDescendantMemoryUsage):
     97
    1982012-08-20  Kentaro Hara  <haraken@chromium.org>
    299
  • trunk/Source/WebCore/css/CSSCanvasValue.cpp

    r124884 r126154  
    9898    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    9999    CSSImageGeneratorValue::reportBaseClassMemoryUsage(memoryObjectInfo);
    100     info.addMember(m_name);
     100    info.addInstrumentedMember(m_name);
    101101    info.addInstrumentedMember(m_element);
    102102}
  • trunk/Source/WebCore/css/CSSCharsetRule.cpp

    r124884 r126154  
    4141    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    4242    CSSRule::reportBaseClassMemoryUsage(memoryObjectInfo);
    43     info.addMember(m_encoding);
     43    info.addInstrumentedMember(m_encoding);
    4444}
    4545
  • trunk/Source/WebCore/css/CSSFontFaceSrcValue.cpp

    r124884 r126154  
    101101{
    102102    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    103     info.addMember(m_resource);
    104     info.addMember(m_format);
     103    info.addInstrumentedMember(m_resource);
     104    info.addInstrumentedMember(m_format);
    105105    // FIXME: add m_cachedFont when MemoryCache is instrumented.
    106106#if ENABLE(SVG_FONTS)
  • trunk/Source/WebCore/css/CSSFunctionValue.cpp

    r124884 r126154  
    5454{
    5555    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    56     info.addMember(m_name);
     56    info.addInstrumentedMember(m_name);
    5757    info.addInstrumentedMember(m_args);
    5858}
  • trunk/Source/WebCore/css/CSSImageSetValue.cpp

    r125051 r126154  
    175175{
    176176    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    177     info.addMember(imageURL);
     177    info.addInstrumentedMember(imageURL);
    178178}
    179179
  • trunk/Source/WebCore/css/CSSImageValue.cpp

    r124884 r126154  
    130130{
    131131    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    132     info.addMember(m_url);
     132    info.addInstrumentedMember(m_url);
    133133    // No need to report m_image as it is counted as part of RenderArena.
    134134}
  • trunk/Source/WebCore/css/CSSPrimitiveValue.cpp

    r125990 r126154  
    12531253#endif
    12541254        // FIXME: detect other cases when m_value is StringImpl*
    1255         info.addMember(m_value.string);
     1255        info.addInstrumentedMember(m_value.string);
    12561256        break;
    12571257    case CSS_COUNTER:
  • trunk/Source/WebCore/css/CSSStyleSheet.cpp

    r125805 r126154  
    182182    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    183183    info.addInstrumentedMember(m_contents);
    184     info.addMember(m_title);
     184    info.addInstrumentedMember(m_title);
    185185    info.addInstrumentedMember(m_mediaQueries);
    186186    info.addInstrumentedMember(m_ownerNode);
  • trunk/Source/WebCore/css/CSSValue.cpp

    r124884 r126154  
    8383    {
    8484        MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    85         info.addMember(m_cssText);
     85        info.addInstrumentedMember(m_cssText);
    8686    }
    8787
  • trunk/Source/WebCore/css/CSSVariableValue.h

    r124884 r126154  
    5252    {
    5353        MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    54         info.addMember(m_name);
    55         info.addMember(m_value);
     54        info.addInstrumentedMember(m_name);
     55        info.addInstrumentedMember(m_value);
    5656    }
    5757
  • trunk/Source/WebCore/css/FontFeatureValue.cpp

    r124884 r126154  
    5454{
    5555    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    56     info.addMember(m_tag);
     56    info.addInstrumentedMember(m_tag);
    5757}
    5858
  • trunk/Source/WebCore/css/MediaQuery.cpp

    r124884 r126154  
    138138{
    139139    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    140     info.addMember(m_mediaType);
     140    info.addInstrumentedMember(m_mediaType);
    141141    info.addInstrumentedVectorPtr(m_expressions);
    142     info.addMember(m_serializationCache);
     142    info.addInstrumentedMember(m_serializationCache);
    143143}
    144144
  • trunk/Source/WebCore/css/MediaQueryExp.cpp

    r124884 r126154  
    113113{
    114114    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    115     info.addMember(m_mediaFeature);
    116     info.addMember(m_serializationCache);
     115    info.addInstrumentedMember(m_mediaFeature);
     116    info.addInstrumentedMember(m_serializationCache);
    117117    info.addInstrumentedMember(m_value);
    118118}
  • trunk/Source/WebCore/css/StyleRuleImport.cpp

    r125852 r126154  
    135135{
    136136    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    137     info.addMember(m_strHref);
     137    info.addInstrumentedMember(m_strHref);
    138138    info.addInstrumentedMember(m_mediaQueries);
    139139    info.addInstrumentedMember(m_styleSheet);
  • trunk/Source/WebCore/css/StyleSheetContents.cpp

    r125805 r126154  
    487487{
    488488    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    489     info.addMember(m_originalURL);
    490     info.addMember(m_encodingFromCharsetRule);
     489    info.addInstrumentedMember(m_originalURL);
     490    info.addInstrumentedMember(m_encodingFromCharsetRule);
    491491    info.addVector(m_importRules);
    492492    info.addInstrumentedVector(m_childRules);
  • trunk/Source/WebCore/css/WebKitCSSKeyframeRule.cpp

    r124884 r126154  
    9191    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    9292    info.addInstrumentedMember(m_properties);
    93     info.addMember(m_key);
     93    info.addInstrumentedMember(m_key);
    9494}
    9595
  • trunk/Source/WebCore/css/WebKitCSSKeyframesRule.cpp

    r124884 r126154  
    9292    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    9393    info.addInstrumentedVector(m_keyframes);
    94     info.addMember(m_name);
     94    info.addInstrumentedMember(m_name);
    9595}
    9696
  • trunk/Source/WebCore/css/WebKitCSSSVGDocumentValue.cpp

    r124884 r126154  
    6868{
    6969    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    70     info.addMember(m_url);
     70    info.addInstrumentedMember(m_url);
    7171    // FIXME: add m_document when cached resources are instrumented.
    7272}
  • trunk/Source/WebCore/css/WebKitCSSShaderValue.cpp

    r124884 r126154  
    8484{
    8585    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    86     info.addMember(m_url);
     86    info.addInstrumentedMember(m_url);
    8787}
    8888   
  • trunk/Source/WebCore/dom/Attribute.h

    r125415 r126154  
    7272        MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
    7373        info.addInstrumentedMember(m_name);
    74         info.addMember(m_value);
     74        info.addInstrumentedMember(m_value);
    7575    }
    7676
  • trunk/Source/WebCore/dom/CharacterData.cpp

    r125760 r126154  
    9797    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
    9898    Node::reportMemoryUsage(memoryObjectInfo);
    99     info.addMember(m_data);
     99    info.addInstrumentedMember(m_data);
    100100}
    101101
  • trunk/Source/WebCore/dom/Document.cpp

    r126127 r126154  
    61106110    ContainerNode::reportMemoryUsage(memoryObjectInfo);
    61116111    info.addVector(m_customFonts);
    6112     info.addMember(m_url);
    6113     info.addMember(m_baseURL);
    6114     info.addMember(m_baseURLOverride);
    6115     info.addMember(m_baseElementURL);
    6116     info.addMember(m_cookieURL);
    6117     info.addMember(m_firstPartyForCookies);
    6118     info.addMember(m_documentURI);
    6119     info.addMember(m_baseTarget);
     6112    info.addInstrumentedMember(m_url);
     6113    info.addInstrumentedMember(m_baseURL);
     6114    info.addInstrumentedMember(m_baseURLOverride);
     6115    info.addInstrumentedMember(m_baseElementURL);
     6116    info.addInstrumentedMember(m_cookieURL);
     6117    info.addInstrumentedMember(m_firstPartyForCookies);
     6118    info.addInstrumentedMember(m_documentURI);
     6119    info.addInstrumentedMember(m_baseTarget);
    61206120    info.addInstrumentedMember(m_frame);
    61216121    info.addInstrumentedMember(m_cachedResourceLoader);
     
    61296129    info.addHashSet(m_ranges);
    61306130    info.addListHashSet(m_styleSheetCandidateNodes);
    6131     info.addMember(m_preferredStylesheetSet);
    6132     info.addMember(m_selectedStylesheetSet);
    6133     info.addMember(m_title.string());
    6134     info.addMember(m_rawTitle.string());
    6135     info.addMember(m_xmlEncoding);
    6136     info.addMember(m_xmlVersion);
    6137     info.addMember(m_contentLanguage);
     6131    info.addInstrumentedMember(m_preferredStylesheetSet);
     6132    info.addInstrumentedMember(m_selectedStylesheetSet);
     6133    info.addInstrumentedMember(m_title.string());
     6134    info.addInstrumentedMember(m_rawTitle.string());
     6135    info.addInstrumentedMember(m_xmlEncoding);
     6136    info.addInstrumentedMember(m_xmlVersion);
     6137    info.addInstrumentedMember(m_contentLanguage);
    61386138    info.addHashMap(m_documentNamedItemCollections);
    61396139    info.addHashMap(m_windowNamedItemCollections);
  • trunk/Source/WebCore/dom/ElementAttributeData.cpp

    r125415 r126154  
    3434namespace WebCore {
    3535
     36static size_t immutableElementAttributeDataSize(unsigned count)
     37{
     38    return sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * count;
     39}
     40
    3641PassOwnPtr<ElementAttributeData> ElementAttributeData::createImmutable(const Vector<Attribute>& attributes)
    3742{
    38     void* slot = WTF::fastMalloc(sizeof(ElementAttributeData) - sizeof(void*) + sizeof(Attribute) * attributes.size());
     43    void* slot = WTF::fastMalloc(immutableElementAttributeDataSize(attributes.size()));
    3944    return adoptPtr(new (slot) ElementAttributeData(attributes));
    4045}
     
    287292void ElementAttributeData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
    288293{
    289     MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
     294    size_t actualSize = m_isMutable ? sizeof(ElementAttributeData) : immutableElementAttributeDataSize(m_arraySize);
     295    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM, actualSize);
    290296    info.addInstrumentedMember(m_inlineStyleDecl);
    291297    info.addInstrumentedMember(m_attributeStyle);
    292298    info.addMember(m_classNames);
    293     info.addMember(m_idForStyleResolution);
     299    info.addInstrumentedMember(m_idForStyleResolution);
    294300    if (m_isMutable)
    295301        info.addVectorPtr(m_mutableAttributeVector);
    296     else
    297         info.addRawBuffer(m_attributes, m_arraySize * sizeof(Attribute));
    298302    for (unsigned i = 0, len = length(); i < len; i++)
    299303        info.addInstrumentedMember(*attributeItem(i));
  • trunk/Source/WebCore/dom/Event.cpp

    r125185 r126154  
    159159{
    160160    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
    161     info.addMember(m_type);
     161    info.addInstrumentedMember(m_type);
    162162    info.addMember(m_currentTarget);
    163163    info.addMember(m_target);
  • trunk/Source/WebCore/dom/MemoryInstrumentation.cpp

    r125763 r126154  
    3838namespace WebCore {
    3939
    40 void MemoryInstrumentation::addObject(const String& string, ObjectType objectType)
     40void MemoryInstrumentation::addInstrumentedObjectImpl(const String* const& string, ObjectType objectType, OwningType owningType)
    4141{
    42     addObject(string.impl(), objectType);
     42    if (!string || visited(string))
     43        return;
     44    if (owningType == byPointer)
     45        countObjectSize(objectType, sizeof(String));
     46    addInstrumentedObjectImpl(string->impl(), objectType, byPointer);
    4347}
    4448
    45 void MemoryInstrumentation::addObject(const StringImpl* stringImpl, ObjectType objectType)
     49void MemoryInstrumentation::addInstrumentedObjectImpl(const StringImpl* const& stringImpl, ObjectType objectType, OwningType)
    4650{
    4751    if (!stringImpl || visited(stringImpl))
     
    5054}
    5155
    52 void MemoryInstrumentation::addObject(const KURL& url, ObjectType objectType)
     56void MemoryInstrumentation::addInstrumentedObjectImpl(const KURL* const& url, ObjectType objectType, OwningType owningType)
    5357{
    54     if (visited(&url))
     58    if (!url || visited(url))
    5559        return;
    56     addObject(url.string(), objectType);
    57     if (url.innerURL())
    58         addObject(url.innerURL(), objectType);
     60    if (owningType == byPointer)
     61        countObjectSize(objectType, sizeof(KURL));
     62    addInstrumentedObject(url->string(), objectType);
     63    if (url->innerURL())
     64        addInstrumentedObject(url->innerURL(), objectType);
    5965}
    6066
    61 void MemoryInstrumentation::addInstrumentedObjectImpl(const AtomicString* const& string, ObjectType objectType, OwningType)
     67void MemoryInstrumentation::addInstrumentedObjectImpl(const AtomicString* const& atomicString, ObjectType objectType, OwningType owningType)
    6268{
    63     addObject(static_cast<const String&>(*string), objectType);
     69    addInstrumentedObjectImpl(reinterpret_cast<const String* const>(atomicString), objectType, owningType);
    6470}
    6571
  • trunk/Source/WebCore/dom/MemoryInstrumentation.h

    r126139 r126154  
    103103        OwningTraits<T>::addObject(this, t, ownerObjectType);
    104104    }
    105     void addObject(const String&, ObjectType);
    106     void addObject(const StringImpl*, ObjectType);
    107     void addObject(const KURL&, ObjectType);
     105
    108106    template <typename T> void addInstrumentedObject(const T& t, ObjectType ownerObjectType) { OwningTraits<T>::addInstrumentedObject(this, t, ownerObjectType); }
    109107    template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false);
     
    138136    };
    139137
    140     // FIXME: get rid of addObject(String)
    141     void addInstrumentedObjectImpl(const String* const& string, ObjectType objectType, OwningType) { addObject(*string, objectType); }
    142     void addInstrumentedObjectImpl(const StringImpl* const& string, ObjectType objectType, OwningType) { addObject(string, objectType); }
     138    void addInstrumentedObjectImpl(const String* const&, ObjectType, OwningType);
     139    void addInstrumentedObjectImpl(const StringImpl* const&, ObjectType, OwningType);
    143140    void addInstrumentedObjectImpl(const AtomicString* const&, ObjectType, OwningType);
     141    void addInstrumentedObjectImpl(const KURL* const&, ObjectType, OwningType);
    144142    template <typename T> void addInstrumentedObjectImpl(const T* const&, ObjectType, OwningType);
    145143    template <typename T> void addInstrumentedObjectImpl(const DataRef<T>* const&, ObjectType, OwningType);
     
    151149    template <typename T> void addObjectImpl(const OwnPtr<T>* const&, ObjectType, OwningType);
    152150    template <typename T> void addObjectImpl(const RefPtr<T>* const&, ObjectType, OwningType);
     151
     152    // Link time guards for special cases.
     153    void addObjectImpl(const String* const&, ObjectType, OwningType);
     154    void addObjectImpl(const StringImpl* const&, ObjectType, OwningType);
     155    void addObjectImpl(const AtomicString* const&, ObjectType, OwningType);
     156    void addObjectImpl(const KURL* const&, ObjectType, OwningType);
    153157};
    154158
     
    211215    void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
    212216
    213     void addMember(const String& string) { m_memoryInstrumentation->addObject(string, m_objectType); }
    214     void addMember(const AtomicString& string) { m_memoryInstrumentation->addObject((const String&)string, m_objectType); }
    215     void addMember(const StringImpl* string) { m_memoryInstrumentation->addObject(string, m_objectType); }
    216     void addMember(const KURL& url) { m_memoryInstrumentation->addObject(url, m_objectType); }
    217 
    218217private:
    219218    MemoryObjectInfo* m_memoryObjectInfo;
  • trunk/Source/WebCore/dom/QualifiedName.h

    r124884 r126154  
    5454        {
    5555            MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::DOM);
    56             info.addMember(m_prefix);
    57             info.addMember(m_localName);
    58             info.addMember(m_namespace);
    59             info.addMember(m_localNameUpper);
     56            info.addInstrumentedMember(m_prefix);
     57            info.addInstrumentedMember(m_localName);
     58            info.addInstrumentedMember(m_namespace);
     59            info.addInstrumentedMember(m_localNameUpper);
    6060        }
    6161    private:
  • trunk/Source/WebCore/loader/DocumentLoader.cpp

    r125815 r126154  
    365365    info.addInstrumentedHashSet(m_plugInStreamLoaders);
    366366    info.addInstrumentedMember(m_substituteData);
    367     info.addMember(m_pageTitle.string());
    368     info.addMember(m_overrideEncoding);
     367    info.addInstrumentedMember(m_pageTitle.string());
     368    info.addInstrumentedMember(m_overrideEncoding);
    369369    info.addVector(m_responses);
    370370    info.addInstrumentedMember(m_originalRequest);
     
    377377    info.addInstrumentedHashSet(m_resourcesClientKnowsAbout);
    378378    info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification);
    379     info.addMember(m_clientRedirectSourceForHistory);
     379    info.addInstrumentedMember(m_clientRedirectSourceForHistory);
    380380    info.addInstrumentedMember(m_mainResourceData);
    381381}
  • trunk/Source/WebCore/loader/FrameLoader.cpp

    r125858 r126154  
    32373237{
    32383238    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
    3239     info.addInstrumentedMember(m_documentLoader.get());
    3240     info.addInstrumentedMember(m_provisionalDocumentLoader.get());
    3241     info.addInstrumentedMember(m_policyDocumentLoader.get());
    3242     info.addMember(m_outgoingReferrer);
     3239    info.addInstrumentedMember(m_documentLoader);
     3240    info.addInstrumentedMember(m_provisionalDocumentLoader);
     3241    info.addInstrumentedMember(m_policyDocumentLoader);
     3242    info.addInstrumentedMember(m_outgoingReferrer);
    32433243    info.addInstrumentedHashSet(m_openedFrames);
    32443244}
  • trunk/Source/WebCore/loader/SubstituteData.cpp

    r125265 r126154  
    4040    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
    4141    info.addInstrumentedMember(m_content);
    42     info.addMember(m_mimeType);
    43     info.addMember(m_textEncoding);
    44     info.addMember(m_failingURL);
    45     info.addMember(m_responseURL);
     42    info.addInstrumentedMember(m_mimeType);
     43    info.addInstrumentedMember(m_textEncoding);
     44    info.addInstrumentedMember(m_failingURL);
     45    info.addInstrumentedMember(m_responseURL);
    4646}
    4747
  • trunk/Source/WebCore/loader/cache/CachedCSSStyleSheet.cpp

    r125292 r126154  
    209209    info.addMember(m_decoder);
    210210    info.addInstrumentedMember(m_parsedStyleSheetCache);
    211     info.addMember(m_decodedSheetText);
    212 }
    213 
    214 }
     211    info.addInstrumentedMember(m_decodedSheetText);
     212}
     213
     214}
  • trunk/Source/WebCore/loader/cache/CachedResource.cpp

    r124884 r126154  
    807807    info.addMember(m_resourceRequest);
    808808    info.addHashSet(m_clients);
    809     info.addMember(m_accept);
     809    info.addInstrumentedMember(m_accept);
    810810    info.addInstrumentedMember(m_loader);
    811     info.addMember(m_response);
     811    info.addInstrumentedMember(m_response);
    812812    info.addInstrumentedMember(m_data);
    813     info.addMember(m_cachedMetadata.get());
     813    info.addMember(m_cachedMetadata);
    814814    info.addInstrumentedMember(m_nextInAllResourcesList);
    815815    info.addInstrumentedMember(m_prevInAllResourcesList);
  • trunk/Source/WebCore/loader/cache/CachedResourceLoader.cpp

    r125615 r126154  
    884884    info.addHashMap(m_documentResources);
    885885    for (DocumentResourceMap::const_iterator i = m_documentResources.begin(); i != m_documentResources.end(); ++i) {
    886         info.addMember(i->first);
     886        info.addInstrumentedMember(i->first);
    887887        info.addInstrumentedMember(i->second);
    888888    }
  • trunk/Source/WebCore/loader/cache/CachedScript.cpp

    r124884 r126154  
    132132    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceScript);
    133133    CachedResource::reportMemoryUsage(memoryObjectInfo);
    134     info.addMember(m_script);
     134    info.addInstrumentedMember(m_script);
    135135    info.addMember(m_decoder);
    136136#if USE(JSC)
  • trunk/Source/WebCore/loader/cache/CachedShader.cpp

    r124884 r126154  
    7474    CachedResource::reportMemoryUsage(memoryObjectInfo);
    7575    info.addMember(m_decoder);
    76     info.addMember(m_shaderString);
     76    info.addInstrumentedMember(m_shaderString);
    7777}
    7878
  • trunk/Source/WebCore/loader/cache/CachedXSLStyleSheet.cpp

    r124884 r126154  
    102102    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CachedResourceXSLT);
    103103    CachedResource::reportMemoryUsage(memoryObjectInfo);
    104     info.addMember(m_sheet);
     104    info.addInstrumentedMember(m_sheet);
    105105    info.addMember(m_decoder);
    106106}
  • trunk/Source/WebCore/loader/cache/MemoryCache.cpp

    r124884 r126154  
    722722    CachedResourceMap::const_iterator e = m_resources.end();
    723723    for (CachedResourceMap::const_iterator i = m_resources.begin(); i != e; ++i) {
    724         info.addMember(i->first);
     724        info.addInstrumentedMember(i->first);
    725725        info.addInstrumentedMember(i->second);
    726726    }
  • trunk/Source/WebCore/platform/network/ResourceRequestBase.cpp

    r125763 r126154  
    448448{
    449449    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
    450     info.addMember(m_url);
    451     info.addMember(m_firstPartyForCookies);
     450    info.addInstrumentedMember(m_url);
     451    info.addInstrumentedMember(m_firstPartyForCookies);
    452452    info.addInstrumentedMember(m_httpMethod);
    453453    info.addHashMap(m_httpHeaderFields);
  • trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp

    r125763 r126154  
    572572{
    573573    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::Loader);
    574     info.addMember(m_url);
     574    info.addInstrumentedMember(m_url);
    575575    info.addInstrumentedMember(m_mimeType);
    576576    info.addInstrumentedMember(m_textEncodingName);
  • trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp

    r124884 r126154  
    267267    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    268268    info.addMember(textShadow);
    269     info.addMember(highlight);
     269    info.addInstrumentedMember(highlight);
    270270    info.addMember(cursorData);
    271     info.addMember(hyphenationString);
    272     info.addMember(locale);
    273     info.addMember(textEmphasisCustomMark);
     271    info.addInstrumentedMember(hyphenationString);
     272    info.addInstrumentedMember(locale);
     273    info.addInstrumentedMember(textEmphasisCustomMark);
    274274    info.addMember(quotes);
    275     info.addMember(m_lineGrid);
     275    info.addInstrumentedMember(m_lineGrid);
    276276#if ENABLE(CSS_VARIABLES)
    277277    info.addMember(m_variables);
  • trunk/Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp

    r126119 r126154  
    324324    info.addMember(m_wrapShapeInside);
    325325    info.addMember(m_wrapShapeOutside);
    326     info.addMember(m_flowThread);
    327     info.addMember(m_regionThread);
     326    info.addInstrumentedMember(m_flowThread);
     327    info.addInstrumentedMember(m_regionThread);
    328328}
    329329
  • trunk/Source/WebCore/svg/SVGPaint.cpp

    r124884 r126154  
    116116{
    117117    MemoryClassInfo info(memoryObjectInfo, this, MemoryInstrumentation::CSS);
    118     info.addMember(m_uri);
     118    info.addInstrumentedMember(m_uri);
    119119}
    120120
  • trunk/Source/WebKit/chromium/ChangeLog

    r126148 r126154  
     12012-08-21  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: NMI: rename addMember for strings and KURL to addInstrumentedMember.
     4        https://bugs.webkit.org/show_bug.cgi?id=94580
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        Drive by fix: immutable ElementAttrybuteData uses the same trick with placement new as in StylePropertySet.
     9
     10        * tests/MemoryInstrumentationTest.cpp:
     11        (WebCore::TEST):
     12        (WebCore):
     13
    1142012-08-21  Peter Beverloo  <peter@chromium.org>
    215
  • trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp

    r124884 r126154  
    3939#include <wtf/RefCounted.h>
    4040#include <wtf/Vector.h>
     41#include <wtf/text/AtomicString.h>
     42#include <wtf/text/StringImpl.h>
     43#include <wtf/text/WTFString.h>
    4144
    4245using namespace WebCore;
     
    225228}
    226229
     230TEST(MemoryInstrumentationTest, visitStrings)
     231{
     232    {
     233        VisitedObjects visitedObjects;
     234        MemoryInstrumentationImpl impl(visitedObjects);
     235        String string("string");
     236        impl.addRootObject(string);
     237        EXPECT_EQ(string.impl()->sizeInBytes(), impl.reportedSizeForAllTypes());
     238        EXPECT_EQ(2, visitedObjects.size());
     239    }
     240    {
     241        VisitedObjects visitedObjects;
     242        MemoryInstrumentationImpl impl(visitedObjects);
     243        String string("string");
     244        impl.addRootObject(&string);
     245        EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(String), impl.reportedSizeForAllTypes());
     246        EXPECT_EQ(2, visitedObjects.size());
     247    }
     248    {
     249        VisitedObjects visitedObjects;
     250        MemoryInstrumentationImpl impl(visitedObjects);
     251        AtomicString string("string");
     252        impl.addRootObject(&string);
     253        EXPECT_EQ(string.impl()->sizeInBytes() + sizeof(AtomicString), impl.reportedSizeForAllTypes());
     254        EXPECT_EQ(2, visitedObjects.size());
     255    }
     256}
     257
    227258} // namespace
    228259
Note: See TracChangeset for help on using the changeset viewer.