Changeset 122920 in webkit
- Timestamp:
- Jul 17, 2012 10:58:49 PM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r122918 r122920 1 2012-07-17 Ilya Tikhonovsky <loislo@chromium.org> 2 3 Web Inspector: show loaders memory consumption on the memory chart. 4 https://bugs.webkit.org/show_bug.cgi?id=90686 5 6 Reviewed by Pavel Feldman. 7 8 Size of FrameLoader, DocumentLoader, ResourceLoader and their resources should be shown on the memory pie chart. 9 10 It is covered by existing WebInspector performance tests infrastructure. 11 12 * WebCore.exp.in: 13 * dom/MemoryInstrumentation.h: 14 (MemoryInstrumentation): 15 (WebCore::MemoryInstrumentation::addRawBuffer): 16 (WebCore::MemoryInstrumentation::addInstrumentedMemberImpl): 17 (WebCore): 18 (WebCore::MemoryClassInfo::addInstrumentedHashSet): 19 (WebCore::MemoryClassInfo::addRawBuffer): 20 (WebCore::MemoryInstrumentation::addInstrumentedHashSet): 21 (WebCore::MemoryInstrumentation::addVector): 22 * inspector/InspectorMemoryAgent.cpp: 23 (WebCore): 24 (WebCore::domTreeInfo): 25 * loader/DocumentLoader.cpp: 26 (WebCore::DocumentLoader::reportMemoryUsage): 27 (WebCore): 28 * loader/DocumentLoader.h: 29 (WebCore): 30 (DocumentLoader): 31 * loader/FrameLoader.cpp: 32 (WebCore::FrameLoader::reportMemoryUsage): 33 (WebCore): 34 * loader/FrameLoader.h: 35 (WebCore): 36 (FrameLoader): 37 * loader/ResourceLoader.cpp: 38 (WebCore::ResourceLoader::reportMemoryUsage): 39 (WebCore): 40 * loader/ResourceLoader.h: 41 (WebCore): 42 (ResourceLoader): 43 * page/Frame.cpp: 44 (WebCore::Frame::reportMemoryUsage): 45 (WebCore): 46 * page/Frame.h: 47 (WebCore): 48 (Frame): 49 * platform/SharedBuffer.cpp: 50 (WebCore::SharedBuffer::reportMemoryUsage): 51 (WebCore): 52 * platform/SharedBuffer.h: 53 (WebCore): 54 (SharedBuffer): 55 1 56 2012-07-17 Kent Tamura <tkent@chromium.org> 2 57 -
trunk/Source/WebCore/WebCore.exp.in
r122806 r122920 251 251 __ZN7WebCore14DocumentLoaderC2ERKNS_15ResourceRequestERKNS_14SubstituteDataE 252 252 __ZN7WebCore14DocumentLoaderD2Ev 253 __ZNK7WebCore14DocumentLoader17reportMemoryUsageEPNS_16MemoryObjectInfoE 253 254 __ZN7WebCore14DocumentWriter11setEncodingERKN3WTF6StringEb 254 255 __ZN7WebCore14FileIconLoader14notifyFinishedEN3WTF10PassRefPtrINS_4IconEEE -
trunk/Source/WebCore/dom/MemoryInstrumentation.h
r122735 r122920 31 31 #ifndef MemoryInstrumentation_h 32 32 #define MemoryInstrumentation_h 33 #include <stdio.h> 33 34 34 35 #include <wtf/Assertions.h> … … 51 52 CSS, 52 53 Binding, 54 Loader, 53 55 LastTypeEntry 54 56 }; … … 66 68 template <typename HashMapType> void addHashMap(const HashMapType&, ObjectType, bool contentOnly = false); 67 69 template <typename HashSetType> void addHashSet(const HashSetType&, ObjectType, bool contentOnly = false); 70 template <typename HashSetType> void addInstrumentedHashSet(const HashSetType&, ObjectType, bool contentOnly = false); 68 71 template <typename ListHashSetType> void addListHashSet(const ListHashSetType&, ObjectType, bool contentOnly = false); 69 72 template <typename VectorType> void addVector(const VectorType&, ObjectType, bool contentOnly = false); 73 void addRawBuffer(const void* const& buffer, ObjectType objectType, size_t size) 74 { 75 if (!buffer || visited(buffer)) 76 return; 77 countObjectSize(objectType, size); 78 } 70 79 71 80 protected: … … 87 96 }; 88 97 89 template <typename T> 90 void addInstrumentedMemberImpl(const T* const& object, OwningType owningType); 98 template <typename T> void addInstrumentedMemberImpl(const T* const&, OwningType); 99 template <typename T> void addInstrumentedMemberImpl(const OwnPtr<T>* const& object, MemoryInstrumentation::OwningType owningType) { addInstrumentedMemberImpl(object->get(), owningType); } 100 template <typename T> void addInstrumentedMemberImpl(const RefPtr<T>* const& object, MemoryInstrumentation::OwningType owningType) { addInstrumentedMemberImpl(object->get(), owningType); } 91 101 92 102 template <typename T> … … 165 175 template <> void MemoryInstrumentation::addMemberImpl<String>(const String* const&, MemoryInstrumentation::ObjectType, MemoryInstrumentation::OwningType); 166 176 177 167 178 template <typename T> 168 179 void MemoryInstrumentation::addInstrumentedMemberImpl(const T* const& object, MemoryInstrumentation::OwningType owningType) … … 176 187 deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object))); 177 188 } 189 178 190 179 191 template <typename T> … … 195 207 template <typename HashMapType> void addHashMap(const HashMapType& map) { m_memoryInstrumentation->addHashMap(map, m_objectType, true); } 196 208 template <typename HashSetType> void addHashSet(const HashSetType& set) { m_memoryInstrumentation->addHashSet(set, m_objectType, true); } 209 template <typename HashSetType> void addInstrumentedHashSet(const HashSetType& set) { m_memoryInstrumentation->addInstrumentedHashSet(set, m_objectType, true); } 197 210 template <typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); } 198 211 template <typename VectorType> void addVector(const VectorType& vector) { m_memoryInstrumentation->addVector(vector, m_objectType, true); } 212 void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); } 199 213 200 214 void addString(const String& string) { m_memoryInstrumentation->addString(string, m_objectType); } … … 221 235 } 222 236 237 template<typename HashSetType> 238 void MemoryInstrumentation::addInstrumentedHashSet(const HashSetType& hashSet, ObjectType objectType, bool contentOnly) 239 { 240 if (visited(&hashSet)) 241 return; 242 countObjectSize(objectType, calculateContainerSize(hashSet, contentOnly)); 243 for (typename HashSetType::const_iterator i = hashSet.begin(); i != hashSet.end(); ++i) 244 addInstrumentedMember(*i); 245 } 246 223 247 template<typename ListHashSetType> 224 248 void MemoryInstrumentation::addListHashSet(const ListHashSetType& hashSet, ObjectType objectType, bool contentOnly) … … 233 257 void MemoryInstrumentation::addVector(const VectorType& vector, ObjectType objectType, bool contentOnly) 234 258 { 235 if ( visited(vector.data()))259 if (!vector.data() || visited(vector.data())) 236 260 return; 237 261 countObjectSize(objectType, calculateContainerSize(vector, contentOnly)); … … 246 270 } 247 271 272 248 273 } // namespace WebCore 249 274 -
trunk/Source/WebCore/inspector/InspectorMemoryAgent.cpp
r122717 r122920 546 546 } 547 547 548 void visitFrame(Frame* frame) 549 { 550 m_domMemoryUsage.addInstrumentedMember(frame); 551 m_domMemoryUsage.processDeferredInstrumentedPointers(); 552 } 553 548 554 void visitBindings() 549 555 { … … 571 577 // Make sure all documents reachable from the main frame are accounted. 572 578 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext()) { 573 if (Document* doc = frame->document()) 579 if (Document* doc = frame->document()) { 574 580 domTreesIterator.visitNode(doc); 581 domTreesIterator.visitFrame(frame); 582 } 575 583 } 576 584 -
trunk/Source/WebCore/loader/DocumentLoader.cpp
r121912 r122920 48 48 #include "Logging.h" 49 49 #include "MainResourceLoader.h" 50 #include "MemoryInstrumentation.h" 50 51 #include "Page.h" 51 52 #include "PlatformString.h" … … 355 356 } 356 357 358 void DocumentLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 359 { 360 MemoryClassInfo<DocumentLoader> info(memoryObjectInfo, this, MemoryInstrumentation::Loader); 361 info.addInstrumentedMember(m_frame); 362 info.addInstrumentedMember(m_mainResourceLoader); 363 info.addInstrumentedHashSet(m_subresourceLoaders); 364 info.addInstrumentedHashSet(m_multipartSubresourceLoaders); 365 info.addInstrumentedHashSet(m_plugInStreamLoaders); 366 info.addString(m_pageTitle.string()); 367 info.addString(m_overrideEncoding); 368 info.addVector(m_responses); 369 info.addHashMap(m_pendingSubstituteResources); 370 info.addHashSet(m_resourcesClientKnowsAbout); 371 info.addVector(m_resourcesLoadedFromMemoryCacheForClientNotification); 372 info.addString(m_clientRedirectSourceForHistory); 373 info.addInstrumentedMember(m_mainResourceData); 374 } 375 357 376 bool DocumentLoader::doesProgressiveLoad(const String& MIMEType) const 358 377 { -
trunk/Source/WebCore/loader/DocumentLoader.h
r115654 r122920 56 56 class FrameLoader; 57 57 class MainResourceLoader; 58 class MemoryObjectInfo; 58 59 class Page; 59 60 class ResourceLoader; … … 243 244 ApplicationCacheHost* applicationCacheHost() const { return m_applicationCacheHost.get(); } 244 245 246 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 247 245 248 protected: 246 249 DocumentLoader(const ResourceRequest&, const SubstituteData&); -
trunk/Source/WebCore/loader/FrameLoader.cpp
r121434 r122920 78 78 #include "MIMETypeRegistry.h" 79 79 #include "MainResourceLoader.h" 80 #include "MemoryInstrumentation.h" 80 81 #include "Page.h" 81 82 #include "PageCache.h" … … 3221 3222 } 3222 3223 3224 void FrameLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 3225 { 3226 MemoryClassInfo<FrameLoader> info(memoryObjectInfo, this, MemoryInstrumentation::Loader); 3227 info.addInstrumentedMember(m_documentLoader.get()); 3228 info.addInstrumentedMember(m_provisionalDocumentLoader.get()); 3229 info.addInstrumentedMember(m_policyDocumentLoader.get()); 3230 info.addString(m_outgoingReferrer); 3231 info.addInstrumentedHashSet(m_openedFrames); 3232 } 3233 3223 3234 bool FrameLoaderClient::hasHTMLView() const 3224 3235 { -
trunk/Source/WebCore/loader/FrameLoader.h
r121434 r122920 62 62 class FrameLoaderClient; 63 63 class FrameNetworkingContext; 64 class MemoryObjectInfo; 64 65 class NavigationAction; 65 66 class NetworkingContext; … … 284 285 NetworkingContext* networkingContext() const; 285 286 287 void reportMemoryUsage(MemoryObjectInfo*) const; 288 286 289 private: 287 290 bool allChildrenAreComplete() const; // immediate children, not all descendants -
trunk/Source/WebCore/loader/ResourceLoader.cpp
r121929 r122920 529 529 #endif 530 530 531 } 531 void ResourceLoader::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 532 { 533 MemoryClassInfo<ResourceLoader> info(memoryObjectInfo, this, MemoryInstrumentation::Loader); 534 info.addMember(m_handle.get()); 535 info.addInstrumentedMember(m_frame); 536 info.addInstrumentedMember(m_documentLoader); 537 info.addMember(m_request); 538 info.addMember(m_originalRequest); 539 info.addInstrumentedMember(m_resourceData); 540 info.addMember(m_deferredRequest); 541 info.addMember(m_options); 542 } 543 544 } -
trunk/Source/WebCore/loader/ResourceLoader.h
r115223 r122920 45 45 class FrameLoader; 46 46 class KURL; 47 class MemoryObjectInfo; 47 48 class ResourceHandle; 48 49 class SharedBuffer; … … 145 146 void setShouldBufferData(DataBufferingPolicy); 146 147 148 virtual void reportMemoryUsage(MemoryObjectInfo*) const; 149 147 150 protected: 148 151 ResourceLoader(Frame*, ResourceLoaderOptions); -
trunk/Source/WebCore/page/Frame.cpp
r121388 r122920 686 686 #endif 687 687 688 void Frame::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 689 { 690 MemoryClassInfo<Frame> info(memoryObjectInfo, this, MemoryInstrumentation::DOM); 691 info.addInstrumentedMember(m_doc.get()); 692 info.addInstrumentedMember(m_loader); 693 } 694 688 695 DOMWindow* Frame::domWindow() const 689 696 { -
trunk/Source/WebCore/page/Frame.h
r120005 r122920 67 67 class FrameView; 68 68 class HTMLTableCellElement; 69 class MemoryObjectInfo; 69 70 class RegularExpression; 70 71 class RenderPart; … … 118 119 #endif 119 120 121 void reportMemoryUsage(MemoryObjectInfo*) const; 122 120 123 // ======== All public functions below this point are candidates to move out of Frame into another class. ======== 121 124 -
trunk/Source/WebCore/platform/SharedBuffer.cpp
r112642 r122920 28 28 #include "SharedBuffer.h" 29 29 30 #include "MemoryInstrumentation.h" 30 31 #include "PurgeableBuffer.h" 31 32 #include <wtf/PassOwnPtr.h> … … 246 247 } 247 248 249 void SharedBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const 250 { 251 MemoryClassInfo<SharedBuffer> info(memoryObjectInfo, this, MemoryInstrumentation::Other); 252 info.addVector(m_buffer); 253 info.addVector(m_segments); 254 for (unsigned i = 0; i < m_segments.size(); ++i) 255 info.addRawBuffer(m_segments[i], segmentSize); 256 info.addMember(m_purgeableBuffer.get()); 257 } 258 248 259 unsigned SharedBuffer::getSomeData(const char*& someData, unsigned position) const 249 260 { -
trunk/Source/WebCore/platform/SharedBuffer.h
r112642 r122920 44 44 namespace WebCore { 45 45 46 class MemoryObjectInfo; 46 47 class PurgeableBuffer; 47 48 … … 115 116 unsigned getSomeData(const char*& data, unsigned position = 0) const; 116 117 118 void reportMemoryUsage(MemoryObjectInfo*) const; 119 117 120 private: 118 121 SharedBuffer();
Note: See TracChangeset
for help on using the changeset viewer.