OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 // --- |
| 6 // Author: Simon Que |
| 7 |
| 8 #ifndef BASE_CUSTOM_ALLOCATOR_H_ |
| 9 #define BASE_CUSTOM_ALLOCATOR_H_ |
| 10 |
| 11 #include <stddef.h> |
| 12 |
| 13 #include "base/low_level_alloc.h" |
| 14 |
| 15 // A container class for using LowLevelAlloc with STL_Allocator. The functions |
| 16 // Allocate() and Free() must match the specificiations in STL_Allocator. |
| 17 class CustomAllocator { |
| 18 public: |
| 19 // If no arena is provided, LowLevelAlloc still uses its default arena. |
| 20 static void SetArena(LowLevelAlloc::Arena* arena); |
| 21 |
| 22 static void* Allocate(size_t size); |
| 23 static void Free(void* ptr, size_t size); |
| 24 |
| 25 private: |
| 26 static LowLevelAlloc::Arena* arena_; |
| 27 }; |
| 28 |
| 29 #endif // BASE_CUSTOM_ALLOCATOR_H_ |
OLD | NEW |