Index: third_party/tcmalloc/chromium/src/gperftools/custom_allocator.h |
diff --git a/third_party/tcmalloc/chromium/src/gperftools/custom_allocator.h b/third_party/tcmalloc/chromium/src/gperftools/custom_allocator.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..524176b7f3ba12d82f47b7e414ae693d1d7909e5 |
--- /dev/null |
+++ b/third_party/tcmalloc/chromium/src/gperftools/custom_allocator.h |
@@ -0,0 +1,26 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CUSTOM_ALLOCATOR_H_ |
+#define CUSTOM_ALLOCATOR_H_ |
+ |
+#include <stddef.h> |
+ |
+// PERFTOOLS_DLL_DECL is unnecessary, as it is Windows specific. |
+ |
+// A container class for using LowLevelAlloc with STL_Allocator. The functions |
+// Allocate() and Free() must match the specificiations in STL_Allocator. |
+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.
|
+ public: |
+ // This is a stateless class, but there is static data within the module that |
+ // needs to be created and deleted. |
+ static void Initialize(); |
+ static bool Shutdown(); |
+ static bool IsInitialized(); |
+ |
+ static void* Allocate(size_t size); |
+ static void Free(void* ptr, size_t size); |
+}; |
+ |
+#endif // CUSTOM_ALLOCATOR_H_ |