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

Unified Diff: base/allocator/allocator_extension.cc

Issue 10239012: Route calls to tcmalloc MallocExtension through allocator agnostic interface (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « base/allocator/allocator_extension.h ('k') | base/allocator/allocator_extension_thunks.h » ('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
new file mode 100644
index 0000000000000000000000000000000000000000..7ae11da3e301121f328b265dac2bf489d3c5b52e
--- /dev/null
+++ b/base/allocator/allocator_extension.cc
@@ -0,0 +1,42 @@
+// 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.
+
+#include "base/allocator/allocator_extension.h"
+
+#include "base/logging.h"
+
+namespace base {
+namespace allocator {
+
+void GetStats(char* buffer, int buffer_length) {
+ DCHECK_GT(buffer_length, 0);
+ if (thunks::GetStatsFunction* get_stats_function =
+ base::allocator::thunks::GetGetStatsFunction())
+ get_stats_function(buffer, buffer_length);
+ else
+ buffer[0] = '\0';
+}
+
+void ReleaseFreeMemory() {
+ if (thunks::ReleaseFreeMemoryFunction* release_free_memory_function =
+ base::allocator::thunks::GetReleaseFreeMemoryFunction())
+ release_free_memory_function();
+}
+
+void SetGetStatsFunction(thunks::GetStatsFunction* get_stats_function) {
+ DCHECK_EQ(base::allocator::thunks::GetGetStatsFunction(),
+ reinterpret_cast<thunks::GetStatsFunction*>(NULL));
+ base::allocator::thunks::SetGetStatsFunction(get_stats_function);
+}
+
+void SetReleaseFreeMemoryFunction(
+ thunks::ReleaseFreeMemoryFunction* release_free_memory_function) {
+ DCHECK_EQ(base::allocator::thunks::GetReleaseFreeMemoryFunction(),
+ reinterpret_cast<thunks::ReleaseFreeMemoryFunction*>(NULL));
+ base::allocator::thunks::SetReleaseFreeMemoryFunction(
+ release_free_memory_function);
+}
+
+} // namespace allocator
+} // namespace base
« no previous file with comments | « base/allocator/allocator_extension.h ('k') | base/allocator/allocator_extension_thunks.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698