Memory instrumentation: extract MemoryObjectInfo declaration into a separate file
authoryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2012 14:08:00 +0000 (14:08 +0000)
committeryurys@chromium.org <yurys@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 23 Nov 2012 14:08:00 +0000 (14:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=102510

Reviewed by Pavel Feldman.

Source/JavaScriptCore:

Added new symbols for the methods that have moved into .../wtf/MemoryInstrumentation.cpp

* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:

Source/WebCore:

Added necessary includes where MemoryObjectInfo declaration is required.

* platform/audio/FFTFrame.cpp:
* rendering/style/RenderStyle.cpp:
* rendering/style/StyleRareInheritedData.cpp:
* rendering/style/StyleRareNonInheritedData.cpp:

Source/WTF:

Moved MemoryObjectInfo into separate header. Moved definition of MemoryInstrumentation
methods that depend on MemoryObjectInfo declaration into MemoryInstrumentation.cpp to
make MemoryInstrumentation require only forward declaration of MemoryObjectInfo.

* GNUmakefile.list.am:
* WTF.gypi:
* WTF.pro:
* WTF.vcproj/WTF.vcproj:
* wtf/CMakeLists.txt:
* wtf/MemoryInstrumentation.cpp: Added.
(WTF):
(WTF::MemoryInstrumentation::MemoryInstrumentation):
(WTF::MemoryInstrumentation::~MemoryInstrumentation):
(WTF::MemoryInstrumentation::getObjectType): this method allows to get object type without
pulling in MemoryObjectInfo.h and all its dependencies.
(WTF::MemoryInstrumentation::callReportObjectInfo):
(WTF::MemoryInstrumentation::InstrumentedPointerBase::InstrumentedPointerBase):
(WTF::MemoryInstrumentation::InstrumentedPointerBase::process):
(WTF::MemoryClassInfo::init):
(WTF::MemoryClassInfo::addRawBuffer):
(WTF::MemoryClassInfo::addPrivateBuffer):
* wtf/MemoryInstrumentation.h:
(MemoryInstrumentation):
(WTF::MemoryInstrumentation::addRootObject):
(InstrumentedPointerBase):
(WTF::MemoryInstrumentation::reportObjectMemoryUsage):
(InstrumentedPointer):
(WTF::MemoryInstrumentation::addObject): we now pass owner's MemoryObjectInfo in all places
where we report objects pointed by the owner.
(WTF::MemoryInstrumentation::OwningTraits::addObject):
(WTF::MemoryClassInfo::MemoryClassInfo):
(WTF::MemoryClassInfo::addMember):
(MemoryClassInfo):
(WTF::MemoryInstrumentation::addObjectImpl):
(WTF::::InstrumentedPointer):
(WTF::::callReportMemoryUsage):
* wtf/MemoryObjectInfo.h: Added.
(WTF):
(MemoryObjectInfo):
(WTF::MemoryObjectInfo::MemoryObjectInfo):
(WTF::MemoryObjectInfo::objectType):
(WTF::MemoryObjectInfo::objectSize):
(WTF::MemoryObjectInfo::reportedPointer):
(WTF::MemoryObjectInfo::memoryInstrumentation):
(WTF::MemoryObjectInfo::reportObjectInfo):

Tools:

Added missing includes.

* TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@135603 268f45cc-cd09-0410-ab3c-d52691b4dbfc

20 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/WTF/ChangeLog
Source/WTF/GNUmakefile.list.am
Source/WTF/WTF.gypi
Source/WTF/WTF.pro
Source/WTF/WTF.vcproj/WTF.vcproj
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/MemoryInstrumentation.cpp [new file with mode: 0644]
Source/WTF/wtf/MemoryInstrumentation.h
Source/WTF/wtf/MemoryObjectInfo.h [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/platform/audio/FFTFrame.cpp
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Tools/ChangeLog
Tools/TestWebKitAPI/GNUmakefile.am
Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp

index 6172c55317cb5f94fd8b0ba305ef5c85e4f079bf..ad1e421314a1f64172d2e9361d63c71962b8398f 100644 (file)
@@ -1,3 +1,14 @@
+2012-11-16  Yury Semikhatsky  <yurys@chromium.org>
+
+        Memory instrumentation: extract MemoryObjectInfo declaration into a separate file
+        https://bugs.webkit.org/show_bug.cgi?id=102510
+
+        Reviewed by Pavel Feldman.
+
+        Added new symbols for the methods that have moved into .../wtf/MemoryInstrumentation.cpp
+
+        * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
+
 2012-11-23  Julien BRIANCEAU   <jbrianceau@nds.com>
 
         [sh4] JavaScriptCore JIT build is broken since r130839
index 94b8c23715d6b750d3ea7288e448da02670b4d21..7aa5673d8e58570dfade2baba5f0e25fe49428bf 100755 (executable)
@@ -12,6 +12,7 @@ EXPORTS
     ??0DynamicGlobalObjectScope@JSC@@QAE@AAVJSGlobalData@1@PAVJSGlobalObject@1@@Z 
     ??0ErrorHandlingMode@Interpreter@JSC@@QAE@PAVExecState@2@@Z
     ??1ErrorHandlingMode@Interpreter@JSC@@QAE@XZ
+    ??0InstrumentedPointerBase@MemoryInstrumentation@WTF@@QAE@PAVMemoryObjectInfo@2@@Z
     ??0InternalFunction@JSC@@IAE@PAVJSGlobalObject@1@PAVStructure@1@@Z
     ??0JSGlobalObject@JSC@@IAE@AAVJSGlobalData@1@PAVStructure@1@PBUGlobalObjectMethodTable@1@@Z
     ??0JSLockHolder@JSC@@QAE@AAVJSGlobalData@1@@Z
@@ -19,6 +20,7 @@ EXPORTS
     ??0JSLockHolder@JSC@@QAE@PAVJSGlobalData@1@@Z
     ??0MD5@WTF@@QAE@XZ
     ??0MediaTime@WTF@@QAE@_JHI@Z 
+    ??0MemoryInstrumentation@WTF@@QAE@PAVMemoryInstrumentationClient@1@@Z
     ??0Mutex@WTF@@QAE@XZ
     ??0ParallelEnvironment@WTF@@QAE@P6AXPAX@ZIH@Z
     ??0RefCountedLeakCounter@WTF@@QAE@PBD@Z
@@ -38,6 +40,7 @@ EXPORTS
     ??1JSGlobalObject@JSC@@QAE@XZ
     ??1JSLockHolder@JSC@@QAE@XZ
     ??1MediaTime@WTF@@QAE@XZ 
+    ??1MemoryInstrumentation@WTF@@UAE@XZ
     ??1Mutex@WTF@@QAE@XZ
     ??1RefCountedLeakCounter@WTF@@QAE@XZ
     ??1SourceProviderCache@JSC@@QAE@XZ
@@ -65,6 +68,8 @@ EXPORTS
     ?addPropertyTransition@Structure@JSC@@SAPAV12@AAVJSGlobalData@2@PAV12@VPropertyName@2@IPAVJSCell@2@AAH@Z
     ?addPropertyTransitionToExistingStructure@Structure@JSC@@SAPAV12@PAV12@VPropertyName@2@IPAVJSCell@2@AAH@Z
     ?addPropertyWithoutTransition@Structure@JSC@@QAEHAAVJSGlobalData@2@VPropertyName@2@IPAVJSCell@2@@Z
+    ?addPrivateBuffer@MemoryClassInfo@WTF@@QAEXIPBD@Z
+    ?addRawBuffer@MemoryClassInfo@WTF@@QAEXABQBXI@Z
     ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVExecState@2@PAVStringImpl@4@@Z
     ?addSlowCase@Identifier@JSC@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@WTF@@PAVJSGlobalData@2@PAVStringImpl@4@@Z
     ?addStaticGlobals@JSGlobalObject@JSC@@IAEXPAUGlobalPropertyInfo@12@H@Z
@@ -94,6 +99,7 @@ EXPORTS
     ?callHostFunctionAsConstructor@JSC@@YI_JPAVExecState@1@@Z
     ?callOnMainThread@WTF@@YAXP6AXPAX@Z0@Z
     ?callOnMainThreadAndWait@WTF@@YAXP6AXPAX@Z0@Z
+    ?callReportObjectInfo@MemoryInstrumentation@WTF@@CAXPAVMemoryObjectInfo@2@PBXPBDI@Z
     ?cancelCallOnMainThread@WTF@@YAXP6AXPAX@Z0@Z
     ?canShrink@StringBuilder@WTF@@QBE_NXZ
     ?capacity@Heap@JSC@@QAEIXZ
@@ -220,6 +226,7 @@ EXPORTS
     ?getCallData@JSCell@JSC@@SA?AW4CallType@2@PAV12@AATCallData@2@@Z
     ?getConstructData@JSCell@JSC@@SA?AW4ConstructType@2@PAV12@AATConstructData@2@@Z
     ?getObject@JSCell@JSC@@QAEPAVJSObject@2@XZ
+    ?getObjectType@MemoryInstrumentation@WTF@@CAPBDPAVMemoryObjectInfo@2@@Z
     ?getOwnNonIndexPropertyNames@JSObject@JSC@@SAXPAV12@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
     ?getOwnNonIndexPropertyNames@JSSymbolTableObject@JSC@@SAXPAVJSObject@2@PAVExecState@2@AAVPropertyNameArray@2@W4EnumerationMode@2@@Z
     ?getOwnPropertyDescriptor@JSGlobalObject@JSC@@SA_NPAVJSObject@2@PAVExecState@2@VPropertyName@2@AAVPropertyDescriptor@2@@Z
@@ -251,6 +258,7 @@ EXPORTS
     ?indefiniteTime@MediaTime@WTF@@SAABV12@XZ 
     ?init@AtomicString@WTF@@SAXXZ
     ?init@JSGlobalObject@JSC@@AAEXPAVJSObject@2@@Z
+    ?init@MemoryClassInfo@WTF@@AAEXPBXPBDI@Z
     ?initialize@double_conversion@WTF@@YAXXZ
     ?initializeMainThread@WTF@@YAXXZ
     ?initializeThreading@JSC@@YAXXZ
@@ -292,6 +300,7 @@ EXPORTS
     ?parseDateFromNullTerminatedCharacters@WTF@@YANPBD@Z
     ?parseDoubleFromLongString@Internal@WTF@@YANPB_WIAAI@Z
     ?positiveInfiniteTime@MediaTime@WTF@@SAABV12@XZ 
+    ?process@InstrumentedPointerBase@MemoryInstrumentation@WTF@@QAEXPAV23@@Z
     ?profiler@Profiler@JSC@@SAPAV12@XZ
     ?protect@Heap@JSC@@QAEXVJSValue@2@@Z
     ?protectedGlobalObjectCount@Heap@JSC@@QAEIXZ
index 39d9ad1fbf5bec3bf94e1ea2d2c37b279f29361f..69fba76d6a94230e6f3ffff5c4d04a21654c887e 100644 (file)
@@ -1,3 +1,56 @@
+2012-11-16  Yury Semikhatsky  <yurys@chromium.org>
+
+        Memory instrumentation: extract MemoryObjectInfo declaration into a separate file
+        https://bugs.webkit.org/show_bug.cgi?id=102510
+
+        Reviewed by Pavel Feldman.
+
+        Moved MemoryObjectInfo into separate header. Moved definition of MemoryInstrumentation
+        methods that depend on MemoryObjectInfo declaration into MemoryInstrumentation.cpp to
+        make MemoryInstrumentation require only forward declaration of MemoryObjectInfo.
+
+        * GNUmakefile.list.am:
+        * WTF.gypi:
+        * WTF.pro:
+        * WTF.vcproj/WTF.vcproj:
+        * wtf/CMakeLists.txt:
+        * wtf/MemoryInstrumentation.cpp: Added.
+        (WTF):
+        (WTF::MemoryInstrumentation::MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::~MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::getObjectType): this method allows to get object type without
+        pulling in MemoryObjectInfo.h and all its dependencies.
+        (WTF::MemoryInstrumentation::callReportObjectInfo):
+        (WTF::MemoryInstrumentation::InstrumentedPointerBase::InstrumentedPointerBase):
+        (WTF::MemoryInstrumentation::InstrumentedPointerBase::process):
+        (WTF::MemoryClassInfo::init):
+        (WTF::MemoryClassInfo::addRawBuffer):
+        (WTF::MemoryClassInfo::addPrivateBuffer):
+        * wtf/MemoryInstrumentation.h:
+        (MemoryInstrumentation):
+        (WTF::MemoryInstrumentation::addRootObject):
+        (InstrumentedPointerBase):
+        (WTF::MemoryInstrumentation::reportObjectMemoryUsage):
+        (InstrumentedPointer):
+        (WTF::MemoryInstrumentation::addObject): we now pass owner's MemoryObjectInfo in all places
+        where we report objects pointed by the owner.
+        (WTF::MemoryInstrumentation::OwningTraits::addObject):
+        (WTF::MemoryClassInfo::MemoryClassInfo):
+        (WTF::MemoryClassInfo::addMember):
+        (MemoryClassInfo):
+        (WTF::MemoryInstrumentation::addObjectImpl):
+        (WTF::::InstrumentedPointer):
+        (WTF::::callReportMemoryUsage):
+        * wtf/MemoryObjectInfo.h: Added.
+        (WTF):
+        (MemoryObjectInfo):
+        (WTF::MemoryObjectInfo::MemoryObjectInfo):
+        (WTF::MemoryObjectInfo::objectType):
+        (WTF::MemoryObjectInfo::objectSize):
+        (WTF::MemoryObjectInfo::reportedPointer):
+        (WTF::MemoryObjectInfo::memoryInstrumentation):
+        (WTF::MemoryObjectInfo::reportObjectInfo):
+
 2012-11-23  Krzysztof Czech  <k.czech@samsung.com>
 
         [EFL] Platform support for Accessibility feature.
index 9d4f0d7e5b079a2cdaf0c5350a90abc2c5999cfe..f9db8c02c140819ab6fe0da28154d6ee3e36a1e2 100644 (file)
@@ -80,6 +80,7 @@ wtf_sources += \
     Source/WTF/wtf/MathExtras.h \
     Source/WTF/wtf/MediaTime.h \
     Source/WTF/wtf/MediaTime.cpp \
+    Source/WTF/wtf/MemoryInstrumentation.cpp \
     Source/WTF/wtf/MemoryInstrumentation.h \
     Source/WTF/wtf/MemoryInstrumentationArrayBufferView.h \
     Source/WTF/wtf/MemoryInstrumentationHashCountedSet.h \
@@ -90,6 +91,7 @@ wtf_sources += \
     Source/WTF/wtf/MemoryInstrumentationSequence.h \
     Source/WTF/wtf/MemoryInstrumentationString.h \
     Source/WTF/wtf/MemoryInstrumentationVector.h \
+    Source/WTF/wtf/MemoryObjectInfo.h \
     Source/WTF/wtf/MessageQueue.h \
     Source/WTF/wtf/MetaAllocator.cpp \
     Source/WTF/wtf/MetaAllocator.h \
index f54077d840f99a2c631268ea927a6c77031e4752..28eb576647452decaf8d60e2f68fd97fb15c8f9d 100644 (file)
@@ -50,6 +50,7 @@
             'wtf/MD5.h',
             'wtf/MainThread.h',
             'wtf/MathExtras.h',
+            'wtf/MemoryInstrumentation.cpp',
             'wtf/MemoryInstrumentation.h',
             'wtf/MemoryInstrumentationArrayBufferView.h',
             'wtf/MemoryInstrumentationHashCountedSet.h',
@@ -60,6 +61,7 @@
             'wtf/MemoryInstrumentationSequence.h',
             'wtf/MemoryInstrumentationString.h',
             'wtf/MemoryInstrumentationVector.h',
+            'wtf/MemoryObjectInfo.h',
             'wtf/MessageQueue.h',
             'wtf/NonCopyingSort.h',
             'wtf/Noncopyable.h',
index 8bd303b1c059bd3b64058643ffbf7bc0e0b66d47..80cff2ab32b69d09b265335a90463d9da7e38c81 100644 (file)
@@ -97,6 +97,7 @@ HEADERS += \
     MemoryInstrumentationSequence.h \
     MemoryInstrumentationString.h \
     MemoryInstrumentationVector.h \
+    MemoryObjectInfo.h \
     MessageQueue.h \
     MetaAllocator.h \
     MetaAllocatorHandle.h \
@@ -214,6 +215,7 @@ SOURCES += \
     MD5.cpp \
     MainThread.cpp \
     MediaTime.cpp \
+    MemoryInstrumentation.cpp \
     MetaAllocator.cpp \
     NullPtr.cpp \
     NumberOfCores.cpp \
index e547fc232ad64940a7b38b96dc00d48c3c0dff0e..68633af42c5844a2f28f65b3a7bf02d98b4e8516 100644 (file)
                        RelativePath="..\wtf\MediaTime.cpp"
                        >
                </File>
+               <File
+                       RelativePath="..\wtf\MemoryInstrumentation.cpp"
+                       >
+               </File>
                <File
                        RelativePath="..\wtf\MemoryInstrumentation.h"
                        >
                        RelativePath="..\wtf\MemoryInstrumentationVector.h"
                        >
                </File>
+               <File
+                       RelativePath="..\wtf\MemoryObjectInfo.h"
+                       >
+               </File>
                <File
                        RelativePath="..\wtf\MessageQueue.h"
                        >
index 8aeebed6995a4a1767a0ecd3334c8cecb8281750..b27631d1fcd37ab5e17d0ff32bb39ab21b963a5f 100644 (file)
                CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */ = {isa = PBXBuildFile; fileRef = CD5497AA15857D0300B5BC30 /* MediaTime.cpp */; };
                CD5497AD15857D0300B5BC30 /* MediaTime.h in Headers */ = {isa = PBXBuildFile; fileRef = CD5497AB15857D0300B5BC30 /* MediaTime.h */; };
                EB95E1F0161A72410089A2F5 /* ByteOrder.h in Headers */ = {isa = PBXBuildFile; fileRef = EB95E1EF161A72410089A2F5 /* ByteOrder.h */; };
+               F322CCDF165699FF004852DD /* MemoryInstrumentation.cpp in Sources */ = {isa = PBXBuildFile; fileRef = F322CCDE165699FF004852DD /* MemoryInstrumentation.cpp */; };
+               F322CCE116569A10004852DD /* MemoryObjectInfo.h in Headers */ = {isa = PBXBuildFile; fileRef = F322CCE016569A10004852DD /* MemoryObjectInfo.h */; };
                F3525E2A16149FF400278BC1 /* MemoryInstrumentationListHashSet.h in Headers */ = {isa = PBXBuildFile; fileRef = F3525E2916149FF400278BC1 /* MemoryInstrumentationListHashSet.h */; };
                F3525E461619A4EE00278BC1 /* MemoryInstrumentationHashMap.h in Headers */ = {isa = PBXBuildFile; fileRef = F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */; };
                F3FBC71E161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h in Headers */ = {isa = PBXBuildFile; fileRef = F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */; };
                CD5497AA15857D0300B5BC30 /* MediaTime.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MediaTime.cpp; sourceTree = "<group>"; };
                CD5497AB15857D0300B5BC30 /* MediaTime.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaTime.h; sourceTree = "<group>"; };
                EB95E1EF161A72410089A2F5 /* ByteOrder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ByteOrder.h; sourceTree = "<group>"; };
+               F322CCDE165699FF004852DD /* MemoryInstrumentation.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MemoryInstrumentation.cpp; sourceTree = "<group>"; };
+               F322CCE016569A10004852DD /* MemoryObjectInfo.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryObjectInfo.h; sourceTree = "<group>"; };
                F3525E2916149FF400278BC1 /* MemoryInstrumentationListHashSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationListHashSet.h; sourceTree = "<group>"; };
                F3525E451619A4EE00278BC1 /* MemoryInstrumentationHashMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashMap.h; sourceTree = "<group>"; };
                F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MemoryInstrumentationHashCountedSet.h; sourceTree = "<group>"; };
                                A8A472CB151A825B004123FF /* MD5.h */,
                                CD5497AA15857D0300B5BC30 /* MediaTime.cpp */,
                                CD5497AB15857D0300B5BC30 /* MediaTime.h */,
+                               F322CCDE165699FF004852DD /* MemoryInstrumentation.cpp */,
                                4F1D115315FF11BE0026E908 /* MemoryInstrumentation.h */,
                                4FD8554616133E0E00C5B704 /* MemoryInstrumentationArrayBufferView.h */,
                                F3FBC71D161AF7BF00BB4BD4 /* MemoryInstrumentationHashCountedSet.h */,
                                F3FBC71F161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h */,
                                4FCF27E016172E8600CBF037 /* MemoryInstrumentationString.h */,
                                4FCB7109160A1A07008425EC /* MemoryInstrumentationVector.h */,
+                               F322CCE016569A10004852DD /* MemoryObjectInfo.h */,
                                A8A472CC151A825B004123FF /* MessageQueue.h */,
                                A8A472CD151A825B004123FF /* MetaAllocator.cpp */,
                                A8A472CE151A825B004123FF /* MetaAllocator.h */,
                                F3FBC720161AF7CD00BB4BD4 /* MemoryInstrumentationSequence.h in Headers */,
                                4FCF27E116172E8600CBF037 /* MemoryInstrumentationString.h in Headers */,
                                4FCB710A160A1A07008425EC /* MemoryInstrumentationVector.h in Headers */,
+                               F322CCE116569A10004852DD /* MemoryObjectInfo.h in Headers */,
                                A8A473EB151A825B004123FF /* MessageQueue.h in Headers */,
                                A8A473ED151A825B004123FF /* MetaAllocator.h in Headers */,
                                A8A473EE151A825B004123FF /* MetaAllocatorHandle.h in Headers */,
                                A8A473E4151A825B004123FF /* MainThreadMac.mm in Sources */,
                                A8A473E9151A825B004123FF /* MD5.cpp in Sources */,
                                CD5497AC15857D0300B5BC30 /* MediaTime.cpp in Sources */,
+                               F322CCDF165699FF004852DD /* MemoryInstrumentation.cpp in Sources */,
                                A8A473EC151A825B004123FF /* MetaAllocator.cpp in Sources */,
                                A8A473F2151A825B004123FF /* NullPtr.cpp in Sources */,
                                A8A473F4151A825B004123FF /* NumberOfCores.cpp in Sources */,
index da8ded93bd4609bd438ff949e666979452506745..cafe1044b01dc93d42d8fa88a4f216ca106cb2dd 100644 (file)
@@ -46,6 +46,17 @@ SET(WTF_HEADERS
     MallocZoneSupport.h
     MathExtras.h
     MediaTime.h
+    MemoryInstrumentation.h
+    MemoryInstrumentationArrayBufferView.h
+    MemoryInstrumentationHashCountedSet.h
+    MemoryInstrumentationHashMap.h
+    MemoryInstrumentationHashSet.h
+    MemoryInstrumentationListHashSet.h
+    MemoryInstrumentationParsedURL.h
+    MemoryInstrumentationSequence.h
+    MemoryInstrumentationString.h
+    MemoryInstrumentationVector.h
+    MemoryObjectInfo.h
     MessageQueue.h
     MetaAllocator.h
     MetaAllocatorHandle.h
@@ -157,6 +168,7 @@ SET(WTF_SOURCES
     MediaTime.cpp
     MetaAllocator.cpp
     OSRandomSource.cpp
+    MemoryInstrumentation.cpp
     NumberOfCores.cpp
     RAMSize.cpp
     PageAllocationAligned.cpp
diff --git a/Source/WTF/wtf/MemoryInstrumentation.cpp b/Source/WTF/wtf/MemoryInstrumentation.cpp
new file mode 100644 (file)
index 0000000..d4be2b6
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "MemoryInstrumentation.h"
+
+#include <wtf/MemoryObjectInfo.h>
+
+#if DEBUG_POINTER_INSTRUMENTATION
+#include <stdio.h>
+#include <wtf/Assertions.h>
+#endif
+
+namespace WTF {
+
+MemoryInstrumentation::MemoryInstrumentation(MemoryInstrumentationClient* client)
+    : m_client(client)
+    , m_rootObjectInfo(adoptPtr(new MemoryObjectInfo(this, 0)))
+{
+}
+
+MemoryInstrumentation::~MemoryInstrumentation()
+{
+}
+
+MemoryObjectType MemoryInstrumentation::getObjectType(MemoryObjectInfo* objectInfo)
+{
+    return objectInfo->objectType();
+}
+
+void MemoryInstrumentation::callReportObjectInfo(MemoryObjectInfo* memoryObjectInfo, const void* pointer, MemoryObjectType objectType, size_t objectSize)
+{
+    memoryObjectInfo->reportObjectInfo(pointer, objectType, objectSize);
+}
+
+MemoryInstrumentation::InstrumentedPointerBase::InstrumentedPointerBase(MemoryObjectInfo* memoryObjectInfo)
+    : m_ownerObjectType(memoryObjectInfo->objectType())
+{
+#if DEBUG_POINTER_INSTRUMENTATION
+    m_callStackSize = s_maxCallStackSize;
+    WTFGetBacktrace(m_callStack, &m_callStackSize);
+#endif
+}
+
+void MemoryInstrumentation::InstrumentedPointerBase::process(MemoryInstrumentation* memoryInstrumentation)
+{
+    MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType);
+    const void* originalPointer = callReportMemoryUsage(&memoryObjectInfo);
+
+    const void* pointer = memoryObjectInfo.reportedPointer();
+    ASSERT(pointer);
+    if (pointer != originalPointer && memoryInstrumentation->visited(pointer))
+        return;
+    memoryInstrumentation->countObjectSize(pointer, memoryObjectInfo.objectType(), memoryObjectInfo.objectSize());
+    if (!memoryInstrumentation->checkCountedObject(pointer)) {
+#if DEBUG_POINTER_INSTRUMENTATION
+        fputs("Unknown object counted:\n", stderr);
+        WTFPrintBacktrace(m_callStack, m_callStackSize);
+#endif
+    }
+}
+
+void MemoryClassInfo::init(const void* pointer, MemoryObjectType objectType, size_t actualSize)
+{
+    m_memoryObjectInfo->reportObjectInfo(pointer, objectType, actualSize);
+    m_memoryInstrumentation = m_memoryObjectInfo->memoryInstrumentation();
+    m_objectType = m_memoryObjectInfo->objectType();
+}
+
+void MemoryClassInfo::addRawBuffer(const void* const& buffer, size_t size)
+{
+    m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size);
+}
+
+void MemoryClassInfo::addPrivateBuffer(size_t size, MemoryObjectType ownerObjectType)
+{
+    if (!size)
+        return;
+    if (!ownerObjectType)
+        ownerObjectType = m_objectType;
+    m_memoryInstrumentation->countObjectSize(0, ownerObjectType, size);
+}
+
+} // namespace WTF
index 1c38243e6b155628f393967ed0b6af366b25e9c6..2a6832b71f6ce73dfb356d6c678950f97448c02c 100644 (file)
 
 #define DEBUG_POINTER_INSTRUMENTATION 0
 
-#if DEBUG_POINTER_INSTRUMENTATION
-#include <wtf/Assertions.h>
-#include <stdio.h>
-#endif
-
 namespace WTF {
 
 class MemoryClassInfo;
@@ -55,43 +50,6 @@ enum MemoryOwningType {
     byReference
 };
 
-class MemoryObjectInfo {
-public:
-    MemoryObjectInfo(MemoryInstrumentation* memoryInstrumentation, MemoryObjectType ownerObjectType)
-        : m_memoryInstrumentation(memoryInstrumentation)
-        , m_objectType(ownerObjectType)
-        , m_objectSize(0)
-        , m_pointer(0)
-    { }
-
-    typedef MemoryClassInfo ClassInfo;
-
-    MemoryObjectType objectType() const { return m_objectType; }
-    size_t objectSize() const { return m_objectSize; }
-    const void* reportedPointer() const { return m_pointer; }
-
-    MemoryInstrumentation* memoryInstrumentation() { return m_memoryInstrumentation; }
-
-private:
-    friend class MemoryClassInfo;
-    friend class MemoryInstrumentation;
-
-    void reportObjectInfo(const void* pointer, MemoryObjectType objectType, size_t objectSize)
-    {
-        if (!m_objectSize) {
-            m_pointer = pointer;
-            m_objectSize = objectSize;
-            if (objectType)
-                m_objectType = objectType;
-        }
-    }
-
-    MemoryInstrumentation* m_memoryInstrumentation;
-    MemoryObjectType m_objectType;
-    size_t m_objectSize;
-    const void* m_pointer;
-};
-
 template<typename T> void reportMemoryUsage(const T* const&, MemoryObjectInfo*);
 
 class MemoryInstrumentationClient {
@@ -104,20 +62,32 @@ public:
 
 class MemoryInstrumentation {
 public:
-    explicit MemoryInstrumentation(MemoryInstrumentationClient* client) : m_client(client) { }
-    virtual ~MemoryInstrumentation() { }
+    WTF_EXPORT_PRIVATE explicit MemoryInstrumentation(MemoryInstrumentationClient*);
+    WTF_EXPORT_PRIVATE virtual ~MemoryInstrumentation();
 
-    template <typename T> void addRootObject(const T& t, MemoryObjectType objectType = 0)
+    template <typename T> void addRootObject(const T& t)
     {
-        addObject(t, objectType);
+        addObject(t, m_rootObjectInfo.get());
         processDeferredInstrumentedPointers();
     }
 
 protected:
     class InstrumentedPointerBase {
     public:
+        WTF_EXPORT_PRIVATE explicit InstrumentedPointerBase(MemoryObjectInfo*);
         virtual ~InstrumentedPointerBase() { }
-        virtual void process(MemoryInstrumentation*) = 0;
+        WTF_EXPORT_PRIVATE void process(MemoryInstrumentation*);
+
+    protected:
+        virtual const void* callReportMemoryUsage(MemoryObjectInfo*) = 0;
+
+    private:
+        const MemoryObjectType m_ownerObjectType;
+#if DEBUG_POINTER_INSTRUMENTATION
+        static const int s_maxCallStackSize = 32;
+        void* m_callStack[s_maxCallStackSize];
+        int m_callStackSize;
+#endif
     };
 
 private:
@@ -128,6 +98,8 @@ private:
     virtual void deferInstrumentedPointer(PassOwnPtr<InstrumentedPointerBase>) = 0;
     virtual void processDeferredInstrumentedPointers() = 0;
 
+    WTF_EXPORT_PRIVATE static MemoryObjectType getObjectType(MemoryObjectInfo*);
+
     friend class MemoryClassInfo;
     template<typename T> friend void reportMemoryUsage(const T* const&, MemoryObjectInfo*);
 
@@ -148,29 +120,22 @@ private:
     template<typename T, typename Type>
     static void reportObjectMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInfo, ...)
     {
-        memoryObjectInfo->reportObjectInfo(object, 0, sizeof(T));
+        callReportObjectInfo(memoryObjectInfo, object, 0, sizeof(T));
     }
-
-    template<typename T>
-    static void countNotInstrumentedObject(const T* const&, MemoryObjectInfo*);
+    WTF_EXPORT_PRIVATE static void callReportObjectInfo(MemoryObjectInfo*, const void* pointer, MemoryObjectType, size_t objectSize);
 
     template<typename T> class InstrumentedPointer : public InstrumentedPointerBase {
     public:
-        InstrumentedPointer(const T* pointer, MemoryObjectType ownerObjectType);
-        virtual void process(MemoryInstrumentation*) OVERRIDE;
+        InstrumentedPointer(const T* pointer, MemoryObjectInfo* ownerObjectInfo);
+
+    protected:
+        virtual const void* callReportMemoryUsage(MemoryObjectInfo*) OVERRIDE;
 
     private:
         const T* m_pointer;
-        const MemoryObjectType m_ownerObjectType;
-
-#if DEBUG_POINTER_INSTRUMENTATION
-        static const int s_maxCallStackSize = 32;
-        void* m_callStack[s_maxCallStackSize];
-        int m_callStackSize;
-#endif
     };
 
-    template<typename T> void addObject(const T& t, MemoryObjectType ownerObjectType) { OwningTraits<T>::addObject(this, t, ownerObjectType); }
+    template<typename T> void addObject(const T& t, MemoryObjectInfo* ownerObjectInfo) { OwningTraits<T>::addObject(this, t, ownerObjectInfo); }
     void addRawBuffer(const void* const& buffer, MemoryObjectType ownerObjectType, size_t size)
     {
         if (!buffer || visited(buffer))
@@ -180,49 +145,48 @@ private:
 
     template<typename T>
     struct OwningTraits { // Default byReference implementation.
-        static void addObject(MemoryInstrumentation* instrumentation, const T& t, MemoryObjectType ownerObjectType)
+        static void addObject(MemoryInstrumentation* instrumentation, const T& t, MemoryObjectInfo* ownerObjectInfo)
         {
-            instrumentation->addObjectImpl(&t, ownerObjectType, byReference);
+            instrumentation->addObjectImpl(&t, ownerObjectInfo, byReference);
         }
     };
 
     template<typename T>
     struct OwningTraits<T*> { // Custom byPointer implementation.
-        static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryObjectType ownerObjectType)
+        static void addObject(MemoryInstrumentation* instrumentation, const T* const& t, MemoryObjectInfo* ownerObjectInfo)
         {
-            instrumentation->addObjectImpl(t, ownerObjectType, byPointer);
+            instrumentation->addObjectImpl(t, ownerObjectInfo, byPointer);
         }
     };
 
-    template<typename T> void addObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType);
-    template<typename T> void addObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType);
-    template<typename T> void addObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType);
+    template<typename T> void addObjectImpl(const T* const&, MemoryObjectInfo*, MemoryOwningType);
+    template<typename T> void addObjectImpl(const OwnPtr<T>* const&, MemoryObjectInfo*, MemoryOwningType);
+    template<typename T> void addObjectImpl(const RefPtr<T>* const&, MemoryObjectInfo*, MemoryOwningType);
 
     MemoryInstrumentationClient* m_client;
+    OwnPtr<MemoryObjectInfo> m_rootObjectInfo;
 };
 
 class MemoryClassInfo {
 public:
     template<typename T>
-    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* pointer, MemoryObjectType objectType = 0, size_t actualSize = 0)
+    MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T* pointer, MemoryObjectType objectType = 0, size_t actualSize = sizeof(T))
         : m_memoryObjectInfo(memoryObjectInfo)
