Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Web Inspector: Native Memory Instrumentation: instrument not instrume…
…nted members.

https://bugs.webkit.org/show_bug.cgi?id=105830

Reviewed by Vsevolod Vlasov.

In some cases we don't want to visit some class members.
As example we decided to skip pointers to interface classes such as GraphicLayerClient.
We could use addWeakPointer for them but it can't be used for nonpointer members.
In the offline discussion we came to a conclusion that we need a new instrumentation
method ignoreMember, which will be used for all the members which we won't like to visit/instrument.

DriveBy: Also I instrumented not yet instrumented members.

Source/WebCore:

* bindings/v8/DOMWrapperMap.h:
(WebCore::DOMWrapperMap::reportMemoryUsage):
* bindings/v8/ScriptWrappable.h:
(WebCore::ScriptWrappable::reportMemoryUsage):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::reportMemoryUsage):
* platform/KURLGoogle.cpp:
(WebCore::KURLGooglePrivate::reportMemoryUsage):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::reportMemoryUsage):
* platform/audio/AudioArray.h:
(WebCore::AudioArray::reportMemoryUsage):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::reportMemoryUsage):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::reportMemoryUsage):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::RowStruct::reportMemoryUsage):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::reportMemoryUsage):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::reportMemoryUsage):

Source/WTF:

* wtf/MemoryInstrumentation.h:
(MemoryClassInfo):
(WTF::MemoryClassInfo::ignoreMember):

Canonical link: https://commits.webkit.org/124045@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@138561 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
loislo committed Dec 29, 2012
1 parent c74346f commit c7b5204
Show file tree
Hide file tree
Showing 14 changed files with 78 additions and 3 deletions.
19 changes: 19 additions & 0 deletions Source/WTF/ChangeLog
@@ -1,3 +1,22 @@
2012-12-28 Ilya Tikhonovsky <loislo@chromium.org>

Web Inspector: Native Memory Instrumentation: instrument not instrumented members.
https://bugs.webkit.org/show_bug.cgi?id=105830

Reviewed by Vsevolod Vlasov.

In some cases we don't want to visit some class members.
As example we decided to skip pointers to interface classes such as GraphicLayerClient.
We could use addWeakPointer for them but it can't be used for nonpointer members.
In the offline discussion we came to a conclusion that we need a new instrumentation
method ignoreMember, which will be used for all the members which we won't like to visit/instrument.

DriveBy: Also I instrumented not yet instrumented members.

* wtf/MemoryInstrumentation.h:
(MemoryClassInfo):
(WTF::MemoryClassInfo::ignoreMember):

2012-12-26 Gyuyoung Kim <gyuyoung.kim@samsung.com>

Fix build warning in OSAllocatorPosix.cpp
Expand Down
2 changes: 2 additions & 0 deletions Source/WTF/wtf/MemoryInstrumentation.h
Expand Up @@ -243,11 +243,13 @@ class MemoryClassInfo {
if (!m_skipMembers)
m_memoryInstrumentation->addObject(member, m_memoryObjectInfo, edgeName);
}

WTF_EXPORT_PRIVATE void addRawBuffer(const void* buffer, size_t, const char* nodeName = 0, const char* edgeName = 0);
WTF_EXPORT_PRIVATE void addPrivateBuffer(size_t, MemoryObjectType ownerObjectType = 0, const char* nodeName = 0, const char* edgeName = 0);
WTF_EXPORT_PRIVATE void setCustomAllocation(bool);

void addWeakPointer(void*) { }
template<typename M> void ignoreMember(const M&) { }

private:
WTF_EXPORT_PRIVATE void init(const void* pointer, MemoryObjectType, size_t actualSize);
Expand Down
38 changes: 38 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,41 @@
2012-12-28 Ilya Tikhonovsky <loislo@chromium.org>

Web Inspector: Native Memory Instrumentation: instrument not instrumented members.
https://bugs.webkit.org/show_bug.cgi?id=105830

Reviewed by Vsevolod Vlasov.

In some cases we don't want to visit some class members.
As example we decided to skip pointers to interface classes such as GraphicLayerClient.
We could use addWeakPointer for them but it can't be used for nonpointer members.
In the offline discussion we came to a conclusion that we need a new instrumentation
method ignoreMember, which will be used for all the members which we won't like to visit/instrument.

DriveBy: Also I instrumented not yet instrumented members.

* bindings/v8/DOMWrapperMap.h:
(WebCore::DOMWrapperMap::reportMemoryUsage):
* bindings/v8/ScriptWrappable.h:
(WebCore::ScriptWrappable::reportMemoryUsage):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::reportMemoryUsage):
* platform/KURLGoogle.cpp:
(WebCore::KURLGooglePrivate::reportMemoryUsage):
* platform/SharedBuffer.cpp:
(WebCore::SharedBuffer::reportMemoryUsage):
* platform/audio/AudioArray.h:
(WebCore::AudioArray::reportMemoryUsage):
* platform/graphics/GraphicsLayer.cpp:
(WebCore::GraphicsLayer::reportMemoryUsage):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::reportMemoryUsage):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::RowStruct::reportMemoryUsage):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::reportMemoryUsage):
* rendering/style/StyleRareInheritedData.cpp:
(WebCore::StyleRareInheritedData::reportMemoryUsage):

