diff options
| author | 2010-06-13 17:55:28 -0700 | |
|---|---|---|
| committer | 2010-06-13 17:55:28 -0700 | |
| commit | 7c8aa44f320f45e8417f0aba9ca67af6a67a5cf7 (patch) | |
| tree | 2d547d9d8ddc5b08310070121616294d92ebca70 /libs/utils/Pool.cpp | |
| parent | 94f14aeca9e6c6d07b39a7f708eacadcfeb6fbd2 (diff) | |
| parent | 46b9ac0ae2162309774a7478cd9d4e578747bfc2 (diff) | |
am 46b9ac0a: Native input dispatch rewrite work in progress.
Merge commit '46b9ac0ae2162309774a7478cd9d4e578747bfc2' into gingerbread
* commit '46b9ac0ae2162309774a7478cd9d4e578747bfc2':
Native input dispatch rewrite work in progress.
Diffstat (limited to 'libs/utils/Pool.cpp')
| -rw-r--r-- | libs/utils/Pool.cpp | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/libs/utils/Pool.cpp b/libs/utils/Pool.cpp new file mode 100644 index 000000000000..8f18cb913ea4 --- /dev/null +++ b/libs/utils/Pool.cpp @@ -0,0 +1,37 @@ +// +// Copyright 2010 The Android Open Source Project +// +// A simple memory pool. +// +#define LOG_TAG "Pool" + +//#define LOG_NDEBUG 0 + +#include <cutils/log.h> +#include <utils/Pool.h> + +#include <stdlib.h> + +namespace android { + +// TODO Provide a real implementation of a pool. This is just a stub for initial development. + +PoolImpl::PoolImpl(size_t objSize) : + mObjSize(objSize) { +} + +PoolImpl::~PoolImpl() { +} + +void* PoolImpl::allocImpl() { + void* ptr = malloc(mObjSize); + LOG_ALWAYS_FATAL_IF(ptr == NULL, "Cannot allocate new pool object."); + return ptr; +} + +void PoolImpl::freeImpl(void* obj) { + LOG_ALWAYS_FATAL_IF(obj == NULL, "Caller attempted to free NULL pool object."); + return free(obj); +} + +} // namespace android |