Skip to content
  • loislo@chromium.org's avatar
    Web Inspector: Native Memory Instrumentation: reportLeaf method doesn't report... · 30c4b2f6
    loislo@chromium.org authored
    Web Inspector: Native Memory Instrumentation: reportLeaf method doesn't report the leaf node properly.
    https://bugs.webkit.org/show_bug.cgi?id=109554
    
    Source/WebCore:
    
    In some cases leaves have no pointer so with the old schema we can't generate nodeId for them because we
    can't insert 0 into hashmap. It happens when we call addPrivateBuffer method.
    
    Drive by fix: I introduced a client interface for the HeapGraphSerializer.
    It helps me to do the tests for the serializer.
    
    Reviewed by Yury Semikhatsky.
    
    It is covered by newly added tests in TestWebKitAPI.
    
    * inspector/HeapGraphSerializer.cpp:
    (WebCore::HeapGraphSerializer::HeapGraphSerializer):
    (WebCore::HeapGraphSerializer::pushUpdate):
    (WebCore::HeapGraphSerializer::reportNode):
    (WebCore::HeapGraphSerializer::toNodeId):
    (WebCore::HeapGraphSerializer::addRootNode):
    * inspector/HeapGraphSerializer.h:
    (HeapGraphSerializerClient):
    (WebCore::HeapGraphSerializerClient::~HeapGraphSerializerClient):
    (HeapGraphSerializer):
    * inspector/InspectorMemoryAgent.cpp:
    (WebCore::InspectorMemoryAgent::getProcessMemoryDistributionImpl):
    
    Tools:
    
    In some cases leaves have no pointer. As example when we report a leaf via addPrivateBuffer.
    This patch has new set of tests for HeapGraphSerializer.
    
    Reviewed by Yury Semikhatsky.
    
    * TestWebKitAPI/TestWebKitAPI.gypi:
    * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
    * TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp: Added.
    * TestWebKitAPI/win/TestWebKitAPI.vcproj:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@142618 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    30c4b2f6