summaryrefslogtreecommitdiff
path: root/Source/WTF/wtf/ListHashSet.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WTF/wtf/ListHashSet.h')
-rw-r--r--Source/WTF/wtf/ListHashSet.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/Source/WTF/wtf/ListHashSet.h b/Source/WTF/wtf/ListHashSet.h
index fa654c5d9..8feef72b3 100644
--- a/Source/WTF/wtf/ListHashSet.h
+++ b/Source/WTF/wtf/ListHashSet.h
@@ -98,6 +98,8 @@ namespace WTF {
int capacity() const;
bool isEmpty() const;
+ size_t sizeInBytes() const;
+
iterator begin();
iterator end();
const_iterator begin() const;
@@ -209,15 +211,15 @@ namespace WTF {
fastFree(node);
}
- private:
- Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
- Node* pastPool() { return pool() + m_poolSize; }
-
bool inPool(Node* node)
{
return node >= pool() && node < pastPool();
}
+ private:
+ Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
+ Node* pastPool() { return pool() + m_poolSize; }
+
Node* m_freeList;
bool m_isDoneWithInitialFreeList;
static const size_t m_poolSize = inlineCapacity;
@@ -560,6 +562,18 @@ namespace WTF {
}
template<typename T, size_t inlineCapacity, typename U>
+ size_t ListHashSet<T, inlineCapacity, U>::sizeInBytes() const
+ {
+ size_t result = sizeof(*this) + sizeof(*m_allocator);
+ result += sizeof(typename ImplType::ValueType) * m_impl.capacity();
+ for (Node* node = m_head; node; node = node->m_next) {
+ if (!m_allocator->inPool(node))
+ result += sizeof(Node);
+ }
+ return result;
+ }
+
+ template<typename T, size_t inlineCapacity, typename U>
inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, inlineCapacity, U>::begin()
{
return makeIterator(m_head);