| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "base/allocator/allocator_shim.h" | 5 #include "base/allocator/allocator_shim.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 | 8 |
| 9 #include <new> | 9 #include <new> |
| 10 | 10 |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 } | 285 } |
| 286 | 286 |
| 287 ALWAYS_INLINE void ShimFreeDefiniteSize(void* ptr, size_t size, void* context) { | 287 ALWAYS_INLINE void ShimFreeDefiniteSize(void* ptr, size_t size, void* context) { |
| 288 const allocator::AllocatorDispatch* const chain_head = GetChainHead(); | 288 const allocator::AllocatorDispatch* const chain_head = GetChainHead(); |
| 289 return chain_head->free_definite_size_function(chain_head, ptr, size, | 289 return chain_head->free_definite_size_function(chain_head, ptr, size, |
| 290 context); | 290 context); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } // extern "C" | 293 } // extern "C" |
| 294 | 294 |
| 295 #if !defined(OS_WIN) && !defined(OS_MACOSX) | 295 #if !defined(OS_WIN) && !defined(OS_MACOSX) && !defined(OS_AIX) |
| 296 // Cpp symbols (new / delete) should always be routed through the shim layer | 296 // Cpp symbols (new / delete) should always be routed through the shim layer |
| 297 // except on Windows and macOS where the malloc intercept is deep enough that it | 297 // except on Windows and macOS where the malloc intercept is deep enough that it |
| 298 // also catches the cpp calls. | 298 // also catches the cpp calls. |
| 299 // This currently can't be done on AIX based on how |
| 300 // allocator_shim_default_dispatch_to_glibc.cc is set up. |
| 299 #include "base/allocator/allocator_shim_override_cpp_symbols.h" | 301 #include "base/allocator/allocator_shim_override_cpp_symbols.h" |
| 300 #endif | 302 #endif |
| 301 | 303 |
| 302 #if defined(OS_ANDROID) | 304 #if defined(OS_ANDROID) |
| 303 // Android does not support symbol interposition. The way malloc symbols are | 305 // Android does not support symbol interposition. The way malloc symbols are |
| 304 // intercepted on Android is by using link-time -wrap flags. | 306 // intercepted on Android is by using link-time -wrap flags. |
| 305 #include "base/allocator/allocator_shim_override_linker_wrapped_symbols.h" | 307 #include "base/allocator/allocator_shim_override_linker_wrapped_symbols.h" |
| 306 #elif defined(OS_WIN) | 308 #elif defined(OS_WIN) |
| 307 // On Windows we use plain link-time overriding of the CRT symbols. | 309 // On Windows we use plain link-time overriding of the CRT symbols. |
| 308 #include "base/allocator/allocator_shim_override_ucrt_symbols_win.h" | 310 #include "base/allocator/allocator_shim_override_ucrt_symbols_win.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 // Cross-checks. | 343 // Cross-checks. |
| 342 | 344 |
| 343 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) | 345 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) |
| 344 #error The allocator shim should not be compiled when building for memory tools. | 346 #error The allocator shim should not be compiled when building for memory tools. |
| 345 #endif | 347 #endif |
| 346 | 348 |
| 347 #if (defined(__GNUC__) && defined(__EXCEPTIONS)) || \ | 349 #if (defined(__GNUC__) && defined(__EXCEPTIONS)) || \ |
| 348 (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS) | 350 (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS) |
| 349 #error This code cannot be used when exceptions are turned on. | 351 #error This code cannot be used when exceptions are turned on. |
| 350 #endif | 352 #endif |
| OLD | NEW |