blob: ff62af8ce6f1978dc6578698025d0d26bdbab3ff [file] [log] [blame]
Kalvin Leee07fc3f2024-04-03 01:54:181// 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 Leebd409152024-05-08 09:22:2110#include <optional>
Kalvin Leee07fc3f2024-04-03 01:54:1811#include <string_view>
12
13#include "components/gwp_asan/client/export.h"
14#include "components/gwp_asan/client/guarded_page_allocator.h"
15
16namespace gwp_asan::internal {
17
18GWP_ASAN_EXPORT GuardedPageAllocator::OutOfMemoryCallback CreateOomCallback(
19 std::string_view allocator_name,
20 std::string_view process_type,
21 size_t sampling_frequency);
22
Kalvin Lee960145e2024-04-13 16:40:1723// Emits to `Security.GwpAsan.Activated...`.
24GWP_ASAN_EXPORT void ReportGwpAsanActivated(std::string_view allocator_name,
25 std::string_view process_type,
26 bool activated);
27
Kalvin Leebd409152024-05-08 09:22:2128// Returns the (GWP-ASan-internal) string representation of
29// `process_type`, fed from the command-line of this process.
30GWP_ASAN_EXPORT std::optional<std::string_view> ProcessString(
31 std::string_view process_type);
32
Kalvin Leee07fc3f2024-04-03 01:54:1833} // namespace gwp_asan::internal
34
35#endif // COMPONENTS_GWP_ASAN_CLIENT_SAMPLING_HELPERS_H_