Avi Drissman | e4622aa | 2022-09-08 20:36:06 | [diff] [blame] | 1 | // Copyright 2021 The Chromium Authors |
Takashi Sakamoto | 31cfff64 | 2021-10-29 05:47:29 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #ifndef BASE_ALLOCATOR_PARTITION_ALLOC_SUPPORT_H_ |
| 6 | #define BASE_ALLOCATOR_PARTITION_ALLOC_SUPPORT_H_ |
| 7 | |
Bartek Nowierski | 3f1ae09 | 2021-12-16 00:12:19 | [diff] [blame] | 8 | #include <map> |
| 9 | #include <string> |
| 10 | |
Takashi Sakamoto | 31cfff64 | 2021-10-29 05:47:29 | [diff] [blame] | 11 | #include "base/allocator/partition_allocator/partition_alloc_config.h" |
| 12 | #include "base/base_export.h" |
Takashi Sakamoto | b339487e | 2021-11-09 12:43:46 | [diff] [blame] | 13 | #include "base/memory/scoped_refptr.h" |
| 14 | #include "base/task/sequenced_task_runner.h" |
Takashi Sakamoto | 31cfff64 | 2021-10-29 05:47:29 | [diff] [blame] | 15 | |
| 16 | namespace base { |
| 17 | namespace allocator { |
| 18 | |
| 19 | #if defined(PA_ALLOW_PCSCAN) |
| 20 | BASE_EXPORT void RegisterPCScanStatsReporter(); |
| 21 | #endif |
| 22 | |
Takashi Sakamoto | b339487e | 2021-11-09 12:43:46 | [diff] [blame] | 23 | // Starts a periodic timer on the current thread to purge all thread caches. |
| 24 | BASE_EXPORT void StartThreadCachePeriodicPurge(); |
| 25 | |
| 26 | BASE_EXPORT void StartMemoryReclaimer( |
| 27 | scoped_refptr<SequencedTaskRunner> task_runner); |
| 28 | |
Bartek Nowierski | 145f4f46 | 2022-02-24 00:38:41 | [diff] [blame] | 29 | BASE_EXPORT std::map<std::string, std::string> ProposeSyntheticFinchTrials(); |
Bartek Nowierski | 3f1ae09 | 2021-12-16 00:12:19 | [diff] [blame] | 30 | |
Arthur Sonzogni | 0db17dd | 2022-02-14 13:50:27 | [diff] [blame] | 31 | // Install handlers for when dangling raw_ptr(s) have been detected. This prints |
| 32 | // two StackTraces. One where the memory is freed, one where the last dangling |
| 33 | // raw_ptr stopped referencing it. |
| 34 | // |
| 35 | // This is currently effective, only when compiled with |
| 36 | // `enable_dangling_raw_ptr_checks` build flag. |
| 37 | BASE_EXPORT void InstallDanglingRawPtrChecks(); |
| 38 | |
Takashi Sakamoto | 31cfff64 | 2021-10-29 05:47:29 | [diff] [blame] | 39 | } // namespace allocator |
| 40 | } // namespace base |
| 41 | |
| 42 | #endif // BASE_ALLOCATOR_PARTITION_ALLOC_SUPPORT_H_ |