-        , m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
+        , m_memoryInstrumentation(0)
+        , m_objectType(0)
     {
-        m_memoryObjectInfo->reportObjectInfo(pointer, objectType, actualSize ? actualSize : sizeof(T));
-        m_objectType = memoryObjectInfo->objectType();
+        init(pointer, objectType, actualSize);
     }
 
-    template<typename M> void addMember(const M& member) { m_memoryInstrumentation->addObject(member, m_objectType); }
-    void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
-    void addPrivateBuffer(size_t size, MemoryObjectType ownerObjectType = 0)
-    {
-        if (size)
-            m_memoryInstrumentation->countObjectSize(0, ownerObjectType ? ownerObjectType : m_objectType, size);
-    }
+    template<typename M> void addMember(const M& member) { m_memoryInstrumentation->addObject(member, m_memoryObjectInfo); }
+    WTF_EXPORT_PRIVATE void addRawBuffer(const void* const& buffer, size_t);
+    WTF_EXPORT_PRIVATE void addPrivateBuffer(size_t, MemoryObjectType ownerObjectType = 0);
 
     void addWeakPointer(void*) { }
 
 private:
+    WTF_EXPORT_PRIVATE void init(const void* pointer, MemoryObjectType, size_t actualSize);
+
     MemoryObjectInfo* m_memoryObjectInfo;
     MemoryInstrumentation* m_memoryInstrumentation;
     MemoryObjectType m_objectType;
