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

Unified Diff: base/trace_event/malloc_dump_provider.cc

Issue 1505743002: Remove allocator_extension_thunks since this layer is not required (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@allocator_clean_win
Patch Set: rebase Created 5 years 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
« no previous file with comments | « base/trace_event/BUILD.gn ('k') | tools/gn/bootstrap/bootstrap.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 5279ab0c6e64445b8815a2f5f575ee8c76a4c845..3a6de48e1cdef20b3543de400f306c9cb47f6da6 100644
--- a/base/trace_event/malloc_dump_provider.cc
+++ b/base/trace_event/malloc_dump_provider.cc
@@ -10,7 +10,7 @@
#include <malloc.h>
#endif
-#include "base/allocator/allocator_extension_thunks.h"
+#include "base/allocator/allocator_extension.h"
#include "base/trace_event/process_memory_dump.h"
namespace base {
@@ -42,30 +42,26 @@ bool MallocDumpProvider::OnMemoryDump(const MemoryDumpArgs& args,
total_virtual_size = stats.size_allocated;
resident_size = stats.size_in_use;
allocated_objects_size = stats.size_in_use;
+#elif defined(USE_TCMALLOC)
+ bool res =
+ allocator::GetNumericProperty("generic.heap_size", &total_virtual_size);
+ DCHECK(res);
+ res = allocator::GetNumericProperty("generic.total_physical_bytes",
+ &resident_size);
+ DCHECK(res);
+ res = allocator::GetNumericProperty("generic.current_allocated_bytes",
+ &allocated_objects_size);
+ DCHECK(res);
#else
- allocator::thunks::GetNumericPropertyFunction get_property_function =
- allocator::thunks::GetGetNumericPropertyFunction();
- if (get_property_function) {
- // If the function is not null then tcmalloc is used. See
- // MallocExtension::getNumericProperty.
- bool res = get_property_function("generic.heap_size", &total_virtual_size);
- DCHECK(res);
- res = get_property_function("generic.total_physical_bytes", &resident_size);
- DCHECK(res);
- res = get_property_function("generic.current_allocated_bytes",
- &allocated_objects_size);
- DCHECK(res);
- } else {
- struct mallinfo info = mallinfo();
- DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
+ struct mallinfo info = mallinfo();
+ DCHECK_GE(info.arena + info.hblkhd, info.uordblks);
- // In case of Android's jemalloc |arena| is 0 and the outer pages size is
- // reported by |hblkhd|. In case of dlmalloc the total is given by
- // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF.
- total_virtual_size = info.arena + info.hblkhd;
- resident_size = info.uordblks;
- allocated_objects_size = info.uordblks;
- }
+ // In case of Android's jemalloc |arena| is 0 and the outer pages size is
+ // reported by |hblkhd|. In case of dlmalloc the total is given by
+ // |arena| + |hblkhd|. For more details see link: http://goo.gl/fMR8lF.
+ total_virtual_size = info.arena + info.hblkhd;
+ resident_size = info.uordblks;
+ allocated_objects_size = info.uordblks;
#endif
MemoryAllocatorDump* outer_dump = pmd->CreateAllocatorDump("malloc");
« no previous file with comments | « base/trace_event/BUILD.gn ('k') | tools/gn/bootstrap/bootstrap.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698