Changeset 127738 in webkit
- Timestamp:
- Sep 6, 2012 7:25:47 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r127737 r127738 1 2012-09-06 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: NMI: switch to hierarchical identifiers of MemoryBlockTypes and use these identifiers in protocol. 4 https://bugs.webkit.org/show_bug.cgi?id=95957 5 6 Reviewed by Yury Semikhatsky. 7 8 Now when we use string identifiers as MemoryObjectType we can use them as the identifiers for the protocol 9 instead of MemoryBlockNames hardcoded in InspectorMemoryAgent.. 10 At a later stage, when each type of memory will be counted in MemoryInstrumentation 11 we will build the blocks hierarchy for the front-end automatically. 12 13 * dom/MemoryInstrumentation.cpp: 14 (WebCore): 15 * dom/MemoryInstrumentation.h: 16 (GenericMemoryTypes): 17 (WebCore::MemoryInstrumentation::addRootObject): 18 (WebCore::MemoryObjectInfo::reportObjectInfo): 19 (WebCoreMemoryTypes): 20 * inspector/InspectorMemoryAgent.cpp: 21 (MemoryBlockName): 22 (WebCore): 23 * inspector/MemoryInstrumentationImpl.cpp: 24 (WebCore::MemoryInstrumentationImpl::countObjectSize): 25 * inspector/front-end/NativeMemorySnapshotView.js: 26 (WebInspector.MemoryBlockViewProperties._initialize): 27 * loader/cache/CachedRawResource.cpp: 28 (WebCore::CachedRawResource::reportMemoryUsage): 29 * loader/cache/CachedResource.cpp: 30 (WebCore::CachedResource::reportMemoryUsage): 31 * loader/cache/CachedResourceHandle.cpp: 32 (WebCore::CachedResourceHandleBase::reportMemoryUsage): 33 * platform/SharedBuffer.cpp: 34 (WebCore::SharedBuffer::reportMemoryUsage): 35 1 36 2012-09-06 Mikhail Pozdnyakov <mikhail.pozdnyakov@intel.com> 2 37 -
trunk/Source/WebCore/dom/MemoryInstrumentation.cpp
r127593 r127738 38 38 namespace WebCore { 39 39 40 MemoryObjectType GenericMemoryTypes:: Other = "Other";40 MemoryObjectType GenericMemoryTypes::Undefined = 0; 41 41 42 MemoryObjectType WebCoreMemoryTypes::DOM = "DOM"; 43 MemoryObjectType WebCoreMemoryTypes::CSS = "CSS"; 44 MemoryObjectType WebCoreMemoryTypes::Binding = "Binding"; 45 MemoryObjectType WebCoreMemoryTypes::Loader = "Loader"; 46 MemoryObjectType WebCoreMemoryTypes::MemoryCacheStructures = "MemoryCacheStructures"; 47 MemoryObjectType WebCoreMemoryTypes::CachedResource = "CachedResource"; 48 MemoryObjectType WebCoreMemoryTypes::CachedResourceCSS = "CachedResourceCSS"; 49 MemoryObjectType WebCoreMemoryTypes::CachedResourceFont = "CachedResourceFont"; 50 MemoryObjectType WebCoreMemoryTypes::CachedResourceImage = "CachedResourceImage"; 51 MemoryObjectType WebCoreMemoryTypes::CachedResourceScript = "CachedResourceScript"; 52 MemoryObjectType WebCoreMemoryTypes::CachedResourceSVG = "CachedResourceSVG"; 53 MemoryObjectType WebCoreMemoryTypes::CachedResourceShader = "CachedResourceShader"; 54 MemoryObjectType WebCoreMemoryTypes::CachedResourceXSLT = "CachedResourceXSLT"; 42 MemoryObjectType WebCoreMemoryTypes::Page = "Page"; 43 MemoryObjectType WebCoreMemoryTypes::DOM = "Page.DOM"; 44 MemoryObjectType WebCoreMemoryTypes::CSS = "Page.CSS"; 45 MemoryObjectType WebCoreMemoryTypes::Binding = "Page.Binding"; 46 MemoryObjectType WebCoreMemoryTypes::Loader = "Page.Loader"; 47 48 MemoryObjectType WebCoreMemoryTypes::MemoryCache = "MemoryCache"; 49 MemoryObjectType WebCoreMemoryTypes::MemoryCacheStructures = "MemoryCache.InternalStructures"; 50 MemoryObjectType WebCoreMemoryTypes::CachedResource = "MemoryCache.Resource"; 51 MemoryObjectType WebCoreMemoryTypes::CachedResourceRaw = "MemoryCache.RawResource"; 52 MemoryObjectType WebCoreMemoryTypes::CachedResourceCSS = "MemoryCache.CSS"; 53 MemoryObjectType WebCoreMemoryTypes::CachedResourceFont = "MemoryCache.Font"; 54 MemoryObjectType WebCoreMemoryTypes::CachedResourceImage = "MemoryCache.Image"; 55 MemoryObjectType WebCoreMemoryTypes::CachedResourceScript = "MemoryCache.Script"; 56 MemoryObjectType WebCoreMemoryTypes::CachedResourceSVG = "MemoryCache.SVG"; 57 MemoryObjectType WebCoreMemoryTypes::CachedResourceShader = "MemoryCache.Shader"; 58 MemoryObjectType WebCoreMemoryTypes::CachedResourceXSLT = "MemoryCache.XSLT"; 55 59 56 60 template<> void MemoryInstrumentationTraits::addInstrumentedObject<String>(MemoryInstrumentation* instrumentation, const String* const& string, MemoryObjectType ownerObjectType, MemoryOwningType owningType) -
trunk/Source/WebCore/dom/MemoryInstrumentation.h
r127593 r127738 50 50 class GenericMemoryTypes { 51 51 public: 52 static MemoryObjectType Other;52 static MemoryObjectType Undefined; 53 53 }; 54 54 … … 70 70 template <typename T> void addRootObject(const T& t) 71 71 { 72 addInstrumentedObject(t, GenericMemoryTypes:: Other);72 addInstrumentedObject(t, GenericMemoryTypes::Undefined); 73 73 processDeferredInstrumentedPointers(); 74 74 } … … 189 189 if (!m_objectSize) { 190 190 m_objectSize = actualSize ? actualSize : sizeof(T); 191 if (objectType != GenericMemoryTypes:: Other)191 if (objectType != GenericMemoryTypes::Undefined) 192 192 m_objectType = objectType; 193 193 } … … 409 409 class WebCoreMemoryTypes { 410 410 public: 411 static MemoryObjectType Page; 411 412 static MemoryObjectType DOM; 412 413 static MemoryObjectType CSS; 413 414 static MemoryObjectType Binding; 414 415 static MemoryObjectType Loader; 416 417 static MemoryObjectType MemoryCache; 415 418 static MemoryObjectType MemoryCacheStructures; 416 419 static MemoryObjectType CachedResource; 420 static MemoryObjectType CachedResourceRaw; 417 421 static MemoryObjectType CachedResourceCSS; 418 422 static MemoryObjectType CachedResourceFont; -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp
r127593 r127738 84 84 static const char processPrivateMemory[] = "ProcessPrivateMemory"; 85 85 86 static const char memoryCache[] = "MemoryCache";87 static const char memoryCacheStructures[] = "MemoryCacheStructures";88 static const char cachedResource[] = "CachedResource";89 static const char cachedResourceImage[] = "CachedImages";90 static const char cachedResourceCSS[] = "CachedCssStyleSheets";91 static const char cachedResourceScript[] = "CachedScripts";92 static const char cachedResourceXSL[] = "CachedXslStyleSheets";93 static const char cachedResourceFont[] = "CachedFonts";94 static const char cachedResourceSVG[] = "CachedSVGGraphics";95 static const char cachedResourceShader[] = "CachedShaders";96 static const char cachedResourceXSLT[] = "CachedShadersXSLT";97 98 86 static const char renderTreeUsed[] = "RenderTreeUsed"; 99 87 static const char renderTreeAllocated[] = "RenderTreeAllocated"; 100 101 static const char dom[] = "DOM";102 static const char domTreeOther[] = "DOMTreeOther";103 static const char domTreeDOM[] = "DOMTreeDOM";104 static const char domTreeCSS[] = "DOMTreeCSS";105 static const char domTreeBinding[] = "DOMTreeBinding";106 static const char domTreeLoader[] = "DOMTreeLoader";107 88 108 89 static const char domStorageCache[] = "DOMStorageCache"; … … 441 422 } 442 423 443 static size_t addMemoryBlockFor(TypeBuilder::Array<InspectorMemoryBlock>* array, size_t size, const char* name)444 {445 RefPtr<InspectorMemoryBlock> result = InspectorMemoryBlock::create().setName(name);446 result->setSize(size);447 array->addItem(result);448 return size;449 }450 451 424 namespace { 452 425 … … 487 460 488 461 RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > children = TypeBuilder::Array<InspectorMemoryBlock>::create(); 489 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::MemoryCacheStructures), MemoryBlockName::memoryCacheStructures);490 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResource), MemoryBlockName::cachedResource);491 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceCSS), MemoryBlockName::cachedResourceCSS);492 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceFont), MemoryBlockName::cachedResourceFont);493 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceImage), MemoryBlockName::cachedResourceImage);494 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceScript), MemoryBlockName::cachedResourceScript);495 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceSVG), MemoryBlockName::cachedResourceSVG);496 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceShader), MemoryBlockName::cachedResourceShader);497 totalSize += addMemoryBlockFor(children.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CachedResourceXSLT), MemoryBlockName::cachedResourceXSLT);498 499 RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName( MemoryBlockName::memoryCache);462 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::MemoryCacheStructures); 463 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceRaw); 464 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceCSS); 465 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceFont); 466 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceImage); 467 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceScript); 468 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceSVG); 469 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceShader); 470 totalSize += addMemoryBlockFor(children.get(), WebCoreMemoryTypes::CachedResourceXSLT); 471 472 RefPtr<InspectorMemoryBlock> block = InspectorMemoryBlock::create().setName(WebCoreMemoryTypes::MemoryCache); 500 473 block->setSize(totalSize); 501 474 block->setChildren(children.release()); … … 503 476 } 504 477 505 PassRefPtr<InspectorMemoryBlock> buildObjectFor DOM() const478 PassRefPtr<InspectorMemoryBlock> buildObjectForPage() const 506 479 { 507 480 size_t totalSize = 0; 508 481 509 482 RefPtr<TypeBuilder::Array<InspectorMemoryBlock> > domChildren = TypeBuilder::Array<InspectorMemoryBlock>::create(); 510 totalSize += addMemoryBlockFor(domChildren.get(), m_memoryInstrumentation.totalSize(GenericMemoryTypes::Other), MemoryBlockName::domTreeOther); 511 totalSize += addMemoryBlockFor(domChildren.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::DOM), MemoryBlockName::domTreeDOM); 512 totalSize += addMemoryBlockFor(domChildren.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::CSS), MemoryBlockName::domTreeCSS); 513 totalSize += addMemoryBlockFor(domChildren.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::Binding), MemoryBlockName::domTreeBinding); 514 totalSize += addMemoryBlockFor(domChildren.get(), m_memoryInstrumentation.totalSize(WebCoreMemoryTypes::Loader), MemoryBlockName::domTreeLoader); 515 516 RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(MemoryBlockName::dom); 483 totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::DOM); 484 totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::CSS); 485 totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::Binding); 486 totalSize += addMemoryBlockFor(domChildren.get(), WebCoreMemoryTypes::Loader); 487 488 RefPtr<InspectorMemoryBlock> dom = InspectorMemoryBlock::create().setName(WebCoreMemoryTypes::Page); 517 489 dom->setSize(totalSize); 518 490 dom->setChildren(domChildren.release()); … … 523 495 { 524 496 children->addItem(buildObjectForMemoryCache()); 525 children->addItem(buildObjectForDOM()); 497 children->addItem(buildObjectForPage()); 498 526 499 inspectorData->addComponent(MemoryBlockName::inspectorDOMData, m_memoryInstrumentation.selfSize()); 527 500 } 528 501 529 502 private: 503 size_t addMemoryBlockFor(TypeBuilder::Array<InspectorMemoryBlock>* array, MemoryObjectType typeName) const 504 { 505 RefPtr<InspectorMemoryBlock> result = InspectorMemoryBlock::create().setName(typeName); 506 size_t size = m_memoryInstrumentation.totalSize(typeName); 507 result->setSize(size); 508 array->addItem(result); 509 return size; 510 } 511 530 512 Page* m_page; 531 513 MemoryInstrumentationImpl& m_memoryInstrumentation; -
trunk/Source/WebCore/inspector/MemoryInstrumentationImpl.cpp
r127592 r127738 53 53 void MemoryInstrumentationImpl::countObjectSize(MemoryObjectType objectType, size_t size) 54 54 { 55 ASSERT(objectType != GenericMemoryTypes::Undefined); 55 56 TypeToSizeMap::AddResult result = m_totalSizes.add(objectType, size); 56 57 if (!result.isNewEntry) -
trunk/Source/WebCore/inspector/front-end/NativeMemorySnapshotView.js
r125966 r127738 217 217 } 218 218 addBlock("hsl( 0, 0%, 100%)", "ProcessPrivateMemory", "Total"); 219 addBlock("hsl( 0, 0%, 80%)", "OwnersTypePlaceholder", "OwnersTypePlaceholder"); 219 220 addBlock("hsl( 0, 0%, 80%)", "Other", "Other"); 220 addBlock("hsl(300, 30%, 80%)", " DOM", "DOM treestructures");221 addBlock("hsl(300, 30%, 80%)", "Page", "Page's structures"); 221 222 addBlock("hsl( 90, 60%, 80%)", "JSHeapAllocated", "JavaScript heap"); 222 223 addBlock("hsl( 90, 80%, 80%)", "JSHeapUsed", "Used JavaScript heap"); -
trunk/Source/WebCore/loader/cache/CachedRawResource.cpp
r127593 r127738 163 163 void CachedRawResource::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 164 164 { 165 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResource );165 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CachedResourceRaw); 166 166 CachedResource::reportMemoryUsage(memoryObjectInfo); 167 167 } -
trunk/Source/WebCore/loader/cache/CachedResourceHandle.cpp
r127593 r127738 44 44 void CachedResourceHandleBase::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 45 45 { 46 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes:: CachedResource);46 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::MemoryCacheStructures); 47 47 info.addInstrumentedMember(m_resource); 48 48 } -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r127593 r127738 251 251 void SharedBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 252 252 { 253 MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes:: Other);253 MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes::Undefined); 254 254 info.addVector(m_buffer); 255 255 info.addVector(m_segments); -
trunk/Source/WebKit/chromium/ChangeLog
r127721 r127738 1 2012-09-06 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: NMI: switch to hierarchical identifiers of MemoryBlockTypes and use these identifiers in protocol. 4 https://bugs.webkit.org/show_bug.cgi?id=95957 5 6 Reviewed by Yury Semikhatsky. 7 8 Now when we use string identifiers as MemoryObjectType we can use them as the identifiers for the protocol 9 instead of MemoryBlockNames hardcoded in InspectorMemoryAgent.. 10 At a later stage, when each memory type is counted in MemoryInstrumentation 11 we will build the blocks hierarchy for the front-end automatically. 12 13 * tests/MemoryInstrumentationTest.cpp: 14 (WebCore::InstrumentedUndefined::InstrumentedUndefined): 15 (WebCore::InstrumentedUndefined::reportMemoryUsage): 16 (WebCore::InstrumentedDOM::InstrumentedDOM): 17 (WebCore::InstrumentedDOM::reportMemoryUsage): 18 (InstrumentedDOM): 19 (WebCore::TEST): 20 1 21 2012-09-06 Kenichi Ishibashi <bashi@chromium.org> 2 22 -
trunk/Source/WebKit/chromium/tests/MemoryInstrumentationTest.cpp
r127617 r127738 173 173 } 174 174 175 class Instrumented Other{176 public: 177 Instrumented Other() : m_data(0) { }175 class InstrumentedUndefined { 176 public: 177 InstrumentedUndefined() : m_data(0) { } 178 178 179 179 void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 180 180 { 181 MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes:: Other);181 MemoryClassInfo info(memoryObjectInfo, this, GenericMemoryTypes::Undefined); 182 182 } 183 183 int m_data; … … 186 186 class InstrumentedDOM { 187 187 public: 188 InstrumentedDOM() : m_instrumented Other(adoptPtr(new InstrumentedOther)) { }188 InstrumentedDOM() : m_instrumentedUndefined(adoptPtr(new InstrumentedUndefined)) { } 189 189 190 190 void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 191 191 { 192 192 MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM); 193 info.addInstrumentedMember(m_instrumented Other);194 } 195 OwnPtr<Instrumented Other> m_instrumentedOther;193 info.addInstrumentedMember(m_instrumentedUndefined); 194 } 195 OwnPtr<InstrumentedUndefined> m_instrumentedUndefined; 196 196 }; 197 197 … … 202 202 OwnPtr<InstrumentedDOM> instrumentedDOM(adoptPtr(new InstrumentedDOM)); 203 203 impl.addRootObject(instrumentedDOM); 204 EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(Instrumented Other), impl.reportedSizeForAllTypes());205 EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(Instrumented Other), impl.totalSize(WebCoreMemoryTypes::DOM));204 EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedUndefined), impl.reportedSizeForAllTypes()); 205 EXPECT_EQ(sizeof(InstrumentedDOM) + sizeof(InstrumentedUndefined), impl.totalSize(WebCoreMemoryTypes::DOM)); 206 206 EXPECT_EQ(2, visitedObjects.size()); 207 207 }
Note: See TracChangeset
for help on using the changeset viewer.