@@ -235,62 +199,45 @@ void reportMemoryUsage(const T* const& object, MemoryObjectInfo* memoryObjectInf
 }
 
 template<typename T>
-void MemoryInstrumentation::addObjectImpl(const T* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+void MemoryInstrumentation::addObjectImpl(const T* const& object, MemoryObjectInfo* ownerObjectInfo, MemoryOwningType owningType)
 {
-    if (owningType == byReference) {
-        MemoryObjectInfo memoryObjectInfo(this, ownerObjectType);
-        reportMemoryUsage(object, &memoryObjectInfo);
-    } else {
+    if (owningType == byReference)
+        reportMemoryUsage(object, ownerObjectInfo);
+    else {
         if (!object || visited(object))
             return;
-        deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object, ownerObjectType)));
+        deferInstrumentedPointer(adoptPtr(new InstrumentedPointer<T>(object, ownerObjectInfo)));
     }
 }
 
 template<typename T>
-void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectInfo* ownerObjectInfo, MemoryOwningType owningType)
 {
     if (owningType == byPointer && !visited(object))
-        countObjectSize(object, ownerObjectType, sizeof(*object));
-    addObjectImpl(object->get(), ownerObjectType, byPointer);
+        countObjectSize(object, getObjectType(ownerObjectInfo), sizeof(*object));
+    addObjectImpl(object->get(), ownerObjectInfo, byPointer);
 }
 
 template<typename T>
