Changeset 121968 in webkit


Ignore:
Timestamp:
Jul 6, 2012 7:09:12 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

Web Inspector: Add native memory used by GlyphCache to the snapshot
https://bugs.webkit.org/show_bug.cgi?id=90615

Patch by Alexei Filippov <alexeif@chromium.org> on 2012-07-06
Reviewed by Yury Semikhatsky.

  • inspector/InspectorMemoryAgent.cpp:

(MemoryBlockName):
(WebCore):
(WebCore::addPlatformComponentsInfo):
(WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):

  • inspector/front-end/NativeMemorySnapshotView.js:

(WebInspector.MemoryBlockViewProperties._initialize):

  • platform/MemoryUsageSupport.cpp:

(WebCore::MemoryUsageSupport::memoryUsageByComponents):
(WebCore):

  • platform/MemoryUsageSupport.h:

(MemoryUsageSupport):
(ComponentInfo):
(WebCore::MemoryUsageSupport::ComponentInfo::ComponentInfo):

  • platform/chromium/MemoryUsageSupportChromium.cpp:

(WebCore::glyphCacheVisitor):
(WebCore):
(WebCore::MemoryUsageSupport::memoryUsageByComponents):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r121958 r121968  
     12012-07-06  Alexei Filippov  <alexeif@chromium.org>
     2
     3        Web Inspector: Add native memory used by GlyphCache to the snapshot
     4        https://bugs.webkit.org/show_bug.cgi?id=90615
     5
     6        Reviewed by Yury Semikhatsky.
     7
     8        * inspector/InspectorMemoryAgent.cpp:
     9        (MemoryBlockName):
     10        (WebCore):
     11        (WebCore::addPlatformComponentsInfo):
     12        (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
     13        * inspector/front-end/NativeMemorySnapshotView.js:
     14        (WebInspector.MemoryBlockViewProperties._initialize):
     15        * platform/MemoryUsageSupport.cpp:
     16        (WebCore::MemoryUsageSupport::memoryUsageByComponents):
     17        (WebCore):
     18        * platform/MemoryUsageSupport.h:
     19        (MemoryUsageSupport):
     20        (ComponentInfo):
     21        (WebCore::MemoryUsageSupport::ComponentInfo::ComponentInfo):
     22        * platform/chromium/MemoryUsageSupportChromium.cpp:
     23        (WebCore::glyphCacheVisitor):
     24        (WebCore):
     25        (WebCore::MemoryUsageSupport::memoryUsageByComponents):
     26
    1272012-07-06  Oswald Buddenhagen  <oswald.buddenhagen@nokia.com>
    228
  • trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp

    r121952 r121968  
    545545}
    546546
     547static void addPlatformComponentsInfo(PassRefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children)
     548{
     549    Vector<MemoryUsageSupport::ComponentInfo> components;
     550    MemoryUsageSupport::memoryUsageByComponents(components);
     551    for (Vector<MemoryUsageSupport::ComponentInfo>::iterator it = components.begin(); it != components.end(); ++it) {
     552        RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(it->m_name);
     553        block->setSize(it->m_sizeInBytes);
     554        children->addItem(block);
     555    }
     556}
     557
    547558static PassRefPtr<InspectorMemoryBlock> memoryCacheInfo()
    548559{
     
    603614    children->addItem(domTreeInfo(m_page, visitedObjects)); // TODO: collect for all pages?
    604615    children->addItem(jsExternalResourcesInfo(visitedObjects));
     616    addPlatformComponentsInfo(children);
    605617    processMemory->setChildren(children);
    606618}
  • trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js

    r121549 r121968  
    225225    addBlock("hsl(210, 60%,  80%)", "InspectorData", "Inspector data");
    226226    addBlock("hsl( 30, 60%,  80%)", "MemoryCache", "Memory cache resources");
     227    addBlock("hsl( 40, 60%,  80%)", "GlyphCache", "Glyph cache resources");
    227228    addBlock("hsl( 60, 60%,  80%)", "RenderTreeAllocated", "Render tree");
    228229    addBlock("hsl( 60, 60%,  80%)", "RenderTreeUsed", "Render tree used");
  • trunk/Source/WebCore/platform/MemoryUsageSupport.cpp

    r119068 r121968  
    6464}
    6565
     66void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>&)
     67{
     68}
     69
    6670} // namespace WebCore
  • trunk/Source/WebCore/platform/MemoryUsageSupport.h

    r119068 r121968  
    3232#define MemoryUsageSupport_h
    3333
     34#include <wtf/Vector.h>
     35#include <wtf/text/WTFString.h>
     36
    3437namespace WebCore {
    3538
     
    5861    // false on platform specific error conditions.
    5962    static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes);
     63
     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>&);
    6074};
    6175
  • trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp

    r119068 r121968  
    3333
    3434#include <public/Platform.h>
     35#include <third_party/skia/src/core/SkGlyphCache.h>
    3536
    3637namespace WebCore {
     
    6667}
    6768
     69static bool glyphCacheVisitor(SkGlyphCache* cache, void* context)
     70{
     71    size_t* sizePtr = reinterpret_cast<size_t*>(context);
     72    *sizePtr += sizeof(*cache);
     73    return false;
     74}
     75
     76void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>& components)
     77{
     78    size_t size = 0;
     79    SkGlyphCache::VisitAllCaches(glyphCacheVisitor, &size);
     80    components.append(ComponentInfo("GlyphCache", size));
     81}
     82
    6883} // namespace WebCore
Note: See TracChangeset for help on using the changeset viewer.