| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrMemoryPool_DEFINED | 8 #ifndef GrMemoryPool_DEFINED |
| 9 #define GrMemoryPool_DEFINED | 9 #define GrMemoryPool_DEFINED |
| 10 | 10 |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 private: | 51 private: |
| 52 struct BlockHeader; | 52 struct BlockHeader; |
| 53 | 53 |
| 54 static BlockHeader* CreateBlock(size_t size); | 54 static BlockHeader* CreateBlock(size_t size); |
| 55 | 55 |
| 56 static void DeleteBlock(BlockHeader* block); | 56 static void DeleteBlock(BlockHeader* block); |
| 57 | 57 |
| 58 void validate(); | 58 void validate(); |
| 59 | 59 |
| 60 struct BlockHeader { | 60 struct BlockHeader { |
| 61 #ifdef SK_DEBUG |
| 62 uint32_t fBlockSentinal; ///< known value to check for bad back poi
nters to blocks |
| 63 #endif |
| 61 BlockHeader* fNext; ///< doubly-linked list of blocks. | 64 BlockHeader* fNext; ///< doubly-linked list of blocks. |
| 62 BlockHeader* fPrev; | 65 BlockHeader* fPrev; |
| 63 int fLiveCount; ///< number of outstanding allocations in the | 66 int fLiveCount; ///< number of outstanding allocations in the |
| 64 ///< block. | 67 ///< block. |
| 65 intptr_t fCurrPtr; ///< ptr to the start of blocks free space. | 68 intptr_t fCurrPtr; ///< ptr to the start of blocks free space. |
| 66 intptr_t fPrevPtr; ///< ptr to the last allocation made | 69 intptr_t fPrevPtr; ///< ptr to the last allocation made |
| 67 size_t fFreeSize; ///< amount of free space left in the block. | 70 size_t fFreeSize; ///< amount of free space left in the block. |
| 68 size_t fSize; ///< total allocated size of the block | 71 size_t fSize; ///< total allocated size of the block |
| 69 }; | 72 }; |
| 70 | 73 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 89 size_t fMinAllocSize; | 92 size_t fMinAllocSize; |
| 90 BlockHeader* fHead; | 93 BlockHeader* fHead; |
| 91 BlockHeader* fTail; | 94 BlockHeader* fTail; |
| 92 #ifdef SK_DEBUG | 95 #ifdef SK_DEBUG |
| 93 int fAllocationCnt; | 96 int fAllocationCnt; |
| 94 int fAllocBlockCnt; | 97 int fAllocBlockCnt; |
| 95 #endif | 98 #endif |
| 96 }; | 99 }; |
| 97 | 100 |
| 98 #endif | 101 #endif |
| OLD | NEW |