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

Unified Diff: base/allocator/allocator_shim.cc

Issue 2601573002: mac: Hook up allocator shim. (Closed)
Patch Set: Clean up. Created 4 years 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
Index: base/allocator/allocator_shim.cc
diff --git a/base/allocator/allocator_shim.cc b/base/allocator/allocator_shim.cc
index a9fc095b905e620dd8e2df9f060fd28e32629e27..c8914ececdbb27c4d63c94addb0daf75a96e6899 100644
--- a/base/allocator/allocator_shim.cc
+++ b/base/allocator/allocator_shim.cc
@@ -241,6 +241,26 @@ void ShimFree(void* address) {
return chain_head->free_function(chain_head, address);
}
+size_t ShimGetSizeEstimate(const void* address) {
+ const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+ // TODO(erikchen): Fix get_size_estimate() to take 'const void*'.
+ // https://crbug.com/665567.
+ return chain_head->get_size_estimate_function(chain_head,
+ const_cast<void*>(address));
+}
+
+unsigned ShimBatchMalloc(size_t size, void** results, unsigned num_requested) {
+ const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+ return chain_head->batch_malloc_function(chain_head, size, results,
+ num_requested);
+}
+
+void ShimBatchFree(void** to_be_freed, unsigned num_to_be_freed) {
+ const allocator::AllocatorDispatch* const chain_head = GetChainHead();
+ return chain_head->batch_free_function(chain_head, to_be_freed,
+ num_to_be_freed);
+}
+
} // extern "C"
#if !defined(OS_WIN)
@@ -257,6 +277,8 @@ void ShimFree(void* address) {
#elif defined(OS_WIN)
// On Windows we use plain link-time overriding of the CRT symbols.
#include "base/allocator/allocator_shim_override_ucrt_symbols_win.h"
+#elif defined(OS_MACOSX)
+#include "base/allocator/allocator_shim_override_mac_symbols.h"
#else
#include "base/allocator/allocator_shim_override_libc_symbols.h"
#endif

Powered by Google App Engine
This is Rietveld 408576698