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

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

Issue 2163783003: Implement a ScopedThreadHeapUsage class to allow profiling per-thread heap usage. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shim-default
Patch Set: Address Nico's comments. Created 4 years, 3 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 // This translation unit defines a default dispatch for the allocator shim which 7 // This translation unit defines a default dispatch for the allocator shim which
8 // routes allocations to the original libc functions when using the link-time 8 // routes allocations to the original libc functions when using the link-time
9 // -Wl,-wrap,malloc approach (see README.md). 9 // -Wl,-wrap,malloc approach (see README.md).
10 // The __real_X functions here are special symbols that the linker will relocate 10 // The __real_X functions here are special symbols that the linker will relocate
(...skipping 27 matching lines...) Expand all
38 } 38 }
39 39
40 void* RealMemalign(const AllocatorDispatch*, size_t alignment, size_t size) { 40 void* RealMemalign(const AllocatorDispatch*, size_t alignment, size_t size) {
41 return __real_memalign(alignment, size); 41 return __real_memalign(alignment, size);
42 } 42 }
43 43
44 void RealFree(const AllocatorDispatch*, void* address) { 44 void RealFree(const AllocatorDispatch*, void* address) {
45 __real_free(address); 45 __real_free(address);
46 } 46 }
47 47
48 size_t RealSizeEstimate(const AllocatorDispatch*, void*) {
49 // TODO(primiano): This should be redirected to malloc_usable_size or
50 // the like.
51 return 0;
52 }
53
48 } // namespace 54 } // namespace
49 55
50 const AllocatorDispatch AllocatorDispatch::default_dispatch = { 56 const AllocatorDispatch AllocatorDispatch::default_dispatch = {
51 &RealMalloc, /* alloc_function */ 57 &RealMalloc, /* alloc_function */
52 &RealCalloc, /* alloc_zero_initialized_function */ 58 &RealCalloc, /* alloc_zero_initialized_function */
53 &RealMemalign, /* alloc_aligned_function */ 59 &RealMemalign, /* alloc_aligned_function */
54 &RealRealloc, /* realloc_function */ 60 &RealRealloc, /* realloc_function */
55 &RealFree, /* free_function */ 61 &RealFree, /* free_function */
56 nullptr, /* next */ 62 &RealSizeEstimate, /* get_size_estimate_function */
63 nullptr, /* next */
57 }; 64 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698