Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1629)

Unified Diff: base/allocator/allocator_shim.h

Issue 2658723007: Hook up allocator shim on mac. (Closed)
Patch Set: remove a debugging test. Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/allocator/allocator_interception_mac.mm ('k') | base/allocator/allocator_shim.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_shim.h
diff --git a/base/allocator/allocator_shim.h b/base/allocator/allocator_shim.h
index 8fd060fca6aaeee76a74cdd613af09579a56b77d..f43ec299d3cfc868b8def2fcd55be6db7342c77e 100644
--- a/base/allocator/allocator_shim.h
+++ b/base/allocator/allocator_shim.h
@@ -8,6 +8,7 @@
#include <stddef.h>
#include "base/base_export.h"
+#include "build/build_config.h"
namespace base {
namespace allocator {
@@ -62,6 +63,16 @@ struct AllocatorDispatch {
// allocation. If no good estimate is possible, returns zero.
using GetSizeEstimateFn = size_t(const AllocatorDispatch* self,
void* address);
+ using BatchMallocFn = unsigned(const AllocatorDispatch* self,
+ size_t size,
+ void** results,
+ unsigned num_requested);
+ using BatchFreeFn = void(const AllocatorDispatch* self,
+ void** to_be_freed,
+ unsigned num_to_be_freed);
+ using FreeDefiniteSizeFn = void(const AllocatorDispatch* self,
+ void* ptr,
+ size_t size);
AllocFn* const alloc_function;
AllocZeroInitializedFn* const alloc_zero_initialized_function;
@@ -69,6 +80,9 @@ struct AllocatorDispatch {
ReallocFn* const realloc_function;
FreeFn* const free_function;
GetSizeEstimateFn* const get_size_estimate_function;
+ BatchMallocFn* const batch_malloc_function;
+ BatchFreeFn* const batch_free_function;
+ FreeDefiniteSizeFn* const free_definite_size_function;
const AllocatorDispatch* next;
@@ -97,6 +111,11 @@ BASE_EXPORT void InsertAllocatorDispatch(AllocatorDispatch* dispatch);
// in malloc(), which we really don't want.
BASE_EXPORT void RemoveAllocatorDispatchForTesting(AllocatorDispatch* dispatch);
+#if defined(OS_MACOSX)
+// On macOS, the allocator shim needs to be turned on during runtime.
+BASE_EXPORT void InitializeAllocatorShim();
+#endif // defined(OS_MACOSX)
+
} // namespace allocator
} // namespace base
« no previous file with comments | « base/allocator/allocator_interception_mac.mm ('k') | base/allocator/allocator_shim.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698