-void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
+void MemoryInstrumentation::addObjectImpl(const RefPtr<T>* const& object, MemoryObjectInfo* ownerObjectInfo, MemoryOwningType owningType)
 {
     if (owningType == byPointer && !visited(object))
-        countObjectSize(object, ownerObjectType, sizeof(*object));
-    addObjectImpl(object->get(), ownerObjectType, byPointer);
+        countObjectSize(object, getObjectType(ownerObjectInfo), sizeof(*object));
+    addObjectImpl(object->get(), ownerObjectInfo, byPointer);
 }
 
 template<typename T>
-MemoryInstrumentation::InstrumentedPointer<T>::InstrumentedPointer(const T* pointer, MemoryObjectType ownerObjectType)
-    : m_pointer(pointer)
-    , m_ownerObjectType(ownerObjectType)
+MemoryInstrumentation::InstrumentedPointer<T>::InstrumentedPointer(const T* pointer, MemoryObjectInfo* ownerObjectInfo)
+    : InstrumentedPointerBase(ownerObjectInfo)
+    , m_pointer(pointer)
 {
-#if DEBUG_POINTER_INSTRUMENTATION
-    m_callStackSize = s_maxCallStackSize;
-    WTFGetBacktrace(m_callStack, &m_callStackSize);
-#endif
 }
 
 template<typename T>
