diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-11-07 11:22:47 +0100 |
commit | cfd86b747d32ac22246a1aa908eaa720c63a88c1 (patch) | |
tree | 24d68c6f61c464ecba1e05670b80390ea3b0e50c /Source/WTF/wtf/ListHashSet.h | |
parent | 69d7c744c9de19d152dbe2d8e46eb7dfd4511d1a (diff) | |
download | qtwebkit-cfd86b747d32ac22246a1aa908eaa720c63a88c1.tar.gz |
Imported WebKit commit 20271caf2e2c016d5cef40184cddeefeac4f1876 (http://svn.webkit.org/repository/webkit/trunk@133733)
New snapshot that contains all previous fixes as well as build fix for latest QtMultimedia API changes.
Diffstat (limited to 'Source/WTF/wtf/ListHashSet.h')
-rw-r--r-- | Source/WTF/wtf/ListHashSet.h | 22 |
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); |