Skip to content
  • loislo@chromium.org's avatar
    Web Inspector: NMI provide data for mixing with tcmalloc heap dumps. · e5eff8e6
    loislo@chromium.org authored
    https://bugs.webkit.org/show_bug.cgi?id=99457
    
    Reviewed by Yury Semikhatsky.
    
    Source/WebCore:
    
    countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
    getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.
    
    * inspector/InspectorClient.h:
    (WebCore::InspectorClient::dumpUncountedAllocatedObjects):
    * inspector/InspectorMemoryAgent.cpp:
    (WebCore::reportJSHeapInfo):
    (WebCore::reportRenderTreeInfo):
    (WebCore):
    (WebCore::InspectorMemoryAgent::getProcessMemoryDistribution):
    * inspector/MemoryInstrumentationImpl.cpp:
    (WebCore::MemoryInstrumentationClientImpl::countObjectSize):
    (WebCore::MemoryInstrumentationClientImpl::reportMemoryUsage):
    * inspector/MemoryInstrumentationImpl.h:
    (MemoryInstrumentationClientImpl):
    (WebCore::MemoryInstrumentationClientImpl::countedObjects):
    
    Source/WebKit/chromium:
    
    Embedder's code wraps the map with counted objects info into InstrumentedObjectSizeProvider
    and forces downstream code to make tcmalloc heap snapshot.
    The default implementation is empty.
    
    * public/WebDevToolsAgentClient.h:
    (InstrumentedObjectSizeProvider):
    (WebKit::WebDevToolsAgentClient::InstrumentedObjectSizeProvider::~InstrumentedObjectSizeProvider):
    (WebKit::WebDevToolsAgentClient::dumpUncountedAllocatedObjects):
    (WebDevToolsAgentClient):
    * src/InspectorClientImpl.cpp:
    (WebKit::InspectorClientImpl::dumpUncountedAllocatedObjects):
    (WebKit):
    * src/InspectorClientImpl.h:
    (InspectorClientImpl):
    * src/WebDevToolsAgentImpl.cpp:
    (WebKit::WebDevToolsAgentImpl::getAllocatedObjects):
    (WebKit::WebDevToolsAgentImpl::dumpUncountedAllocatedObjects):
    (WebKit):
    * src/WebDevToolsAgentImpl.h:
    (WebDevToolsAgentImpl):
    
    Source/WTF:
    
    countObjectSize now accepts ptr as the first argument and saves it into HashMap if the binary was ran with HEAPPROFILE env variable.
    getProcessMemoryDistribution does snapshot and calls the downstream code with the map of counted objects.
    
    * wtf/MemoryInstrumentation.h:
    (MemoryInstrumentationClient):
    (WTF::MemoryInstrumentation::countObjectSize):
    (WTF::MemoryInstrumentation::addRawBuffer):
    (WTF::MemoryClassInfo::addPrivateBuffer):
    (WTF::MemoryInstrumentation::addObjectImpl):
    (WTF::MemoryInstrumentation::addListHashSet):
    (WTF::::process):
    
    Tools:
    
    countObjectSize now requires pointer to object as the first argument.
    
    * TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@131869 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    e5eff8e6