Diff
Modified: trunk/Source/WTF/ChangeLog (130271 => 130272)
--- trunk/Source/WTF/ChangeLog 2012-10-03 09:52:57 UTC (rev 130271)
+++ trunk/Source/WTF/ChangeLog 2012-10-03 10:12:08 UTC (rev 130272)
@@ -1,3 +1,23 @@
+2012-10-03 Yury Semikhatsky <[email protected]>
+
+ Remove MemoryInstrumentation::addCollectionElements
+ https://bugs.webkit.org/show_bug.cgi?id=98245
+
+ Reviewed by Vsevolod Vlasov.
+
+ Removed MemoryInstrumentation::addCollectionElements and switched all call sites
+ to reportSequenceMemoryUsage.
+
+ Drive-by fix: removed some unused methods on MemoryInstrumentation.
+
+ * wtf/MemoryInstrumentation.h:
+ * wtf/MemoryInstrumentationHashSet.h:
+ (WTF::reportMemoryUsage):
+ * wtf/MemoryInstrumentationSequence.h:
+ (WTF::SequenceMemoryInstrumentationTraits::reportMemoryUsage):
+ * wtf/MemoryInstrumentationVector.h:
+ (WTF::reportMemoryUsage):
+
2012-10-02 Yury Semikhatsky <[email protected]>
Provide memory instrumentation for HashCountedSet
Modified: trunk/Source/WTF/wtf/MemoryInstrumentation.h (130271 => 130272)
--- trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-10-03 09:52:57 UTC (rev 130271)
+++ trunk/Source/WTF/wtf/MemoryInstrumentation.h 2012-10-03 10:12:08 UTC (rev 130272)
@@ -156,8 +156,6 @@
};
template<typename T> void addObject(const T& t, MemoryObjectType ownerObjectType) { OwningTraits<T>::addObject(this, t, ownerObjectType); }
- template<typename HashCountedSetType> void addHashCountedSet(const HashCountedSetType&, MemoryObjectType, bool contentOnly = false);
- template<typename CollectionType> void addInstrumentedCollection(const CollectionType&, MemoryObjectType, bool contentOnly = false);
template<typename ListHashSetType> void addListHashSet(const ListHashSetType&, MemoryObjectType, bool contentOnly = false);
void addRawBuffer(const void* const& buffer, MemoryObjectType ownerObjectType, size_t size)
{
@@ -201,18 +199,6 @@
}
template<typename M> void addMember(const M& member) { m_memoryInstrumentation->addObject(member, m_objectType); }
- template<typename I> void addCollectionElements(I iterator, I end)
- {
- while (iterator != end) {
- addMember(*iterator);
- ++iterator;
- }
- }
- void addCollectionElements(char* const*, char* const*) { }
- void addCollectionElements(const char*, const char*) { }
- void addCollectionElements(const int*, const int*) { }
-
- template<typename HashSetType> void addHashCountedSet(const HashSetType& set) { m_memoryInstrumentation->addHashCountedSet(set, m_objectType, true); }
template<typename ListHashSetType> void addListHashSet(const ListHashSetType& set) { m_memoryInstrumentation->addListHashSet(set, m_objectType, true); }
void addRawBuffer(const void* const& buffer, size_t size) { m_memoryInstrumentation->addRawBuffer(buffer, m_objectType, size); }
void addPrivateBuffer(size_t size) { m_memoryInstrumentation->countObjectSize(m_objectType, size); }
@@ -265,25 +251,6 @@
addObjectImpl(object->get(), ownerObjectType, byPointer);
}
-template<typename HashCountedSetType>
-void MemoryInstrumentation::addHashCountedSet(const HashCountedSetType& hashCountedSet, MemoryObjectType ownerObjectType, bool contentOnly)
-{
- if (visited(&hashCountedSet))
- return;
- countObjectSize(ownerObjectType, calculateContainerSize(hashCountedSet, contentOnly));
-}
-
-template<typename CollectionType>
-void MemoryInstrumentation::addInstrumentedCollection(const CollectionType& collection, MemoryObjectType ownerObjectType, bool contentOnly)
-{
- if (visited(&collection))
- return;
- countObjectSize(ownerObjectType, calculateContainerSize(collection, contentOnly));
- typename CollectionType::const_iterator end = collection.end();
- for (typename CollectionType::const_iterator i = collection.begin(); i != end; ++i)
- addObject(*i, ownerObjectType);
-}
-
template<typename ListHashSetType>
void MemoryInstrumentation::addListHashSet(const ListHashSetType& hashSet, MemoryObjectType ownerObjectType, bool contentOnly)
{
Modified: trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h (130271 => 130272)
--- trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h 2012-10-03 09:52:57 UTC (rev 130271)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationHashSet.h 2012-10-03 10:12:08 UTC (rev 130272)
@@ -32,7 +32,7 @@
#define MemoryInstrumentationHashSet_h
#include <wtf/HashSet.h>
-#include <wtf/MemoryInstrumentation.h>
+#include <wtf/MemoryInstrumentationSequence.h>
namespace WTF {
@@ -41,7 +41,7 @@
{
MemoryClassInfo info(memoryObjectInfo, hashSet);
info.addPrivateBuffer(sizeof(typename HashTable<ValueArg, ValueArg, IdentityExtractor, HashArg, TraitsArg, TraitsArg>::ValueType) * hashSet->capacity());
- info.addCollectionElements(hashSet->begin(), hashSet->end());
+ reportSequenceMemoryUsage<ValueArg, typename HashSet<ValueArg, HashArg, TraitsArg>::const_iterator>(hashSet->begin(), hashSet->end(), info);
}
}
Modified: trunk/Source/WTF/wtf/MemoryInstrumentationSequence.h (130271 => 130272)
--- trunk/Source/WTF/wtf/MemoryInstrumentationSequence.h 2012-10-03 09:52:57 UTC (rev 130271)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationSequence.h 2012-10-03 10:12:08 UTC (rev 130272)
@@ -40,7 +40,10 @@
struct SequenceMemoryInstrumentationTraits {
template <typename I> static void reportMemoryUsage(I iterator, I end, MemoryClassInfo& info)
{
- info.addCollectionElements(iterator, end);
+ while (iterator != end) {
+ info.addMember(*iterator);
+ ++iterator;
+ }
}
};
@@ -52,6 +55,10 @@
template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
};
+template<> struct SequenceMemoryInstrumentationTraits<char*> {
+ template <typename I> static void reportMemoryUsage(I, I, MemoryClassInfo&) { }
+};
+
template<typename ValueType, typename I> void reportSequenceMemoryUsage(I begin, I end, MemoryClassInfo& info)
{
// Check if type is convertible to integer to handle iteration through enum values.
Modified: trunk/Source/WTF/wtf/MemoryInstrumentationVector.h (130271 => 130272)
--- trunk/Source/WTF/wtf/MemoryInstrumentationVector.h 2012-10-03 09:52:57 UTC (rev 130271)
+++ trunk/Source/WTF/wtf/MemoryInstrumentationVector.h 2012-10-03 10:12:08 UTC (rev 130272)
@@ -31,7 +31,7 @@
#ifndef MemoryInstrumentationVector_h
#define MemoryInstrumentationVector_h
-#include <wtf/MemoryInstrumentation.h>
+#include <wtf/MemoryInstrumentationSequence.h>
#include <wtf/Vector.h>
namespace WTF {
@@ -42,7 +42,7 @@
MemoryClassInfo info(memoryObjectInfo, vector);
if (inlineCapacity < vector->capacity())
info.addRawBuffer(vector->data(), vector->capacity() * sizeof(T));
- info.addCollectionElements(vector->begin(), vector->end());
+ reportSequenceMemoryUsage<T, typename Vector<T, inlineCapacity>::const_iterator>(vector->begin(), vector->end(), info);
}
}