Changeset 150927 in webkit
- Timestamp:
- May 29, 2013 1:43:33 PM (11 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r150926 r150927 1 2013-05-29 Anders Carlsson <andersca@apple.com> 2 3 Remove unused code from PODArena 4 https://bugs.webkit.org/show_bug.cgi?id=116990 5 6 Reviewed by Sam Weinig. 7 8 PODArena is only used as a base class of PODFreeListArena so remove unused member functions and make all 9 members protected to make it impossible to use it without subclassing. 10 11 PODArena is a risky class to use since it doesn't return memory to the system unless the arena object is destroyed. 12 This was the reason why PODFreeListArea was added. An upcoming patch will merge PODArena with PODFreeListArena and 13 this is a small step towards that goal. 14 15 * platform/PODArena.h: 16 1 17 2013-05-29 Darin Adler <darin@apple.com> 2 18 -
trunk/Source/WebCore/platform/PODArena.h
r149695 r150927 44 44 45 45 class PODArena : public RefCounted<PODArena> { 46 public: 47 // Creates a new PODArena configured with a FastMallocAllocator. 48 static PassRefPtr<PODArena> create() 49 { 50 return adoptRef(new PODArena); 51 } 52 53 // Allocates an object from the arena. 54 template<class T> T* allocateObject() 55 { 56 return new (allocateBase<T>()) T(); 57 } 58 59 // Allocates an object from the arena, calling a single-argument constructor. 60 template<class T, class Argument1Type> T* allocateObject(const Argument1Type& argument1) 61 { 62 return new (allocateBase<T>()) T(argument1); 63 } 64 46 protected: 65 47 // The initial size of allocated chunks; increases as necessary to 66 48 // satisfy large allocations. Mainly public for unit tests. … … 69 51 }; 70 52 71 protected:72 53 virtual ~PODArena() { } 73 54 friend class WTF::RefCounted<PODArena>; … … 82 63 { 83 64 return WTF_ALIGN_OF(T); 84 }85 86 template<class T> void* allocateBase()87 {88 void* ptr = 0;89 size_t roundedSize = roundUp(sizeof(T), minAlignment<T>());90 if (m_current)91 ptr = m_current->allocate(roundedSize);92 93 if (!ptr) {94 if (roundedSize > m_currentChunkSize)95 m_currentChunkSize = roundedSize;96 m_chunks.append(adoptPtr(new Chunk(m_currentChunkSize)));97 m_current = m_chunks.last().get();98 ptr = m_current->allocate(roundedSize);99 }100 return ptr;101 65 } 102 66
Note: See TracChangeset
for help on using the changeset viewer.