Changeset 150927 in webkit


Ignore:
Timestamp:
May 29, 2013 1:43:33 PM (11 years ago)
Author:
andersca@apple.com
Message:

Remove unused code from PODArena
https://bugs.webkit.org/show_bug.cgi?id=116990

Reviewed by Sam Weinig.

PODArena is only used as a base class of PODFreeListArena so remove unused member functions and make all
members protected to make it impossible to use it without subclassing.

PODArena is a risky class to use since it doesn't return memory to the system unless the arena object is destroyed.
This was the reason why PODFreeListArea was added. An upcoming patch will merge PODArena with PODFreeListArena and
this is a small step towards that goal.

  • platform/PODArena.h:
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r150926 r150927  
     12013-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
    1172013-05-29  Darin Adler  <darin@apple.com>
    218
  • trunk/Source/WebCore/platform/PODArena.h

    r149695 r150927  
    4444
    4545class 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 
     46protected:
    6547    // The initial size of allocated chunks; increases as necessary to
    6648    // satisfy large allocations. Mainly public for unit tests.
     
    6951    };
    7052
    71 protected:
    7253    virtual ~PODArena() { }
    7354    friend class WTF::RefCounted<PODArena>;
     
    8263    {
    8364        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;
    10165    }
    10266
Note: See TracChangeset for help on using the changeset viewer.