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

Unified Diff: base/allocator/allocator_extension.h

Issue 10239012: Route calls to tcmalloc MallocExtension through allocator agnostic interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: separate allocator_extension into own static library, add comments to allocator_extension.h Created 8 years, 8 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/allocator/allocator_extension.h
diff --git a/base/allocator/allocator_extension.h b/base/allocator/allocator_extension.h
new file mode 100644
index 0000000000000000000000000000000000000000..6cc060bd856fa088c3dfda708c151bd4acac5ff3
--- /dev/null
+++ b/base/allocator/allocator_extension.h
@@ -0,0 +1,41 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H
+#define BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H
+#pragma once
+
+#include "base/base_export.h"
+#include "build/build_config.h"
+
+namespace base {
+namespace allocator {
+
+// Request that the allocator print a human-readable description of the current
+// state of the allocator into a null-terminated string in the memory segment
+// buffer[0,buffer_length-1].
+//
+// |buffer| must point to a valid piece of memory
+// |buffer_length| must be > 0.
+BASE_EXPORT void GetStats(char* buffer, int buffer_length);
+
+// Request that the allocator release any free memory it knows about to the
+// system.
+BASE_EXPORT void ReleaseFreeMemory();
+
+
+// These settings allow specifying a callback used to implement the allocator
+// extension functions. These are optional, but if set they must only be set
+// once. These will typically called in an allocator-specific initialization
+// routine.
willchan no longer on Chromium 2012/04/26 22:08:48 You should note that they are not threadsafe.
+typedef void GetStatsFunction(char*, int);
+BASE_EXPORT void SetGetStatsFunction(GetStatsFunction* get_stats_function);
+
+typedef void ReleaseFreeMemoryFunction();
+BASE_EXPORT void SetReleaseFreeMemoryFunction(
+ ReleaseFreeMemoryFunction* release_free_memory_function);
+} // namespace allocator
+} // namespace base
+
+#endif

Powered by Google App Engine
This is Rietveld 408576698