Page Speed Optimization Libraries
1.4.26.1
|
#include "arena.h"
Classes | |
struct | Chunk |
Public Member Functions | |
void * | Allocate (size_t size) |
void | DestroyObjects () |
Cleans up all the objects in the arena. You must call this explicitly. | |
Static Public Member Functions | |
static size_t | ExpandToAlign (size_t in) |
Rounds block size up to 8; we always align to it, even on 32-bit. | |
Static Public Attributes | |
static const size_t | kAlign = 8 |
This template keeps a packed set of objects inheriting from the same base type (which must have a virtual destructor) where all of the objects in the same arena are expected to be destroyed at once.
void* net_instaweb::Arena< T >::Allocate | ( | size_t | size | ) | [inline] |
< Need room to link the next object.
Update the links -- the previous object should point to our chunk's base, our base should point to NULL, and last_link_ should point to our base
Warning: the following line is very type-sensitive and can't easily be turned into a DCHECK_EQ as lint would like.
void net_instaweb::Arena< T >::DestroyObjects | ( | ) |
Cleans up all the objects in the arena. You must call this explicitly.
Walk through objects in this chunk.
const size_t net_instaweb::Arena< T >::kAlign = 8 [static] |
All allocations we make will be aligned to this. We will also reserve this much room for our work area, as it keeps things simple.