| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #ifndef CORE_INCLUDE_FXCRT_FX_MEMORY_H_ | 7 #ifndef CORE_INCLUDE_FXCRT_FX_MEMORY_H_ |
| 8 #define CORE_INCLUDE_FXCRT_FX_MEMORY_H_ | 8 #define CORE_INCLUDE_FXCRT_FX_MEMORY_H_ |
| 9 | 9 |
| 10 #include "core/include/fxcrt/fx_system.h" | 10 #include "core/include/fxcrt/fx_system.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 #define FX_TryAlloc(type, size) (type*) calloc(size, sizeof(type)) | 71 #define FX_TryAlloc(type, size) (type*) calloc(size, sizeof(type)) |
| 72 #define FX_TryRealloc(type, ptr, size) \ | 72 #define FX_TryRealloc(type, ptr, size) \ |
| 73 (type*) FX_SafeRealloc(ptr, size, sizeof(type)) | 73 (type*) FX_SafeRealloc(ptr, size, sizeof(type)) |
| 74 | 74 |
| 75 #define FX_Free(ptr) free(ptr) | 75 #define FX_Free(ptr) free(ptr) |
| 76 | 76 |
| 77 class CFX_DestructObject { | 77 class CFX_DestructObject { |
| 78 public: | 78 public: |
| 79 virtual ~CFX_DestructObject() {} | 79 virtual ~CFX_DestructObject() {} |
| 80 }; | 80 }; |
| 81 class CFX_GrowOnlyPool { | |
| 82 public: | |
| 83 CFX_GrowOnlyPool(size_t trunk_size = 16384); | |
| 84 | 81 |
| 85 ~CFX_GrowOnlyPool(); | |
| 86 | |
| 87 void SetTrunkSize(size_t trunk_size) { m_TrunkSize = trunk_size; } | |
| 88 | |
| 89 void* AllocDebug(size_t size, const FX_CHAR* file, int line) { | |
| 90 return Alloc(size); | |
| 91 } | |
| 92 | |
| 93 void* Alloc(size_t size); | |
| 94 | |
| 95 void* ReallocDebug(void* p, size_t new_size, const FX_CHAR* file, int line) { | |
| 96 return NULL; | |
| 97 } | |
| 98 | |
| 99 void* Realloc(void* p, size_t new_size) { return NULL; } | |
| 100 | |
| 101 void Free(void* mem) {} | |
| 102 | |
| 103 void FreeAll(); | |
| 104 | |
| 105 private: | |
| 106 size_t m_TrunkSize; | |
| 107 | |
| 108 void* m_pFirstTrunk; | |
| 109 }; | |
| 110 #endif // __cplusplus | 82 #endif // __cplusplus |
| 111 | 83 |
| 112 #endif // CORE_INCLUDE_FXCRT_FX_MEMORY_H_ | 84 #endif // CORE_INCLUDE_FXCRT_FX_MEMORY_H_ |
| OLD | NEW |