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

Side by Side Diff: base/allocator/allocator_extension_thunks.cc

Issue 1469843002: Remove dependency on allocator from 'content' targets (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@unify_allocator1_2
Patch Set: Fix build Created 5 years, 1 month 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/allocator/allocator_extension_thunks.h" 5 #include "base/allocator/allocator_extension_thunks.h"
6 6
7 #include <cstddef> // for NULL 7 #include <cstddef> // for NULL
8 8
9 namespace base { 9 namespace base {
10 namespace allocator { 10 namespace allocator {
11 namespace thunks { 11 namespace thunks {
12 12
13 // This slightly odd translation unit exists because of the peculularity of how 13 // This slightly odd translation unit exists because of the peculularity of how
14 // allocator_unittests work on windows. That target has to perform 14 // allocator_unittests work. That target has to perform tcmalloc-specific
15 // tcmalloc-specific initialization on windows, but it cannot depend on base 15 // initialization, but it cannot depend on base otherwise. This target sits in
16 // otherwise. This target sits in the middle - base and allocator_unittests 16 // the middle - base and allocator_unittests can depend on it. This file can't
17 // can depend on it. This file can't depend on anything else in base, including 17 // depend on anything else in base, including logging.
18 // logging.
19 18
20 static GetAllocatorWasteSizeFunction g_get_allocator_waste_size_function = NULL; 19 static AllocatorExtensionFunctions g_allocator_extension_functions;
21 static GetStatsFunction g_get_stats_function = NULL;
22 static ReleaseFreeMemoryFunction g_release_free_memory_function = NULL;
23 static GetNumericPropertyFunction g_get_numeric_property_function = NULL;
24 20
25 void SetGetAllocatorWasteSizeFunction( 21 void SetAllocatorExtensionFunctions(AllocatorExtensionFunctions functions) {
26 GetAllocatorWasteSizeFunction get_allocator_waste_size_function) { 22 g_allocator_extension_functions = functions;
27 g_get_allocator_waste_size_function = get_allocator_waste_size_function;
28 } 23 }
29 24
30 GetAllocatorWasteSizeFunction GetGetAllocatorWasteSizeFunction() { 25 AllocatorExtensionFunctions GetAllocatorExtensionFunctions() {
31 return g_get_allocator_waste_size_function; 26 return g_allocator_extension_functions;
32 }
33
34 void SetGetStatsFunction(GetStatsFunction get_stats_function) {
35 g_get_stats_function = get_stats_function;
36 }
37
38 GetStatsFunction GetGetStatsFunction() {
39 return g_get_stats_function;
40 }
41
42 void SetReleaseFreeMemoryFunction(
43 ReleaseFreeMemoryFunction release_free_memory_function) {
44 g_release_free_memory_function = release_free_memory_function;
45 }
46
47 ReleaseFreeMemoryFunction GetReleaseFreeMemoryFunction() {
48 return g_release_free_memory_function;
49 }
50
51 void SetGetNumericPropertyFunction(
52 GetNumericPropertyFunction get_numeric_property_function) {
53 g_get_numeric_property_function = get_numeric_property_function;
54 }
55
56 GetNumericPropertyFunction GetGetNumericPropertyFunction() {
57 return g_get_numeric_property_function;
58 } 27 }
59 28
60 } // namespace thunks 29 } // namespace thunks
61 } // namespace allocator 30 } // namespace allocator
62 } // namespace base 31 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698