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

Unified Diff: base/trace_event/malloc_dump_provider.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: Fix a brain****, may even compile now. Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: base/trace_event/malloc_dump_provider.cc
diff --git a/base/trace_event/malloc_dump_provider.cc b/base/trace_event/malloc_dump_provider.cc
index 3b1a933bce56f8154f7871434f8cf692b02b3267..cc218341ed7d8d5ec5ae9c5bf49e209cd91427d6 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -27,6 +27,7 @@ namespace base {
namespace trace_event {
#if BUILDFLAG(USE_EXPERIMENTAL_ALLOCATOR_SHIM)
+
namespace {
using allocator::AllocatorDispatch;
@@ -73,13 +74,21 @@ void HookFree(const AllocatorDispatch* self, void* address) {
next->free_function(next, address);
}
+size_t HookGetSizeEstimate(const AllocatorDispatch* self, void* address) {
Primiano Tucci (use gerrit) 2016/08/24 14:11:46 yeah you don't really need to touch this at all if
Sigurður Ásgeirsson 2016/09/01 15:18:18 Acknowledged.
+ const AllocatorDispatch* const next = self->next;
+ if (!next->get_size_estimate_function)
+ return 0;
+ return next->get_size_estimate_function(next, address);
+}
+
AllocatorDispatch g_allocator_hooks = {
- &HookAlloc, /* alloc_function */
- &HookZeroInitAlloc, /* alloc_zero_initialized_function */
- &HookllocAligned, /* alloc_aligned_function */
- &HookRealloc, /* realloc_function */
- &HookFree, /* free_function */
- nullptr, /* next */
+ &HookAlloc, /* alloc_function */
+ &HookZeroInitAlloc, /* alloc_zero_initialized_function */
+ &HookllocAligned, /* alloc_aligned_function */
+ &HookRealloc, /* realloc_function */
+ &HookFree, /* free_function */
+ &HookGetSizeEstimate, /* get_size_estimate_function */
+ nullptr, /* next */
};
} // namespace
« base/debug/scoped_heap_usage_unittest.cc ('K') | « base/debug/scoped_heap_usage_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698