Changeset 132725 in webkit


Ignore:
Timestamp:
Oct 27, 2012, 8:11:30 AM (12 years ago)
Author:
loislo@chromium.org
Message:

Web Inspector: instrument chromium GlyphCache. It keeps ~2mb.
https://bugs.webkit.org/show_bug.cgi?id=100515

Reviewed by Yury Semikhatsky.

I replaced old version with an abstract number with new one which precisely reports allocated SkGlyphCache objects and their sizes.

  • inspector/InspectorMemoryAgent.cpp:

(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):

  • platform/MemoryUsageSupport.cpp:

(WebCore::MemoryUsageSupport::reportMemoryUsage):

  • platform/MemoryUsageSupport.h:

(MemoryUsageSupport):

  • platform/PlatformMemoryInstrumentation.cpp:

(WebCore):

  • platform/PlatformMemoryInstrumentation.h:

(PlatformMemoryTypes):

  • platform/chromium/MemoryUsageSupportChromium.cpp:

(reportMemoryUsage):
(WebCore::reportGlyphCache):
(WebCore):
(WebCore::MemoryUsageSupport::reportMemoryUsage):

  • platform/qt/MemoryUsageSupportQt.cpp:

(WebCore::MemoryUsageSupport::reportMemoryUsage):

Location:
trunk/Source/WebCore
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r132724 r132725  
     12012-10-26  Ilya Tikhonovsky  <loislo@chromium.org>
     2
     3        Web Inspector: instrument chromium GlyphCache. It keeps ~2mb.
     4        https://bugs.webkit.org/show_bug.cgi?id=100515
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        I replaced old version with an abstract number with new one which precisely reports allocated SkGlyphCache objects and their sizes.
     9
     10        * inspector/InspectorMemoryAgent.cpp:
     11        (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
     12        * platform/MemoryUsageSupport.cpp:
     13        (WebCore::MemoryUsageSupport::reportMemoryUsage):
     14        * platform/MemoryUsageSupport.h:
     15        (MemoryUsageSupport):
     16        * platform/PlatformMemoryInstrumentation.cpp:
     17        (WebCore):
     18        * platform/PlatformMemoryInstrumentation.h:
     19        (PlatformMemoryTypes):
     20        * platform/chromium/MemoryUsageSupportChromium.cpp:
     21        (reportMemoryUsage):
     22        (WebCore::reportGlyphCache):
     23        (WebCore):
     24        (WebCore::MemoryUsageSupport::reportMemoryUsage):
     25        * platform/qt/MemoryUsageSupportQt.cpp:
     26        (WebCore::MemoryUsageSupport::reportMemoryUsage):
     27
    1282012-10-26  Philip Rogers  <pdr@google.com>
    229
  • trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp

    r132661 r132725  
    514514}
    515515
    516 static void addPlatformComponentsInfo(PassRefPtr<InspectorMemoryBlocks> children)
    517 {
    518     Vector<MemoryUsageSupport::ComponentInfo> components;
    519     MemoryUsageSupport::memoryUsageByComponents(components);
    520     for (Vector<MemoryUsageSupport::ComponentInfo>::iterator it = components.begin(); it != components.end(); ++it) {
    521         RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(it->m_name);
    522         block->setSize(it->m_sizeInBytes);
    523         children->addItem(block);
    524     }
    525 }
    526 
    527516void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<InspectorMemoryBlock>& processMemory)
    528517{
     
    535524    collectDomTreeInfo(memoryInstrumentation, m_page); // FIXME: collect for all pages?
    536525
    537     RefPtr<InspectorMemoryBlocks> children = InspectorMemoryBlocks::create();
    538     addPlatformComponentsInfo(children);
     526    MemoryUsageSupport::reportMemoryUsage(&memoryInstrumentation);
    539527
    540528    memoryInstrumentation.addRootObject(this);
     
    544532    m_inspectorClient->dumpUncountedAllocatedObjects(memoryInstrumentationClient.countedObjects());
    545533
     534    RefPtr<InspectorMemoryBlocks> children = InspectorMemoryBlocks::create();
    546535    MemoryUsageStatsGenerator statsGenerator(&memoryInstrumentationClient);
    547536    statsGenerator.dump(children.get());
  • trunk/Source/WebCore/platform/MemoryUsageSupport.cpp

    r132661 r132725  
    6464}
    6565
    66 void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
     66void MemoryUsageSupport::reportMemoryUsage(MemoryInstrumentation*)
    6767{
    6868}
  • trunk/Source/WebCore/platform/MemoryUsageSupport.h

    r132661 r132725  
    6262    static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes);
    6363
    64     class ComponentInfo {
    65     public:
    66         ComponentInfo(const String& name, size_t size) : m_name(name), m_sizeInBytes(size) { }
    67 
    68         const String m_name;
    69         size_t m_sizeInBytes;
    70     };
    71 
    72     // Reports private memory used by components in bytes.
    73     static void memoryUsageByComponents(Vector<ComponentInfo>&);
     64    // Reports memory objects used by platform.
     65    static void reportMemoryUsage(MemoryInstrumentation*);
    7466};
    7567
  • trunk/Source/WebCore/platform/PlatformMemoryInstrumentation.cpp

    r132661 r132725  
    3636MemoryObjectType PlatformMemoryTypes::Image = "Page.Image";
    3737MemoryObjectType PlatformMemoryTypes::Loader = "Page.Loader";
     38MemoryObjectType PlatformMemoryTypes::GlyphCache = "MemoryCache.GlyphCache";
    3839
    3940} // namespace WebCore
  • trunk/Source/WebCore/platform/PlatformMemoryInstrumentation.h

    r132661 r132725  
    4444    static MemoryObjectType Image;
    4545    static MemoryObjectType Loader;
     46    static MemoryObjectType GlyphCache;
    4647};
    4748
  • trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp

    r132661 r132725  
    3232#include "MemoryUsageSupport.h"
    3333
     34#include "PlatformMemoryInstrumentation.h"
     35#include <SkGlyphCache.h>
    3436#include <SkGraphics.h>
    3537#include <public/Platform.h>
     38
     39void reportMemoryUsage(const SkGlyphCache* const& glyphCache, WTF::MemoryObjectInfo* memoryObjectInfo)
     40{
     41    WTF::MemoryClassInfo info(memoryObjectInfo, glyphCache, WebCore::PlatformMemoryTypes::GlyphCache);
     42    info.addMember(&glyphCache->getDescriptor());
     43    info.addMember(glyphCache->getScalerContext());
     44}
    3645
    3746namespace WebCore {
     
    6776}
    6877
    69 void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>& components)
     78static bool reportGlyphCache(SkGlyphCache* glyphCache, void* ctx)
    7079{
    71     size_t size = SkGraphics::GetFontCacheUsed();
    72     components.append(ComponentInfo("GlyphCache", size));
     80    MemoryInstrumentation* memoryInstrumentation = reinterpret_cast<MemoryInstrumentation*>(ctx);
     81    memoryInstrumentation->addRootObject(glyphCache);
     82    return false;
     83}
     84
     85void MemoryUsageSupport::reportMemoryUsage(MemoryInstrumentation* memoryInstrumentation)
     86{
     87    SkGlyphCache::VisitAllCaches(reportGlyphCache, memoryInstrumentation);
    7388}
    7489
  • trunk/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp

    r132663 r132725  
    112112}
    113113
    114 void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
     114void MemoryUsageSupport::reportMemoryUsage(MemoryInstrumentation* memoryInstrumentation)
    115115{
    116116}
Note: See TracChangeset for help on using the changeset viewer.