Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 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 #ifndef CUSTOM_ALLOCATOR_H_ | |
| 6 #define CUSTOM_ALLOCATOR_H_ | |
| 7 | |
| 8 #include <stddef.h> | |
| 9 | |
| 10 // PERFTOOLS_DLL_DECL is unnecessary, as it is Windows specific. | |
| 11 | |
| 12 // A container class for using LowLevelAlloc with STL_Allocator. The functions | |
| 13 // Allocate() and Free() must match the specificiations in STL_Allocator. | |
| 14 class CustomAllocator { | |
|
jar (doing other things)
2015/08/21 02:48:43
Why are we using a class, rather than a namespace?
Simon Que
2015/08/21 05:44:05
This is required as a template type for STL_Alloca
jar (doing other things)
2015/08/21 17:32:31
I see. SGTM.
| |
| 15 public: | |
| 16 // This is a stateless class, but there is static data within the module that | |
| 17 // needs to be created and deleted. | |
| 18 static void Initialize(); | |
| 19 static bool Shutdown(); | |
| 20 static bool IsInitialized(); | |
| 21 | |
| 22 static void* Allocate(size_t size); | |
| 23 static void Free(void* ptr, size_t size); | |
| 24 }; | |
| 25 | |
| 26 #endif // CUSTOM_ALLOCATOR_H_ | |
| OLD | NEW |