Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1385)

Side by Side Diff: Source/wtf/ListHashSet.h

Issue 13973026: remove memoryinstrumentation Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: remove the rest part of MemoryInstrumentation Created 7 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/wtf/Forward.h ('k') | Source/wtf/MemoryInstrumentation.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed. 2 * Copyright (C) 2005, 2006, 2007, 2008, 2011, 2012 Apple Inc. All rights reserv ed.
3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com> 3 * Copyright (C) 2011, Benjamin Poulain <ikipou@gmail.com>
4 * 4 *
5 * This library is free software; you can redistribute it and/or 5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public 6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either 7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version. 8 * version 2 of the License, or (at your option) any later version.
9 * 9 *
10 * This library is distributed in the hope that it will be useful, 10 * This library is distributed in the hope that it will be useful,
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
87 ListHashSet(const ListHashSet&); 87 ListHashSet(const ListHashSet&);
88 ListHashSet& operator=(const ListHashSet&); 88 ListHashSet& operator=(const ListHashSet&);
89 ~ListHashSet(); 89 ~ListHashSet();
90 90
91 void swap(ListHashSet&); 91 void swap(ListHashSet&);
92 92
93 int size() const; 93 int size() const;
94 int capacity() const; 94 int capacity() const;
95 bool isEmpty() const; 95 bool isEmpty() const;
96 96
97 size_t sizeInBytes() const;
98
99 iterator begin(); 97 iterator begin();
100 iterator end(); 98 iterator end();
101 const_iterator begin() const; 99 const_iterator begin() const;
102 const_iterator end() const; 100 const_iterator end() const;
103 101
104 reverse_iterator rbegin(); 102 reverse_iterator rbegin();
105 reverse_iterator rend(); 103 reverse_iterator rend();
106 const_reverse_iterator rbegin() const; 104 const_reverse_iterator rbegin() const;
107 const_reverse_iterator rend() const; 105 const_reverse_iterator rend() const;
108 106
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 node->m_isAllocated = false; 209 node->m_isAllocated = false;
212 #endif 210 #endif
213 node->m_next = m_freeList; 211 node->m_next = m_freeList;
214 m_freeList = node; 212 m_freeList = node;
215 return; 213 return;
216 } 214 }
217 215
218 fastFree(node); 216 fastFree(node);
219 } 217 }
220 218
219 private:
220 Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
221 Node* pastPool() { return pool() + m_poolSize; }
221 bool inPool(Node* node) 222 bool inPool(Node* node)
222 { 223 {
223 return node >= pool() && node < pastPool(); 224 return node >= pool() && node < pastPool();
224 } 225 }
225 226
226 private:
227 Node* pool() { return reinterpret_cast_ptr<Node*>(m_pool.pool); }
228 Node* pastPool() { return pool() + m_poolSize; }
229
230 Node* m_freeList; 227 Node* m_freeList;
231 bool m_isDoneWithInitialFreeList; 228 bool m_isDoneWithInitialFreeList;
232 static const size_t m_poolSize = inlineCapacity; 229 static const size_t m_poolSize = inlineCapacity;
233 union { 230 union {
234 char pool[sizeof(Node) * m_poolSize]; 231 char pool[sizeof(Node) * m_poolSize];
235 double forAlignment; 232 double forAlignment;
236 } m_pool; 233 } m_pool;
237 }; 234 };
238 235
239 template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode { 236 template<typename ValueArg, size_t inlineCapacity> struct ListHashSetNode {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 return m_impl.capacity(); 559 return m_impl.capacity();
563 } 560 }
564 561
565 template<typename T, size_t inlineCapacity, typename U> 562 template<typename T, size_t inlineCapacity, typename U>
566 inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const 563 inline bool ListHashSet<T, inlineCapacity, U>::isEmpty() const
567 { 564 {
568 return m_impl.isEmpty(); 565 return m_impl.isEmpty();
569 } 566 }
570 567
571 template<typename T, size_t inlineCapacity, typename U> 568 template<typename T, size_t inlineCapacity, typename U>
572 size_t ListHashSet<T, inlineCapacity, U>::sizeInBytes() const
573 {
574 size_t result = sizeof(*this) + sizeof(*m_allocator);
575 result += sizeof(typename ImplType::ValueType) * m_impl.capacity();
576 for (Node* node = m_head; node; node = node->m_next) {
577 if (!m_allocator->inPool(node))
578 result += sizeof(Node);
579 }
580 return result;
581 }
582
583 template<typename T, size_t inlineCapacity, typename U>
584 inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, i nlineCapacity, U>::begin() 569 inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, i nlineCapacity, U>::begin()
585 { 570 {
586 return makeIterator(m_head); 571 return makeIterator(m_head);
587 } 572 }
588 573
589 template<typename T, size_t inlineCapacity, typename U> 574 template<typename T, size_t inlineCapacity, typename U>
590 inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, i nlineCapacity, U>::end() 575 inline typename ListHashSet<T, inlineCapacity, U>::iterator ListHashSet<T, i nlineCapacity, U>::end()
591 { 576 {
592 return makeIterator(0); 577 return makeIterator(0);
593 } 578 }
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
919 inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collect ion) 904 inline void deleteAllValues(const ListHashSet<T, inlineCapacity, U>& collect ion)
920 { 905 {
921 deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueT ype>(collection.m_impl); 906 deleteAllValues<true, typename ListHashSet<T, inlineCapacity, U>::ValueT ype>(collection.m_impl);
922 } 907 }
923 908
924 } // namespace WTF 909 } // namespace WTF
925 910
926 using WTF::ListHashSet; 911 using WTF::ListHashSet;
927 912
928 #endif /* WTF_ListHashSet_h */ 913 #endif /* WTF_ListHashSet_h */
OLDNEW
« no previous file with comments | « Source/wtf/Forward.h ('k') | Source/wtf/MemoryInstrumentation.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698