allocator_extension_thunks.cc revision 5821806d5e7f356e8fa4b058a389a808ea183019
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. 4 5#include "base/allocator/allocator_extension_thunks.h" 6 7#include <cstddef> // for NULL 8 9namespace base { 10namespace allocator { 11namespace thunks { 12 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. 19 20static GetPropertyFunction g_get_property_function = NULL; 21static GetStatsFunction g_get_stats_function = NULL; 22static ReleaseFreeMemoryFunction g_release_free_memory_function = NULL; 23 24void SetGetPropertyFunction(GetPropertyFunction get_property_function) { 25 g_get_property_function = get_property_function; 26} 27 28GetPropertyFunction GetGetPropertyFunction() { 29 return g_get_property_function; 30} 31 32void SetGetStatsFunction(GetStatsFunction get_stats_function) { 33 g_get_stats_function = get_stats_function; 34} 35 36GetStatsFunction GetGetStatsFunction() { 37 return g_get_stats_function; 38} 39 40void SetReleaseFreeMemoryFunction( 41 ReleaseFreeMemoryFunction release_free_memory_function) { 42 g_release_free_memory_function = release_free_memory_function; 43} 44 45ReleaseFreeMemoryFunction GetReleaseFreeMemoryFunction() { 46 return g_release_free_memory_function; 47} 48 49} // namespace thunks 50} // namespace allocator 51} // namespace base 52