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

Side by Side Diff: base/allocator/allocator_shim.cc

Issue 1719433002: Introduce allocator shim for Android (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shim_traceintegration
Patch Set: Add readme changes, do NOT enabled by default in this cl Created 4 years, 8 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 unified diff | Download patch
OLDNEW
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 #include <unistd.h> 8 #include <unistd.h>
9 9
10 #include <new> 10 #include <new>
(...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after
225 void ShimFree(void* address) { 225 void ShimFree(void* address) {
226 const allocator::AllocatorDispatch* const chain_head = GetChainHead(); 226 const allocator::AllocatorDispatch* const chain_head = GetChainHead();
227 return chain_head->free_function(chain_head, address); 227 return chain_head->free_function(chain_head, address);
228 } 228 }
229 229
230 } // extern "C" 230 } // extern "C"
231 231
232 // Cpp symbols (new / delete) should always be routed through the shim layer. 232 // Cpp symbols (new / delete) should always be routed through the shim layer.
233 #include "base/allocator/allocator_shim_override_cpp_symbols.h" 233 #include "base/allocator/allocator_shim_override_cpp_symbols.h"
234 234
235 // Android does not support symbol interposition. The way malloc symbols are
236 // intercepted on Android is by using link-time -wrap flags.
237 #if !defined(OS_ANDROID)
235 // Ditto for plain malloc() / calloc() / free() etc. symbols. 238 // Ditto for plain malloc() / calloc() / free() etc. symbols.
236 #include "base/allocator/allocator_shim_override_libc_symbols.h" 239 #include "base/allocator/allocator_shim_override_libc_symbols.h"
240 #else
241 #include "base/allocator/allocator_shim_override_linker_wrapped_symbols.h"
242 #endif
237 243
238 // In the case of tcmalloc we also want to plumb into the glibc hooks 244 // In the case of tcmalloc we also want to plumb into the glibc hooks
239 // to avoid that allocations made in glibc itself (e.g., strdup()) get 245 // to avoid that allocations made in glibc itself (e.g., strdup()) get
240 // accidentally performed on the glibc heap instead of the tcmalloc one. 246 // accidentally performed on the glibc heap instead of the tcmalloc one.
241 #if defined(USE_TCMALLOC) 247 #if defined(USE_TCMALLOC)
242 #include "base/allocator/allocator_shim_override_glibc_weak_symbols.h" 248 #include "base/allocator/allocator_shim_override_glibc_weak_symbols.h"
243 #endif 249 #endif
244 250
245 // Cross-checks. 251 // Cross-checks.
246 252
247 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR) 253 #if defined(MEMORY_TOOL_REPLACES_ALLOCATOR)
248 #error The allocator shim should not be compiled when building for memory tools. 254 #error The allocator shim should not be compiled when building for memory tools.
249 #endif 255 #endif
250 256
251 #if (defined(__GNUC__) && defined(__EXCEPTIONS)) || \ 257 #if (defined(__GNUC__) && defined(__EXCEPTIONS)) || \
252 (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS) 258 (defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS)
253 #error This code cannot be used when exceptions are turned on. 259 #error This code cannot be used when exceptions are turned on.
254 #endif 260 #endif
OLDNEW
« no previous file with comments | « base/allocator/allocator.gyp ('k') | base/allocator/allocator_shim_default_dispatch_to_linker_wrapped_symbols.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698