SkChunkAlloc Class Reference

#include <SkChunkAlloc.h>

List of all members.

Public Types

enum  AllocFailType { kReturnNil_AllocFailType, kThrow_AllocFailType }

Public Member Functions

 SkChunkAlloc (size_t minSize)
 ~SkChunkAlloc ()
void reset ()
void reuse ()
void * alloc (size_t bytes, AllocFailType)
void * allocThrow (size_t bytes)
size_t unalloc (void *ptr)
size_t totalCapacity () const

Detailed Description

Definition at line 22 of file SkChunkAlloc.h.


Member Enumeration Documentation

Enumerator:
kReturnNil_AllocFailType 
kThrow_AllocFailType 

Definition at line 39 of file SkChunkAlloc.h.


Constructor & Destructor Documentation

SkChunkAlloc::SkChunkAlloc ( size_t  minSize  ) 
SkChunkAlloc::~SkChunkAlloc (  ) 

Member Function Documentation

void* SkChunkAlloc::alloc ( size_t  bytes,
AllocFailType   
)
void* SkChunkAlloc::allocThrow ( size_t  bytes  )  [inline]

Definition at line 45 of file SkChunkAlloc.h.

void SkChunkAlloc::reset (  ) 

Free up all allocated blocks. This invalidates all returned pointers.

void SkChunkAlloc::reuse (  ) 

Reuse all allocated blocks. This invalidates all returned pointers (like reset) but doesn't necessarily free up all of the privately allocated blocks. This is more efficient if you plan to reuse the allocator multiple times.

size_t SkChunkAlloc::totalCapacity (  )  const [inline]

Definition at line 57 of file SkChunkAlloc.h.

size_t SkChunkAlloc::unalloc ( void *  ptr  ) 

Call this to unalloc the most-recently allocated ptr by alloc(). On success, the number of bytes freed is returned, or 0 if the block could not be unallocated. This is a hint to the underlying allocator that the previous allocation may be reused, but the implementation is free to ignore this call (and return 0).


The documentation for this class was generated from the following file:

Generated on Tue Oct 20 11:03:42 2009 for Skia by  doxygen 1.6.1