-void MemoryInstrumentation::InstrumentedPointer<T>::process(MemoryInstrumentation* memoryInstrumentation)
+const void* MemoryInstrumentation::InstrumentedPointer<T>::callReportMemoryUsage(MemoryObjectInfo* memoryObjectInfo)
 {
-    MemoryObjectInfo memoryObjectInfo(memoryInstrumentation, m_ownerObjectType);
-    reportMemoryUsage(m_pointer, &memoryObjectInfo);
-
-    const void* pointer = memoryObjectInfo.reportedPointer();
-    ASSERT(pointer);
-    if (pointer != m_pointer && memoryInstrumentation->visited(pointer))
-        return;
-    memoryInstrumentation->countObjectSize(pointer, memoryObjectInfo.objectType(), memoryObjectInfo.objectSize());
-    if (!memoryInstrumentation->checkCountedObject(pointer)) {
-#if DEBUG_POINTER_INSTRUMENTATION
-        fputs("Unknown object counted:\n", stderr);
-        WTFPrintBacktrace(m_callStack, m_callStackSize);
-#endif
-    }
+    reportMemoryUsage(m_pointer, memoryObjectInfo);
+    return m_pointer;
 }
 
 // Link time guard for classes with external memory instrumentation.
@@ -329,6 +276,4 @@ void reportMemoryUsage(const URLString* const&, MemoryObjectInfo*);
 
 } // namespace WTF
 
