Changeset 132725 in webkit
- Timestamp:
- Oct 27, 2012, 8:11:30 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r132724 r132725 1 2012-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 1 28 2012-10-26 Philip Rogers <pdr@google.com> 2 29 -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp
r132661 r132725 514 514 } 515 515 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 527 516 void InspectorMemoryAgent::getProcessMemoryDistribution(ErrorString*, RefPtr<InspectorMemoryBlock>& processMemory) 528 517 { … … 535 524 collectDomTreeInfo(memoryInstrumentation, m_page); // FIXME: collect for all pages? 536 525 537 RefPtr<InspectorMemoryBlocks> children = InspectorMemoryBlocks::create(); 538 addPlatformComponentsInfo(children); 526 MemoryUsageSupport::reportMemoryUsage(&memoryInstrumentation); 539 527 540 528 memoryInstrumentation.addRootObject(this); … … 544 532 m_inspectorClient->dumpUncountedAllocatedObjects(memoryInstrumentationClient.countedObjects()); 545 533 534 RefPtr<InspectorMemoryBlocks> children = InspectorMemoryBlocks::create(); 546 535 MemoryUsageStatsGenerator statsGenerator(&memoryInstrumentationClient); 547 536 statsGenerator.dump(children.get()); -
trunk/Source/WebCore/platform/MemoryUsageSupport.cpp
r132661 r132725 64 64 } 65 65 66 void MemoryUsageSupport:: memoryUsageByComponents(Vector<ComponentInfo>&)66 void MemoryUsageSupport::reportMemoryUsage(MemoryInstrumentation*) 67 67 { 68 68 } -
trunk/Source/WebCore/platform/MemoryUsageSupport.h
r132661 r132725 62 62 static bool processMemorySizesInBytes(size_t* privateBytes, size_t* sharedBytes); 63 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>&); 64 // Reports memory objects used by platform. 65 static void reportMemoryUsage(MemoryInstrumentation*); 74 66 }; 75 67 -
trunk/Source/WebCore/platform/PlatformMemoryInstrumentation.cpp
r132661 r132725 36 36 MemoryObjectType PlatformMemoryTypes::Image = "Page.Image"; 37 37 MemoryObjectType PlatformMemoryTypes::Loader = "Page.Loader"; 38 MemoryObjectType PlatformMemoryTypes::GlyphCache = "MemoryCache.GlyphCache"; 38 39 39 40 } // namespace WebCore -
trunk/Source/WebCore/platform/PlatformMemoryInstrumentation.h
r132661 r132725 44 44 static MemoryObjectType Image; 45 45 static MemoryObjectType Loader; 46 static MemoryObjectType GlyphCache; 46 47 }; 47 48 -
trunk/Source/WebCore/platform/chromium/MemoryUsageSupportChromium.cpp
r132661 r132725 32 32 #include "MemoryUsageSupport.h" 33 33 34 #include "PlatformMemoryInstrumentation.h" 35 #include <SkGlyphCache.h> 34 36 #include <SkGraphics.h> 35 37 #include <public/Platform.h> 38 39 void 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 } 36 45 37 46 namespace WebCore { … … 67 76 } 68 77 69 void MemoryUsageSupport::memoryUsageByComponents(Vector<ComponentInfo>& components)78 static bool reportGlyphCache(SkGlyphCache* glyphCache, void* ctx) 70 79 { 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 85 void MemoryUsageSupport::reportMemoryUsage(MemoryInstrumentation* memoryInstrumentation) 86 { 87 SkGlyphCache::VisitAllCaches(reportGlyphCache, memoryInstrumentation); 73 88 } 74 89 -
trunk/Source/WebCore/platform/qt/MemoryUsageSupportQt.cpp
r132663 r132725 112 112 } 113 113 114 void MemoryUsageSupport:: memoryUsageByComponents(Vector<ComponentInfo>&)114 void MemoryUsageSupport::reportMemoryUsage(MemoryInstrumentation* memoryInstrumentation) 115 115 { 116 116 }
Note:
See TracChangeset
for help on using the changeset viewer.