Title: [149695] trunk/Source/WebCore
- Revision
- 149695
- Author
- [email protected]
- Date
- 2013-05-07 15:06:15 -0700 (Tue, 07 May 2013)
Log Message
Remove custom allocator support from PODArena
https://bugs.webkit.org/show_bug.cgi?id=115762
Reviewed by Andreas Kling.
Nobody uses PODArena with a custom allocator, so just get rid of it and always use fastMalloc/fastFree.
* platform/PODArena.h:
(WebCore::PODArena::PODArena):
(WebCore::PODArena::allocateBase):
(WebCore::PODArena::Chunk::Chunk):
(WebCore::PODArena::Chunk::~Chunk):
(Chunk):
* platform/PODFreeListArena.h:
(WebCore::PODFreeListArena::allocate):
(WebCore::PODFreeListArena::FreeListChunk::FreeListChunk):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (149694 => 149695)
--- trunk/Source/WebCore/ChangeLog 2013-05-07 22:04:01 UTC (rev 149694)
+++ trunk/Source/WebCore/ChangeLog 2013-05-07 22:06:15 UTC (rev 149695)
@@ -1,5 +1,24 @@
2013-05-07 Anders Carlsson <[email protected]>
+ Remove custom allocator support from PODArena
+ https://bugs.webkit.org/show_bug.cgi?id=115762
+
+ Reviewed by Andreas Kling.
+
+ Nobody uses PODArena with a custom allocator, so just get rid of it and always use fastMalloc/fastFree.
+
+ * platform/PODArena.h:
+ (WebCore::PODArena::PODArena):
+ (WebCore::PODArena::allocateBase):
+ (WebCore::PODArena::Chunk::Chunk):
+ (WebCore::PODArena::Chunk::~Chunk):
+ (Chunk):
+ * platform/PODFreeListArena.h:
+ (WebCore::PODFreeListArena::allocate):
+ (WebCore::PODFreeListArena::FreeListChunk::FreeListChunk):
+
+2013-05-07 Anders Carlsson <[email protected]>
+
Clean up KeyframeValueList and related classes
https://bugs.webkit.org/show_bug.cgi?id=115738
Modified: trunk/Source/WebCore/platform/PODArena.h (149694 => 149695)
--- trunk/Source/WebCore/platform/PODArena.h 2013-05-07 22:04:01 UTC (rev 149694)
+++ trunk/Source/WebCore/platform/PODArena.h 2013-05-07 22:06:15 UTC (rev 149695)
@@ -44,45 +44,12 @@
class PODArena : public RefCounted<PODArena> {
public:
- // The arena is configured with an allocator, which is responsible
- // for allocating and freeing chunks of memory at a time.
- class Allocator : public RefCounted<Allocator> {
- public:
- virtual void* allocate(size_t size) = 0;
- virtual void free(void* ptr) = 0;
- protected:
- virtual ~Allocator() { }
- friend class WTF::RefCounted<Allocator>;
- };
-
- // The Arena's default allocator, which uses fastMalloc and
- // fastFree to allocate chunks of storage.
- class FastMallocAllocator : public Allocator {
- public:
- static PassRefPtr<FastMallocAllocator> create()
- {
- return adoptRef(new FastMallocAllocator);
- }
-
- virtual void* allocate(size_t size) { return fastMalloc(size); }
- virtual void free(void* ptr) { fastFree(ptr); }
-
- protected:
- FastMallocAllocator() { }
- };
-
// Creates a new PODArena configured with a FastMallocAllocator.
static PassRefPtr<PODArena> create()
{
return adoptRef(new PODArena);
}
- // Creates a new PODArena configured with the given Allocator.
- static PassRefPtr<PODArena> create(PassRefPtr<Allocator> allocator)
- {
- return adoptRef(new PODArena(allocator));
- }
-
// Allocates an object from the arena.
template<class T> T* allocateObject()
{
@@ -106,15 +73,9 @@
friend class WTF::RefCounted<PODArena>;
PODArena()
- : m_allocator(FastMallocAllocator::create())
- , m_current(0)
+ : m_current(0)
, m_currentChunkSize(DefaultChunkSize) { }
- explicit PODArena(PassRefPtr<Allocator> allocator)
- : m_allocator(allocator)
- , m_current(0)
- , m_currentChunkSize(DefaultChunkSize) { }
-
// Returns the alignment requirement for classes and structs on the
// current platform.
template <class T> static size_t minAlignment()
@@ -132,7 +93,7 @@
if (!ptr) {
if (roundedSize > m_currentChunkSize)
m_currentChunkSize = roundedSize;
- m_chunks.append(adoptPtr(new Chunk(m_allocator.get(), m_currentChunkSize)));
+ m_chunks.append(adoptPtr(new Chunk(m_currentChunkSize)));
m_current = m_chunks.last().get();
ptr = m_current->allocate(roundedSize);
}
@@ -152,19 +113,18 @@
public:
// Allocates a block of memory of the given size from the passed
// Allocator.
- Chunk(Allocator* allocator, size_t size)
- : m_allocator(allocator)
- , m_size(size)
+ Chunk(size_t size)
+ : m_size(size)
, m_currentOffset(0)
{
- m_base = static_cast<uint8_t*>(m_allocator->allocate(size));
+ m_base = static_cast<uint8_t*>(fastMalloc(size));
}
// Frees the memory allocated from the Allocator in the
// constructor.
virtual ~Chunk()
{
- m_allocator->free(m_base);
+ fastFree(m_base);
}
// Returns a pointer to "size" bytes of storage, or 0 if this
@@ -184,13 +144,11 @@
}
protected:
- Allocator* m_allocator;
uint8_t* m_base;
size_t m_size;
size_t m_currentOffset;
};
- RefPtr<Allocator> m_allocator;
Chunk* m_current;
size_t m_currentChunkSize;
Vector<OwnPtr<Chunk> > m_chunks;
Modified: trunk/Source/WebCore/platform/PODFreeListArena.h (149694 => 149695)
--- trunk/Source/WebCore/platform/PODFreeListArena.h 2013-05-07 22:04:01 UTC (rev 149694)
+++ trunk/Source/WebCore/platform/PODFreeListArena.h 2013-05-07 22:06:15 UTC (rev 149695)
@@ -40,12 +40,6 @@
return adoptRef(new PODFreeListArena);
}
- // Creates a new PODArena configured with the given Allocator.
- static PassRefPtr<PODFreeListArena> create(PassRefPtr<Allocator> allocator)
- {
- return adoptRef(new PODFreeListArena(allocator));
- }
-
template<class Argument1Type> T* allocateObject(const Argument1Type& argument1)
{
size_t roundedSize = roundUp(sizeof(T), minAlignment<T>());
@@ -71,9 +65,6 @@
PODFreeListArena()
: PODArena() { }
- explicit PODFreeListArena(PassRefPtr<Allocator> allocator)
- : PODArena(allocator) { }
-
void* allocate(size_t size)
{
void* ptr = 0;
@@ -97,7 +88,7 @@
if (!ptr) {
if (size > m_currentChunkSize)
m_currentChunkSize = size;
- m_chunks.append(adoptPtr(new FreeListChunk(m_allocator.get(), m_currentChunkSize)));
+ m_chunks.append(adoptPtr(new FreeListChunk(m_currentChunkSize)));
m_current = m_chunks.last().get();
ptr = m_current->allocate(size);
}
@@ -111,8 +102,8 @@
FreeCell *m_next;
};
public:
- FreeListChunk(Allocator* allocator, size_t size)
- : Chunk(allocator, size)
+ explicit FreeListChunk(size_t size)
+ : Chunk(size)
, m_freeList(0) { }
void* allocate(size_t size)
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes