Kalvin Lee | e07fc3f | 2024-04-03 01:54:18 | [diff] [blame] | 1 | // Copyright 2024 The Chromium Authors |
| 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 COMPONENTS_GWP_ASAN_CLIENT_SAMPLING_HELPERS_H_ |
| 6 | #define COMPONENTS_GWP_ASAN_CLIENT_SAMPLING_HELPERS_H_ |
| 7 | |
| 8 | #include <stddef.h> |
| 9 | |
Kalvin Lee | bd40915 | 2024-05-08 09:22:21 | [diff] [blame] | 10 | #include <optional> |
Kalvin Lee | e07fc3f | 2024-04-03 01:54:18 | [diff] [blame] | 11 | #include <string_view> |
| 12 | |
| 13 | #include "components/gwp_asan/client/export.h" |
| 14 | #include "components/gwp_asan/client/guarded_page_allocator.h" |
| 15 | |
| 16 | namespace gwp_asan::internal { |
| 17 | |
| 18 | GWP_ASAN_EXPORT GuardedPageAllocator::OutOfMemoryCallback CreateOomCallback( |
| 19 | std::string_view allocator_name, |
| 20 | std::string_view process_type, |
| 21 | size_t sampling_frequency); |
| 22 | |
Kalvin Lee | 960145e | 2024-04-13 16:40:17 | [diff] [blame] | 23 | // Emits to `Security.GwpAsan.Activated...`. |
| 24 | GWP_ASAN_EXPORT void ReportGwpAsanActivated(std::string_view allocator_name, |
| 25 | std::string_view process_type, |
| 26 | bool activated); |
| 27 | |
Kalvin Lee | bd40915 | 2024-05-08 09:22:21 | [diff] [blame] | 28 | // Returns the (GWP-ASan-internal) string representation of |
| 29 | // `process_type`, fed from the command-line of this process. |
| 30 | GWP_ASAN_EXPORT std::optional<std::string_view> ProcessString( |
| 31 | std::string_view process_type); |
| 32 | |
Kalvin Lee | e07fc3f | 2024-04-03 01:54:18 | [diff] [blame] | 33 | } // namespace gwp_asan::internal |
| 34 | |
| 35 | #endif // COMPONENTS_GWP_ASAN_CLIENT_SAMPLING_HELPERS_H_ |