Modified: trunk/Source/WebCore/dom/MemoryInstrumentation.h (127855 => 127856)
--- trunk/Source/WebCore/dom/MemoryInstrumentation.h 2012-09-07 12:05:30 UTC (rev 127855)
+++ trunk/Source/WebCore/dom/MemoryInstrumentation.h 2012-09-07 12:10:22 UTC (rev 127856)
@@ -1,4 +1,3 @@
-
/*
* Copyright (C) 2012 Google Inc. All rights reserved.
*
@@ -40,8 +39,8 @@
namespace WebCore {
-template<typename T> class DataRef;
class KURL;
+class MemoryClassInfo;
class MemoryObjectInfo;
class MemoryInstrumentation;
@@ -146,12 +145,10 @@
};
template<typename T> void addInstrumentedObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType);
- template<typename T> void addInstrumentedObjectImpl(const DataRef<T>* const&, MemoryObjectType, MemoryOwningType);
template<typename T> void addInstrumentedObjectImpl(const OwnPtr<T>* const&, MemoryObjectType, MemoryOwningType);
template<typename T> void addInstrumentedObjectImpl(const RefPtr<T>* const&, MemoryObjectType, MemoryOwningType);
template<typename T> void addObjectImpl(const T* const&, MemoryObjectType, MemoryOwningType);
- template<typename T> void addObjectImpl(const DataRef<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);
};
@@ -176,6 +173,8 @@
, m_objectSize(0)
{ }
+ typedef MemoryClassInfo ClassInfo;
+
MemoryObjectType objectType() const { return m_objectType; }
size_t objectSize() const { return m_objectSize; }
@@ -201,7 +200,7 @@
class MemoryClassInfo {
public:
template<typename T>
- MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryObjectType objectType, size_t actualSize = 0)
+ MemoryClassInfo(MemoryObjectInfo* memoryObjectInfo, const T*, MemoryObjectType objectType = 0, size_t actualSize = 0)
: m_memoryObjectInfo(memoryObjectInfo)
, m_memoryInstrumentation(memoryObjectInfo->memoryInstrumentation())
{
@@ -246,14 +245,6 @@
}
template<typename T>
-void MemoryInstrumentation::addInstrumentedObjectImpl(const DataRef<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
-{
- if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(*object));
- addInstrumentedObjectImpl(object->get(), ownerObjectType, byPointer);
-}
-
-template<typename T>
void MemoryInstrumentation::addInstrumentedObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
{
if (owningType == byPointer)
@@ -270,14 +261,6 @@
}
template<typename T>
-void MemoryInstrumentation::addObjectImpl(const DataRef<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
-{
- if (owningType == byPointer)
- countObjectSize(ownerObjectType, sizeof(*object));
- addObjectImpl(object->get(), ownerObjectType, byPointer);
-}
-
-template<typename T>
void MemoryInstrumentation::addObjectImpl(const OwnPtr<T>* const& object, MemoryObjectType ownerObjectType, MemoryOwningType owningType)
{
if (owningType == byPointer)
Modified: trunk/Source/WebCore/rendering/style/DataRef.h (127855 => 127856)
--- trunk/Source/WebCore/rendering/style/DataRef.h 2012-09-07 12:05:30 UTC (rev 127855)
+++ trunk/Source/WebCore/rendering/style/DataRef.h 2012-09-07 12:10:22 UTC (rev 127856)
@@ -62,6 +62,14 @@
return m_data != o.m_data && *m_data != *o.m_data;
}
+ // Template helps us to write the implementation without MemoryInstrumentation.h include.
+ template<typename MemoryObjectInfo>
+ void reportMemoryUsage(MemoryObjectInfo* memoryObjectInfo) const
+ {
+ typename MemoryObjectInfo::ClassInfo info(memoryObjectInfo, this);
+ info.addInstrumentedMember(m_data);
+ }
+
private:
RefPtr<T> m_data;
};