Blink roll 25b6bd3a7a131ffe68d809546ad1a20707915cdc:3a503f41ae42e5b79cfcd2ff10e65afde...
[chromium-blink-merge.git] / base / allocator / allocator_extension_thunks.cc
blobe4024fb332e8d1edc4cff44bbcbb340c7c730f0a
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "base/allocator/allocator_extension_thunks.h"
7 #include <cstddef> // for NULL
9 namespace base {
10 namespace allocator {
11 namespace thunks {
13 // This slightly odd translation unit exists because of the peculularity of how
14 // allocator_unittests work on windows. That target has to perform
15 // tcmalloc-specific initialization on windows, but it cannot depend on base
16 // otherwise. This target sits in the middle - base and allocator_unittests
17 // can depend on it. This file can't depend on anything else in base, including
18 // logging.
20 static GetAllocatorWasteSizeFunction g_get_allocator_waste_size_function = NULL;
21 static GetStatsFunction g_get_stats_function = NULL;
22 static ReleaseFreeMemoryFunction g_release_free_memory_function = NULL;
24 void SetGetAllocatorWasteSizeFunction(
25 GetAllocatorWasteSizeFunction get_allocator_waste_size_function) {
26 g_get_allocator_waste_size_function = get_allocator_waste_size_function;
29 GetAllocatorWasteSizeFunction GetGetAllocatorWasteSizeFunction() {
30 return g_get_allocator_waste_size_function;
33 void SetGetStatsFunction(GetStatsFunction get_stats_function) {
34 g_get_stats_function = get_stats_function;
37 GetStatsFunction GetGetStatsFunction() {
38 return g_get_stats_function;
41 void SetReleaseFreeMemoryFunction(
42 ReleaseFreeMemoryFunction release_free_memory_function) {
43 g_release_free_memory_function = release_free_memory_function;
46 ReleaseFreeMemoryFunction GetReleaseFreeMemoryFunction() {
47 return g_release_free_memory_function;
50 } // namespace thunks
51 } // namespace allocator
52 } // namespace base