Web Inspector: Native Memory Instrumentation: replace String with const char* in...
authorloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2013 13:37:35 +0000 (13:37 +0000)
committerloislo@chromium.org <loislo@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 25 Feb 2013 13:37:35 +0000 (13:37 +0000)
commitc693095a020b61dc023d241970d15409ac3c1185
tree8fb16eff4275ed6e2fc1e3feae46492cb7e84df4
parent5e34940236c63613347e29f76c49953e305842e1
Web Inspector: Native Memory Instrumentation: replace String with const char* in MemoryObjectInfo
https://bugs.webkit.org/show_bug.cgi?id=110599

Reviewed by Yury Semikhatsky.

Due to potentially dynamic nature of names and classNames we need to make a copy of the strings
that were given us via MemoryInstrumentation calls.
So I extended client api with registerString method that pushes the strings
down to the serializer.

Source/WebCore:

* css/InspectorCSSOMWrappers.h:
* inspector/HeapGraphSerializer.cpp:
(WebCore::HeapGraphSerializer::HeapGraphSerializer):
(WebCore::HeapGraphSerializer::reportNodeImpl):
(WebCore::HeapGraphSerializer::reportEdgeImpl):
(WebCore::HeapGraphSerializer::registerString):
(WebCore::HeapGraphSerializer::registerTypeString):
(WebCore::HeapGraphSerializer::addRootNode):
* inspector/HeapGraphSerializer.h:
(HeapGraphSerializer):
* inspector/MemoryInstrumentationImpl.cpp:
(WebCore::MemoryInstrumentationClientImpl::registerString):
(WebCore):
* inspector/MemoryInstrumentationImpl.h:
(MemoryInstrumentationClientImpl):
* loader/cache/CachedResource.cpp:
(WebCore::CachedResource::reportMemoryUsage):

Source/WTF:

* wtf/MemoryInstrumentation.h:
(MemoryInstrumentationClient):
* wtf/MemoryObjectInfo.h:
(WTF::MemoryObjectInfo::MemoryObjectInfo):
(WTF::MemoryObjectInfo::setClassName):
(WTF::MemoryObjectInfo::classNameId):
(WTF::MemoryObjectInfo::setName):
(WTF::MemoryObjectInfo::nameId):
(MemoryObjectInfo):

Tools:

* TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:
* TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp:
(TestWebKitAPI::Helper::Helper):
(Helper):
(TestWebKitAPI::Helper::addNode):
(TestWebKitAPI::TEST):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@143913 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/MemoryInstrumentation.h
Source/WTF/wtf/MemoryObjectInfo.h
Source/WebCore/ChangeLog
Source/WebCore/css/InspectorCSSOMWrappers.h
Source/WebCore/inspector/HeapGraphSerializer.cpp
Source/WebCore/inspector/HeapGraphSerializer.h
Source/WebCore/inspector/MemoryInstrumentationImpl.cpp
Source/WebCore/inspector/MemoryInstrumentationImpl.h
Source/WebCore/loader/cache/CachedResource.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp
Tools/TestWebKitAPI/Tests/WebCore/HeapGraphSerializerTest.cpp