diff options
author | dan sinclair <dsinclair@chromium.org> | 2016-03-02 18:58:37 -0500 |
---|---|---|
committer | dan sinclair <dsinclair@chromium.org> | 2016-03-02 18:58:37 -0500 |
commit | 91f7f3fa6a6d62ed0ce819c3286b0ffe6eddedbc (patch) | |
tree | 22e6acf568a5bdca0e027775eab727eefcb11e2a /core | |
parent | 0fc6b25e738c311fd66aa9da8c56de50af5644d5 (diff) | |
download | pdfium-91f7f3fa6a6d62ed0ce819c3286b0ffe6eddedbc.tar.xz |
Remove unused CFX_GrowOnlyPool.
The CFX_GrowOnlyPool class is never used, removed.
R=tsepez@chromium.org
Review URL: https://codereview.chromium.org/1757043002 .
Diffstat (limited to 'core')
-rw-r--r-- | core/include/fxcrt/fx_memory.h | 28 | ||||
-rw-r--r-- | core/src/fxcrt/fx_basic_memmgr.cpp | 42 |
2 files changed, 0 insertions, 70 deletions
diff --git a/core/include/fxcrt/fx_memory.h b/core/include/fxcrt/fx_memory.h index b9b1888930..e1cc07090a 100644 --- a/core/include/fxcrt/fx_memory.h +++ b/core/include/fxcrt/fx_memory.h @@ -78,35 +78,7 @@ class CFX_DestructObject { public: virtual ~CFX_DestructObject() {} }; -class CFX_GrowOnlyPool { - public: - CFX_GrowOnlyPool(size_t trunk_size = 16384); - - ~CFX_GrowOnlyPool(); - void SetTrunkSize(size_t trunk_size) { m_TrunkSize = trunk_size; } - - void* AllocDebug(size_t size, const FX_CHAR* file, int line) { - return Alloc(size); - } - - void* Alloc(size_t size); - - void* ReallocDebug(void* p, size_t new_size, const FX_CHAR* file, int line) { - return NULL; - } - - void* Realloc(void* p, size_t new_size) { return NULL; } - - void Free(void* mem) {} - - void FreeAll(); - - private: - size_t m_TrunkSize; - - void* m_pFirstTrunk; -}; #endif // __cplusplus #endif // CORE_INCLUDE_FXCRT_FX_MEMORY_H_ diff --git a/core/src/fxcrt/fx_basic_memmgr.cpp b/core/src/fxcrt/fx_basic_memmgr.cpp index 6665df60da..a0af6aef6d 100644 --- a/core/src/fxcrt/fx_basic_memmgr.cpp +++ b/core/src/fxcrt/fx_basic_memmgr.cpp @@ -23,45 +23,3 @@ NEVER_INLINE void FX_OutOfMemoryTerminate() { abort(); reinterpret_cast<void (*)()>(0xbd)(); } - -CFX_GrowOnlyPool::CFX_GrowOnlyPool(size_t trunk_size) { - m_TrunkSize = trunk_size; - m_pFirstTrunk = NULL; -} -CFX_GrowOnlyPool::~CFX_GrowOnlyPool() { - FreeAll(); -} -struct _FX_GrowOnlyTrunk { - size_t m_Size; - size_t m_Allocated; - _FX_GrowOnlyTrunk* m_pNext; -}; -void CFX_GrowOnlyPool::FreeAll() { - _FX_GrowOnlyTrunk* pTrunk = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; - while (pTrunk) { - _FX_GrowOnlyTrunk* pNext = pTrunk->m_pNext; - FX_Free(pTrunk); - pTrunk = pNext; - } - m_pFirstTrunk = NULL; -} -void* CFX_GrowOnlyPool::Alloc(size_t size) { - size = (size + 3) / 4 * 4; - _FX_GrowOnlyTrunk* pTrunk = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; - while (pTrunk) { - if (pTrunk->m_Size - pTrunk->m_Allocated >= size) { - void* p = (uint8_t*)(pTrunk + 1) + pTrunk->m_Allocated; - pTrunk->m_Allocated += size; - return p; - } - pTrunk = pTrunk->m_pNext; - } - size_t alloc_size = size > m_TrunkSize ? size : m_TrunkSize; - pTrunk = (_FX_GrowOnlyTrunk*)FX_Alloc(uint8_t, - sizeof(_FX_GrowOnlyTrunk) + alloc_size); - pTrunk->m_Size = alloc_size; - pTrunk->m_Allocated = size; - pTrunk->m_pNext = (_FX_GrowOnlyTrunk*)m_pFirstTrunk; - m_pFirstTrunk = pTrunk; - return pTrunk + 1; -} |