| OLD | NEW |
| 1 | |
| 2 /* | 1 /* |
| 3 * Copyright 2010 Google Inc. | 2 * Copyright 2010 Google Inc. |
| 4 * | 3 * |
| 5 * 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 |
| 6 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 7 */ | 6 */ |
| 8 | 7 |
| 9 | |
| 10 | |
| 11 #ifndef GrAllocPool_DEFINED | 8 #ifndef GrAllocPool_DEFINED |
| 12 #define GrAllocPool_DEFINED | 9 #define GrAllocPool_DEFINED |
| 13 | 10 |
| 14 #include "GrNoncopyable.h" | 11 #include "SkTypes.h" |
| 15 | 12 |
| 16 class GrAllocPool : GrNoncopyable { | 13 class GrAllocPool : public SkNoncopyable { |
| 17 public: | 14 public: |
| 18 GrAllocPool(size_t blockSize = 0); | 15 GrAllocPool(size_t blockSize = 0); |
| 19 ~GrAllocPool(); | 16 ~GrAllocPool(); |
| 20 | 17 |
| 21 /** | 18 /** |
| 22 * Frees all blocks that have been allocated with alloc(). | 19 * Frees all blocks that have been allocated with alloc(). |
| 23 */ | 20 */ |
| 24 void reset(); | 21 void reset(); |
| 25 | 22 |
| 26 /** | 23 /** |
| (...skipping 27 matching lines...) Expand all Loading... |
| 54 GrTAllocPool(int count) : fPool(count * sizeof(T)) {} | 51 GrTAllocPool(int count) : fPool(count * sizeof(T)) {} |
| 55 | 52 |
| 56 void reset() { fPool.reset(); } | 53 void reset() { fPool.reset(); } |
| 57 T* alloc() { return (T*)fPool.alloc(sizeof(T)); } | 54 T* alloc() { return (T*)fPool.alloc(sizeof(T)); } |
| 58 | 55 |
| 59 private: | 56 private: |
| 60 GrAllocPool fPool; | 57 GrAllocPool fPool; |
| 61 }; | 58 }; |
| 62 | 59 |
| 63 #endif | 60 #endif |
| OLD | NEW |