| 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 _FX_MEMORY | 7 #ifndef _FX_MEMORY |
| 8 #define _FX_MEMORY | 8 #define _FX_MEMORY |
| 9 class IFX_MEMAllocator; | 9 class IFX_MEMAllocator; |
| 10 class CFX_Target; | 10 class CFX_Target; |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 virtual size_t GetDefChunkSize() const = 0; | 24 virtual size_t GetDefChunkSize() const = 0; |
| 25 virtual size_t SetDefChunkSize(size_t size) = 0; | 25 virtual size_t SetDefChunkSize(size_t size) = 0; |
| 26 virtual size_t GetCurrentDataSize() const = 0; | 26 virtual size_t GetCurrentDataSize() const = 0; |
| 27 }; | 27 }; |
| 28 IFX_MEMAllocator* FX_CreateAllocator(FX_ALLOCTYPE eType, size_t chunkSize,
size_t blockSize); | 28 IFX_MEMAllocator* FX_CreateAllocator(FX_ALLOCTYPE eType, size_t chunkSize,
size_t blockSize); |
| 29 class CFX_Target | 29 class CFX_Target |
| 30 { | 30 { |
| 31 public: | 31 public: |
| 32 void* operator new(size_t size) | 32 void* operator new(size_t size) |
| 33 { | 33 { |
| 34 return FX_Alloc(FX_BYTE, size); | 34 return FX_Alloc(uint8_t, size); |
| 35 } | 35 } |
| 36 void operator delete(void *p) | 36 void operator delete(void *p) |
| 37 { | 37 { |
| 38 FX_Free(p); | 38 FX_Free(p); |
| 39 } | 39 } |
| 40 void* operator new(size_t size, IFX_MEMAllocator *pAllocator) | 40 void* operator new(size_t size, IFX_MEMAllocator *pAllocator) |
| 41 { | 41 { |
| 42 return pAllocator->Alloc(size); | 42 return pAllocator->Alloc(size); |
| 43 } | 43 } |
| 44 void operator delete(void *p, IFX_MEMAllocator *pAllocator) | 44 void operator delete(void *p, IFX_MEMAllocator *pAllocator) |
| 45 { | 45 { |
| 46 pAllocator->Free(p); | 46 pAllocator->Free(p); |
| 47 } | 47 } |
| 48 void* operator new(size_t size, void *place) | 48 void* operator new(size_t size, void *place) |
| 49 { | 49 { |
| 50 return place; | 50 return place; |
| 51 } | 51 } |
| 52 void operator delete(void *p, void *place) {} | 52 void operator delete(void *p, void *place) {} |
| 53 }; | 53 }; |
| 54 #define FXTARGET_New
new | 54 #define FXTARGET_New
new |
| 55 #define FXTARGET_NewWith(__allocator__)
new(__allocator__) | 55 #define FXTARGET_NewWith(__allocator__)
new(__allocator__) |
| 56 #define FXTARGET_Delete
delete | 56 #define FXTARGET_Delete
delete |
| 57 #define FXTARGET_DeleteWith(__class__, __allocator__, pointer) {(pointer)->~__c
lass__(); (pointer)->operator delete((pointer), (__allocator__));} | 57 #define FXTARGET_DeleteWith(__class__, __allocator__, pointer) {(pointer)->~__c
lass__(); (pointer)->operator delete((pointer), (__allocator__));} |
| 58 #endif | 58 #endif |
| OLD | NEW |