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