Web Inspector: Native Memory Instrumentation: reportLeaf method doesn't report the...
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2013 09:54:33 +0000 (09:54 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Feb 2013 09:54:33 +0000 (09:54 +0000)
commit0fac5633b3a514159701db83f32c34ad3f083abf
treede8348df38e8de55fa03e5119b09725de61037de
parent56ef350657cbf90fe7114681a210cb8aebb97b37
Web Inspector: Native Memory Instrumentation: reportLeaf method doesn't report the leaf node properly.
https://bugs.webkit.org/show_bug.cgi?id=109554

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.

Source/WebCore:

* inspector/HeapGraphSerializer.cpp:
(WebCore::HeapGraphSerializer::HeapGraphSerializer):
(WebCore::HeapGraphSerializer::pushUpdate):
(WebCore::HeapGraphSerializer::reportNode):
(WebCore::HeapGraphSerializer::toNodeId):
(WebCore::HeapGraphSerializer::addRootNode):
* inspector/HeapGraphSerializer.h:
(HeapGraphSerializer):
(Client):
(WebCore::HeapGraphSerializer::Client::~Client):
* inspector/InspectorMemoryAgent.cpp:
(WebCore):
(WebCore::InspectorMemoryAgent::getProcessMemoryDistributionImpl):

Tools:

* TestWebKitAPI/TestWebKitAPI.gypi:
* TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp: Added.
(TestWebKitAPI):
(HeapGraphReceiver):
(TestWebKitAPI::HeapGraphReceiver::HeapGraphReceiver):
(TestWebKitAPI::HeapGraphReceiver::printGraph):
(TestWebKitAPI::HeapGraphReceiver::dumpNodes):
(TestWebKitAPI::HeapGraphReceiver::dumpEdges):
(TestWebKitAPI::HeapGraphReceiver::dumpBaseToRealNodeId):
(TestWebKitAPI::HeapGraphReceiver::dumpStrings):
(TestWebKitAPI::HeapGraphReceiver::serializer):
(TestWebKitAPI::HeapGraphReceiver::chunkPart):
(TestWebKitAPI::HeapGraphReceiver::dumpPart):
(TestWebKitAPI::HeapGraphReceiver::stringValue):
(TestWebKitAPI::HeapGraphReceiver::intValue):
(TestWebKitAPI::HeapGraphReceiver::nodeToString):
(TestWebKitAPI::HeapGraphReceiver::edgeToString):
(TestWebKitAPI::HeapGraphReceiver::printNode):
(Helper):
(TestWebKitAPI::Helper::Helper):
(TestWebKitAPI::Helper::addNode):
(TestWebKitAPI::Helper::addEdge):
(TestWebKitAPI::Helper::done):
(Object):
(TestWebKitAPI::Helper::Object::Object):
(TestWebKitAPI::TEST):
(Owner):
(TestWebKitAPI::Owner::Owner):
(TestWebKitAPI::Owner::reportMemoryUsage):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143175 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/inspector/HeapGraphSerializer.cpp
Source/WebCore/inspector/HeapGraphSerializer.h
Source/WebCore/inspector/InspectorMemoryAgent.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/TestWebKitAPI.gyp/TestWebKitAPI.gyp
Tools/TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp [new file with mode: 0644]