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

Side by Side Diff: base/allocator/allocator_shim_override_glibc_weak_symbols.h

Issue 2697123007: base: Add support for malloc zones to the allocator shim (Closed)
Patch Set: Windows compile error. Created 3 years, 10 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 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ 5 #ifdef BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_
6 #error This header is meant to be included only once by allocator_shim.cc 6 #error This header is meant to be included only once by allocator_shim.cc
7 #endif 7 #endif
8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_ 8 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_OVERRIDE_GLIBC_WEAK_SYMBOLS_H_
9 9
10 // Alias the internal Glibc symbols to the shim entry points. 10 // Alias the internal Glibc symbols to the shim entry points.
(...skipping 21 matching lines...) Expand all
32 #else 32 #else
33 #define MALLOC_HOOK_MAYBE_VOLATILE __MALLOC_HOOK_VOLATILE 33 #define MALLOC_HOOK_MAYBE_VOLATILE __MALLOC_HOOK_VOLATILE
34 #endif 34 #endif
35 35
36 extern "C" { 36 extern "C" {
37 37
38 // 1) Re-define malloc_hook weak symbols. 38 // 1) Re-define malloc_hook weak symbols.
39 namespace { 39 namespace {
40 40
41 void* GlibcMallocHook(size_t size, const void* caller) { 41 void* GlibcMallocHook(size_t size, const void* caller) {
42 return ShimMalloc(size); 42 return ShimMalloc(size, nullptr);
43 } 43 }
44 44
45 void* GlibcReallocHook(void* ptr, size_t size, const void* caller) { 45 void* GlibcReallocHook(void* ptr, size_t size, const void* caller) {
46 return ShimRealloc(ptr, size); 46 return ShimRealloc(ptr, size, nullptr);
47 } 47 }
48 48
49 void GlibcFreeHook(void* ptr, const void* caller) { 49 void GlibcFreeHook(void* ptr, const void* caller) {
50 return ShimFree(ptr); 50 return ShimFree(ptr, nullptr);
51 } 51 }
52 52
53 void* GlibcMemalignHook(size_t align, size_t size, const void* caller) { 53 void* GlibcMemalignHook(size_t align, size_t size, const void* caller) {
54 return ShimMemalign(align, size); 54 return ShimMemalign(align, size, nullptr);
55 } 55 }
56 56
57 } // namespace 57 } // namespace
58 58
59 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __malloc_hook)( 59 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __malloc_hook)(
60 size_t, 60 size_t,
61 const void*) = &GlibcMallocHook; 61 const void*) = &GlibcMallocHook;
62 62
63 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __realloc_hook)( 63 SHIM_ALWAYS_EXPORT void* (*MALLOC_HOOK_MAYBE_VOLATILE __realloc_hook)(
64 void*, 64 void*,
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s) 101 SHIM_ALWAYS_EXPORT int __posix_memalign(void** r, size_t a, size_t s)
102 SHIM_ALIAS_SYMBOL(ShimPosixMemalign); 102 SHIM_ALIAS_SYMBOL(ShimPosixMemalign);
103 103
104 } // extern "C" 104 } // extern "C"
105 105
106 // Safety check. 106 // Safety check.
107 #if !defined(__GLIBC__) 107 #if !defined(__GLIBC__)
108 #error The target platform does not seem to use Glibc. Disable the allocator \ 108 #error The target platform does not seem to use Glibc. Disable the allocator \
109 shim by setting use_experimental_allocator_shim=false in GN args. 109 shim by setting use_experimental_allocator_shim=false in GN args.
110 #endif 110 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698