-#undef DEBUG_POINTER_INSTRUMENTATION
-
 #endif // !defined(MemoryInstrumentation_h)
diff --git a/Source/WTF/wtf/MemoryObjectInfo.h b/Source/WTF/wtf/MemoryObjectInfo.h
new file mode 100644 (file)
index 0000000..1c7fe6c
--- /dev/null
@@ -0,0 +1,80 @@
+/*
+ * Copyright (C) 2012 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ *     * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef MemoryObjectInfo_h
+#define MemoryObjectInfo_h
+
+namespace WTF {
+
+class MemoryClassInfo;
+class MemoryInstrumentation;
+
+typedef const char* MemoryObjectType;
+
+class MemoryObjectInfo {
+public:
+    MemoryObjectInfo(MemoryInstrumentation* memoryInstrumentation, MemoryObjectType ownerObjectType)
+        : m_memoryInstrumentation(memoryInstrumentation)
+        , m_objectType(ownerObjectType)
+        , m_objectSize(0)
+        , m_pointer(0)
+    { }
+
+    typedef MemoryClassInfo ClassInfo;
+
+    MemoryObjectType objectType() const { return m_objectType; }
+    size_t objectSize() const { return m_objectSize; }
+    const void* reportedPointer() const { return m_pointer; }
+
+    MemoryInstrumentation* memoryInstrumentation() { return m_memoryInstrumentation; }
+
+private:
+    friend class MemoryClassInfo;
+    friend class MemoryInstrumentation;
+
+    void reportObjectInfo(const void* pointer, MemoryObjectType objectType, size_t objectSize)
+    {
+        if (!m_objectSize) {
+            m_pointer = pointer;
+            m_objectSize = objectSize;
+            if (objectType)
+                m_objectType = objectType;
+        }
+    }
+
+    MemoryInstrumentation* m_memoryInstrumentation;
+    MemoryObjectType m_objectType;
+    size_t m_objectSize;
+    const void* m_pointer;
+};
+
+} // namespace WTF
+
+#endif // !defined(MemoryObjectInfo_h)
index 5d35714fad92c8e77f00b6241153f9ef2443e895..2a84fa4366218a924b35295b561e3e0f70b03894 100644 (file)
@@ -1,3 +1,17 @@
+2012-11-16  Yury Semikhatsky  <yurys@chromium.org>
+
+        Memory instrumentation: extract MemoryObjectInfo declaration into a separate file
+        https://bugs.webkit.org/show_bug.cgi?id=102510
+
+        Reviewed by Pavel Feldman.
+
+        Added necessary includes where MemoryObjectInfo declaration is required.
+
+        * platform/audio/FFTFrame.cpp:
+        * rendering/style/RenderStyle.cpp:
+        * rendering/style/StyleRareInheritedData.cpp:
+        * rendering/style/StyleRareNonInheritedData.cpp:
+
 2012-11-23  Dan Carney  <dcarney@google.com>
 
         Remove V8DOMWindowShell::getEntered
index 63c87ddc92961caa0e846975b6205b911179ffc9..eee45de8ab3d2c02b1e26723c364b0df90dd5c98 100644 (file)
@@ -40,6 +40,7 @@
 #include "PlatformMemoryInstrumentation.h"
 #include <wtf/Complex.h>
 #include <wtf/MathExtras.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/OwnPtr.h>
 
 #if !USE_ACCELERATE_FFT && USE(WEBAUDIO_FFMPEG)
index d7f41816ad03b8b1eb08affb9822bac8e206050b..6ecaa0417a80abf0126ec1565c20fbd26f0123a4 100644 (file)
@@ -41,6 +41,7 @@
 #endif
 #include "WebCoreMemoryInstrumentation.h"
 #include <wtf/MemoryInstrumentationVector.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/StdLibExtras.h>
 #include <algorithm>
 
index b1ba5986a4922fdc5535b1a4db475ec2724eaf7d..434e3ccf083790e8cb5c532c2dbb4b1ed4a138bc 100644 (file)
@@ -28,6 +28,7 @@
 #include "RenderStyleConstants.h"
 #include "ShadowData.h"
 #include "WebCoreMemoryInstrumentation.h"
+#include <wtf/MemoryObjectInfo.h>
 
 namespace WebCore {
 
index 1c6cb1879b2d95c8580a9918e3bdfa63782736c4..ed9e9a2efd49f0d244f8bca22625ec6a4e3fda5c 100644 (file)
@@ -33,6 +33,7 @@
 #include "WebCoreMemoryInstrumentation.h"
 #include <wtf/MemoryInstrumentationHashMap.h>
 #include <wtf/MemoryInstrumentationVector.h>
+#include <wtf/MemoryObjectInfo.h>
 
 namespace WebCore {
 
index 59f37ca698aef3f7acf470e22d9ff366fd9fb5eb..49b14413fb543269703b0bb760c60f693963ffb3 100644 (file)
@@ -1,3 +1,14 @@
+2012-11-16  Yury Semikhatsky  <yurys@chromium.org>
+
+        Memory instrumentation: extract MemoryObjectInfo declaration into a separate file
+        https://bugs.webkit.org/show_bug.cgi?id=102510
+
+        Reviewed by Pavel Feldman.
+
+        Added missing includes.
+
+        * TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp:
+
 2012-11-23  Sudarsana Nagineni  <sudarsana.nagineni@intel.com>
 
         [EFL][WK2] Add support for PlatformWebView::simulateSpacebarKeyPress() in TestWebKitAPI
index 759ccb9e05a8582a07045cf3bfba5f13c7f51148..01b11587839fd41c50f3e24c2e1a9cbf09ac7b9b 100644 (file)
@@ -54,7 +54,6 @@ Programs_TestWebKitAPI_TestWTF_SOURCES = \
        Tools/TestWebKitAPI/Tests/WTF/IntegerToStringConversion.cpp \
        Tools/TestWebKitAPI/Tests/WTF/MathExtras.cpp \
        Tools/TestWebKitAPI/Tests/WTF/MediaTime.cpp \
-       Tools/TestWebKitAPI/Tests/WTF/MemoryInstrumentationTest.cpp \
        Tools/TestWebKitAPI/Tests/WTF/RedBlackTree.cpp \
        Tools/TestWebKitAPI/Tests/WTF/SaturatedArithmeticOperations.cpp \
        Tools/TestWebKitAPI/Tests/WTF/StringBuilder.cpp \
index 7348062d914726e901a3d5057b9a7bb027712ba4..dad08dda45d72ecfde874b63d33014fb792905ee 100644 (file)
@@ -45,6 +45,7 @@
 #include <wtf/MemoryInstrumentationListHashSet.h>
 #include <wtf/MemoryInstrumentationString.h>
 #include <wtf/MemoryInstrumentationVector.h>
+#include <wtf/MemoryObjectInfo.h>
 #include <wtf/RefCounted.h>
 #include <wtf/Vector.h>
 #include <wtf/text/AtomicString.h>