| 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" | 10 #include "base/allocator/allocator_extension_thunks.h" |
| 11 #include "base/base_export.h" | 11 #include "base/base_export.h" |
| 12 #include "build/build_config.h" | 12 #include "build/build_config.h" |
| 13 | 13 |
| 14 namespace base { | 14 namespace base { |
| 15 namespace allocator { | 15 namespace allocator { |
| 16 | 16 |
| 17 // Request that the allocator print a human-readable description of the current | |
| 18 // state of the allocator into a null-terminated string in the memory segment | |
| 19 // buffer[0,buffer_length-1]. | |
| 20 // | |
| 21 // |buffer| must point to a valid piece of memory | |
| 22 // |buffer_length| must be > 0. | |
| 23 BASE_EXPORT void GetStats(char* buffer, int buffer_length); | |
| 24 | |
| 25 // Request that the allocator release any free memory it knows about to the | 17 // Request that the allocator release any free memory it knows about to the |
| 26 // system. | 18 // system. |
| 27 BASE_EXPORT void ReleaseFreeMemory(); | 19 BASE_EXPORT void ReleaseFreeMemory(); |
| 28 | 20 |
| 29 | |
| 30 // These settings allow specifying a callback used to implement the allocator | 21 // These settings allow specifying a callback used to implement the allocator |
| 31 // extension functions. These are optional, but if set they must only be set | 22 // extension functions. These are optional, but if set they must only be set |
| 32 // once. These will typically called in an allocator-specific initialization | 23 // once. These will typically called in an allocator-specific initialization |
| 33 // routine. | 24 // routine. |
| 34 // | 25 // |
| 35 // No threading promises are made. The caller is responsible for making sure | 26 // No threading promises are made. The caller is responsible for making sure |
| 36 // these pointers are set before any other threads attempt to call the above | 27 // these pointers are set before any other threads attempt to call the above |
| 37 // functions. | 28 // functions. |
| 38 | 29 |
| 39 BASE_EXPORT void SetGetStatsFunction( | |
| 40 thunks::GetStatsFunction get_stats_function); | |
| 41 | |
| 42 BASE_EXPORT void SetReleaseFreeMemoryFunction( | 30 BASE_EXPORT void SetReleaseFreeMemoryFunction( |
| 43 thunks::ReleaseFreeMemoryFunction release_free_memory_function); | 31 thunks::ReleaseFreeMemoryFunction release_free_memory_function); |
| 44 | 32 |
| 45 BASE_EXPORT void SetGetNumericPropertyFunction( | 33 BASE_EXPORT void SetGetNumericPropertyFunction( |
| 46 thunks::GetNumericPropertyFunction get_numeric_property_function); | 34 thunks::GetNumericPropertyFunction get_numeric_property_function); |
| 47 | 35 |
| 48 } // namespace allocator | 36 } // namespace allocator |
| 49 } // namespace base | 37 } // namespace base |
| 50 | 38 |
| 51 #endif // BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ | 39 #endif // BASE_ALLOCATOR_ALLOCATOR_EXTENSION_H_ |
| OLD | NEW |