OLD | NEW |
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 #ifndef BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ | 5 #ifndef BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ |
6 #define BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ | 6 #define BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ |
7 | 7 |
8 #include <stddef.h> // for size_t | 8 #include <stddef.h> // for size_t |
9 | 9 |
10 #include "base/allocator/allocator_extension_thunks.h" | |
11 #include "base/base_export.h" | 10 #include "base/base_export.h" |
12 #include "build/build_config.h" | 11 #include "build/build_config.h" |
13 | 12 |
14 namespace base { | 13 namespace base { |
15 namespace allocator { | 14 namespace allocator { |
16 | 15 |
| 16 typedef void (*ReleaseFreeMemoryFunction)(); |
| 17 typedef bool (*GetNumericPropertyFunction)(const char* name, size_t* value); |
| 18 |
17 // Request that the allocator release any free memory it knows about to the | 19 // Request that the allocator release any free memory it knows about to the |
18 // system. | 20 // system. |
19 BASE_EXPORT void ReleaseFreeMemory(); | 21 BASE_EXPORT void ReleaseFreeMemory(); |
20 | 22 |
| 23 // Get the named property's |value|. Returns true if the property is known. |
| 24 // Returns false if the property is not a valid property name for the current |
| 25 // allocator implementation. |
| 26 // |name| or |value| cannot be NULL |
| 27 BASE_EXPORT bool GetNumericProperty(const char* name, size_t* value); |
| 28 |
21 // These settings allow specifying a callback used to implement the allocator | 29 // These settings allow specifying a callback used to implement the allocator |
22 // extension functions. These are optional, but if set they must only be set | 30 // extension functions. These are optional, but if set they must only be set |
23 // once. These will typically called in an allocator-specific initialization | 31 // once. These will typically called in an allocator-specific initialization |
24 // routine. | 32 // routine. |
25 // | 33 // |
26 // No threading promises are made. The caller is responsible for making sure | 34 // No threading promises are made. The caller is responsible for making sure |
27 // these pointers are set before any other threads attempt to call the above | 35 // these pointers are set before any other threads attempt to call the above |
28 // functions. | 36 // functions. |
29 | 37 |
30 BASE_EXPORT void SetReleaseFreeMemoryFunction( | 38 BASE_EXPORT void SetReleaseFreeMemoryFunction( |
31 thunks::ReleaseFreeMemoryFunction release_free_memory_function); | 39 ReleaseFreeMemoryFunction release_free_memory_function); |
32 | 40 |
33 BASE_EXPORT void SetGetNumericPropertyFunction( | 41 BASE_EXPORT void SetGetNumericPropertyFunction( |
34 thunks::GetNumericPropertyFunction get_numeric_property_function); | 42 GetNumericPropertyFunction get_numeric_property_function); |
35 | 43 |
36 } // namespace allocator | 44 } // namespace allocator |
37 } // namespace base | 45 } // namespace base |
38 | 46 |
39 #endif // BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ | 47 #endif // BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ |
OLD | NEW |