2012-12-29 Andrey Lushnikov <lushnikov@chromium.com>

Web Inspector: refactor DefaultTextEditor - annotate handlers and fix getters style
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/bindings/v8/DOMWrapperMap.h
Expand Up @@ -77,6 +77,7 @@ class DOMWrapperMap {
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::Binding);
info.addMember(m_map);
info.ignoreMember(m_callback);
}

void remove(KeyType* key, v8::Persistent<v8::Object> wrapper)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/bindings/v8/ScriptWrappable.h
Expand Up @@ -69,7 +69,7 @@ class ScriptWrappable {
void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::DOM);
info.addWeakPointer(const_cast<v8::Persistent<v8::Object>*>(&m_wrapper));
info.ignoreMember(m_wrapper);
}

private:
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/html/HTMLMediaElement.cpp
Expand Up @@ -4768,6 +4768,10 @@ void HTMLMediaElement::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) con
#if PLATFORM(MAC)
info.addMember(m_sleepDisabler);
#endif
#if ENABLE(WEB_AUDIO)
info.addMember(m_audioSourceNode);
#endif

}

}
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/platform/KURLGoogle.cpp
Expand Up @@ -397,6 +397,7 @@ void KURLGooglePrivate::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) co
info.addMember(m_utf8);
info.addMember(m_string);
info.addMember(m_innerURL);
info.addMember(m_parsed);
}
// KURL ------------------------------------------------------------------------

Expand Down
4 changes: 2 additions & 2 deletions Source/WebCore/platform/SharedBuffer.cpp
Expand Up @@ -278,10 +278,10 @@ void SharedBuffer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this);
info.addMember(m_buffer);
info.addMember(m_segments);
for (unsigned i = 0; i < m_segments.size(); ++i)
info.addRawBuffer(m_segments[i], segmentSize);
info.addMember(m_purgeableBuffer.get());
info.addMember(m_segments);
info.addMember(m_purgeableBuffer);
}

unsigned SharedBuffer::getSomeData(const char*& someData, unsigned position) const
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/platform/audio/AudioArray.h
Expand Up @@ -147,6 +147,7 @@ class AudioArray {
{
typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
info.addRawBuffer(m_allocation, m_size * sizeof(T));
info.ignoreMember(m_alignedData);
}

private:
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/platform/graphics/GraphicsLayer.cpp
Expand Up @@ -730,6 +730,8 @@ void GraphicsLayer::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
info.addMember(m_maskLayer);
info.addMember(m_replicaLayer);
info.addMember(m_replicatedLayer);
info.ignoreMember(m_client);
info.addMember(m_name);
}

} // namespace WebCore
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/RenderLayerCompositor.cpp
Expand Up @@ -60,6 +60,7 @@
#include "TiledBacking.h"
#include "TransformState.h"
#include "WebCoreMemoryInstrumentation.h"
#include <wtf/MemoryInstrumentationHashMap.h>

#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
#include "HTMLMediaElement.h"
Expand Down Expand Up @@ -2810,6 +2811,7 @@ void RenderLayerCompositor::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo
info.addMember(m_contentShadowLayer);
#endif
info.addMember(m_layerUpdater);
info.addMember(m_fixedPositionLayerNotCompositedReasonMap);
}

} // namespace WebCore
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/rendering/RenderTableSection.cpp
Expand Up @@ -1457,6 +1457,7 @@ void RenderTableSection::RowStruct::reportMemoryUsage(MemoryObjectInfo* memoryOb
MemoryClassInfo info(memoryObjectInfo, this, PlatformMemoryTypes::Rendering);
info.addMember(row);
info.addMember(rowRenderer);
info.addMember(logicalHeight);
}

void RenderTableSection::CellStruct::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/style/RenderStyle.cpp
Expand Up @@ -1600,6 +1600,8 @@ void RenderStyle::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
#if ENABLE(SVG)
info.addMember(m_svgStyle);
#endif
info.addMember(inherited_flags);
info.addMember(noninherited_flags);
}

} // namespace WebCore
2 changes: 2 additions & 0 deletions Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Expand Up @@ -292,6 +292,8 @@ bool StyleRareInheritedData::shadowDataEquivalent(const StyleRareInheritedData&
void StyleRareInheritedData::reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
{
MemoryClassInfo info(memoryObjectInfo, this, WebCoreMemoryTypes::CSS);
info.addMember(listStyleImage);
info.addMember(indent);
info.addMember(textShadow);
info.addMember(highlight);
info.addMember(cursorData);
Expand Down

0 comments on commit c7b5204

Please sign in to comment.