Chromium Code Reviews| Index: base/allocator/allocator_extension.h |
| diff --git a/base/allocator/allocator_extension.h b/base/allocator/allocator_extension.h |
| index c8061633a2b77655e5ced1cf022529a5d337cb17..cfd63f9eadf1ed402dbb6e5563d9bc4e4dc0eb4e 100644 |
| --- a/base/allocator/allocator_extension.h |
| +++ b/base/allocator/allocator_extension.h |
| @@ -14,6 +14,16 @@ |
| namespace base { |
| namespace allocator { |
| +// Initializes the allocator and the routes the extension functions |
|
Primiano Tucci (use gerrit)
2015/11/25 12:47:17
"the routes the extension functions implementation
|
| +// implementations to base. This should be called only once and called before |
| +// the other allocator extension functions. This function is NOT thread safe and |
| +// the caller should ensure that it is called before any thread attempts to call |
| +// the below functions. |
| +// Do not call this function unless there is an allocator library that replaces |
| +// the underlying weak function, which is expected to provide the necessary |
| +// callbacks for the functions below. See InitializeAllocatorWeak. |
| +BASE_EXPORT void InitializeAllocator(); |
| + |
| // Request the allocator to report value of its waste memory size. |
| // Waste size corresponds to memory that has been allocated from the OS but |
| // not passed up to the application. It e.g. includes memory retained by free |
| @@ -35,26 +45,32 @@ BASE_EXPORT void GetStats(char* buffer, int buffer_length); |
| // system. |
| BASE_EXPORT void ReleaseFreeMemory(); |
| +// Returns the total bytes allocated in the current thread. |
| +BASE_EXPORT size_t GetBytesAllocatedOnCurrentThread(); |
| -// These settings allow specifying a callback used to implement the allocator |
| -// extension functions. These are optional, but if set they must only be set |
| -// once. These will typically called in an allocator-specific initialization |
| -// routine. |
| -// |
| -// No threading promises are made. The caller is responsible for making sure |
| -// these pointers are set before any other threads attempt to call the above |
| -// functions. |
| -BASE_EXPORT void SetGetAllocatorWasteSizeFunction( |
| - thunks::GetAllocatorWasteSizeFunction get_allocator_waste_size_function); |
| +// Get the named property's |value|. Returns true if the property is known. |
| +// Returns false if the property is not a valid property name for the current |
| +// malloc implementation. |
| +// |name| or |value| cannot be NULL |
| +BASE_EXPORT bool GetNumericProperty(const char* name, size_t* value); |
| + |
| +// The following are used for heap profiling if the allocator implementation |
| +// supports. |
| + |
| +// Start and stop heap profiler: |
| +typedef thunks::AllocatorExtensionFunctions::StackGenerator |
| + StackGeneratorFunction; |
| +BASE_EXPORT void HeapProfilerStart(StackGeneratorFunction callback); |
| +BASE_EXPORT void HeapProfilerStop(); |
| -BASE_EXPORT void SetGetStatsFunction( |
| - thunks::GetStatsFunction get_stats_function); |
| +// Generate current heap profiling information and return as string. |
| +BASE_EXPORT char* GetHeapProfile(); |
| -BASE_EXPORT void SetReleaseFreeMemoryFunction( |
| - thunks::ReleaseFreeMemoryFunction release_free_memory_function); |
| +// Generate current heap profiling information and write to file. |
| +BASE_EXPORT void HeapProfilerDump(const char* reason); |
| -BASE_EXPORT void SetGetNumericPropertyFunction( |
| - thunks::GetNumericPropertyFunction get_numeric_property_function); |
| +// Return true if heap profiler is running. |
| +BASE_EXPORT bool IsHeapProfilerRunning(); |
| } // namespace allocator |
| } // namespace base |