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

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

Issue 2440393002: [tracing] Implement composable memory usage estimators. (Closed)
Patch Set: Rebase Created 4 years, 1 month 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
« no previous file with comments | « base/BUILD.gn ('k') | base/test/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef BASE_ALLOCATOR_ALLOCATOR_SHIM_H_ 5 #ifndef BASE_ALLOCATOR_ALLOCATOR_SHIM_H_
6 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_H_ 6 #define BASE_ALLOCATOR_ALLOCATOR_SHIM_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 9
10 #include "base/base_export.h" 10 #include "base/base_export.h"
(...skipping 26 matching lines...) Expand all
37 // ultimately routes the calls to the actual allocator defined by the build 37 // ultimately routes the calls to the actual allocator defined by the build
38 // config (tcmalloc, glibc, ...). 38 // config (tcmalloc, glibc, ...).
39 // 39 //
40 // It is possible to dynamically insert further AllocatorDispatch stages 40 // It is possible to dynamically insert further AllocatorDispatch stages
41 // to the front of the chain, for debugging / profiling purposes. 41 // to the front of the chain, for debugging / profiling purposes.
42 // 42 //
43 // All the functions must be thred safe. The shim does not enforce any 43 // All the functions must be thred safe. The shim does not enforce any
44 // serialization. This is to route to thread-aware allocators (e.g, tcmalloc) 44 // serialization. This is to route to thread-aware allocators (e.g, tcmalloc)
45 // wihout introducing unnecessary perf hits. 45 // wihout introducing unnecessary perf hits.
46 46
47 struct AllocatorDispatch { 47 struct BASE_EXPORT AllocatorDispatch {
48 using AllocFn = void*(const AllocatorDispatch* self, size_t size); 48 using AllocFn = void*(const AllocatorDispatch* self, size_t size);
49 using AllocZeroInitializedFn = void*(const AllocatorDispatch* self, 49 using AllocZeroInitializedFn = void*(const AllocatorDispatch* self,
50 size_t n, 50 size_t n,
51 size_t size); 51 size_t size);
52 using AllocAlignedFn = void*(const AllocatorDispatch* self, 52 using AllocAlignedFn = void*(const AllocatorDispatch* self,
53 size_t alignment, 53 size_t alignment,
54 size_t size); 54 size_t size);
55 using ReallocFn = void*(const AllocatorDispatch* self, 55 using ReallocFn = void*(const AllocatorDispatch* self,
56 void* address, 56 void* address,
57 size_t size); 57 size_t size);
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
94 94
95 // Test-only. Rationale: (1) lack of use cases; (2) dealing safely with a 95 // Test-only. Rationale: (1) lack of use cases; (2) dealing safely with a
96 // removal of arbitrary elements from a singly linked list would require a lock 96 // removal of arbitrary elements from a singly linked list would require a lock
97 // in malloc(), which we really don't want. 97 // in malloc(), which we really don't want.
98 BASE_EXPORT void RemoveAllocatorDispatchForTesting(AllocatorDispatch* dispatch); 98 BASE_EXPORT void RemoveAllocatorDispatchForTesting(AllocatorDispatch* dispatch);
99 99
100 } // namespace allocator 100 } // namespace allocator
101 } // namespace base 101 } // namespace base
102 102
103 #endif // BASE_ALLOCATOR_ALLOCATOR_SHIM_H_ 103 #endif // BASE_ALLOCATOR_ALLOCATOR_SHIM_H_
OLDNEW
« no previous file with comments | « base/BUILD.gn ('k') | base/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698