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

Unified Diff: base/allocator/allocator_extension.cc

Issue 1607303002: Allocator cleanup: allocator_extension call directly into tcmalloc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@base_dep_alloc
Patch Set: rebase Created 4 years, 11 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
« no previous file with comments | « base/allocator/allocator_extension.h ('k') | base/debug/OWNERS » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/allocator/allocator_extension.cc
diff --git a/base/allocator/allocator_extension.cc b/base/allocator/allocator_extension.cc
index 4f0b3a90032b9b7c48f33b1f1b2336b836353deb..17682f85d4950acd837f268056afa3ae49fc43c2 100644
--- a/base/allocator/allocator_extension.cc
+++ b/base/allocator/allocator_extension.cc
@@ -6,34 +6,32 @@
#include "base/logging.h"
+#if defined(USE_TCMALLOC)
+#include "third_party/tcmalloc/chromium/src/gperftools/heap-profiler.h"
+#include "third_party/tcmalloc/chromium/src/gperftools/malloc_extension.h"
+#endif
+
namespace base {
namespace allocator {
-namespace {
-ReleaseFreeMemoryFunction g_release_free_memory_function = nullptr;
-GetNumericPropertyFunction g_get_numeric_property_function = nullptr;
-}
-
void ReleaseFreeMemory() {
- if (g_release_free_memory_function)
- g_release_free_memory_function();
+#if defined(USE_TCMALLOC)
+ ::MallocExtension::instance()->ReleaseFreeMemory();
+#endif
}
bool GetNumericProperty(const char* name, size_t* value) {
- return g_get_numeric_property_function &&
- g_get_numeric_property_function(name, value);
-}
-
-void SetReleaseFreeMemoryFunction(
- ReleaseFreeMemoryFunction release_free_memory_function) {
- DCHECK(!g_release_free_memory_function);
- g_release_free_memory_function = release_free_memory_function;
+#if defined(USE_TCMALLOC)
+ return ::MallocExtension::instance()->GetNumericProperty(name, value);
+#endif
+ return false;
}
-void SetGetNumericPropertyFunction(
- GetNumericPropertyFunction get_numeric_property_function) {
- DCHECK(!g_get_numeric_property_function);
- g_get_numeric_property_function = get_numeric_property_function;
+bool IsHeapProfilerRunning() {
+#if defined(USE_TCMALLOC)
+ return ::IsHeapProfilerRunning();
+#endif
+ return false;
}
} // namespace allocator
« no previous file with comments | « base/allocator/allocator_extension.h ('k') | base/debug/OWNERS » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698