xref: /aosp_15_r20/external/cronet/base/allocator/partition_allocator/src/partition_alloc/oom_callback.h (revision 6777b5387eb2ff775bb5750e3f5d96f37fb7352b)
1 // Copyright 2018 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 PARTITION_ALLOC_OOM_CALLBACK_H_
6 #define PARTITION_ALLOC_OOM_CALLBACK_H_
7 
8 #include "partition_alloc/partition_alloc_base/component_export.h"
9 
10 namespace partition_alloc {
11 
12 using PartitionAllocOomCallback = void (*)();
13 
14 // Registers a callback to be invoked during an OOM_CRASH(). OOM_CRASH is
15 // invoked by users of PageAllocator (including PartitionAlloc) to signify an
16 // allocation failure from the platform.
17 PA_COMPONENT_EXPORT(PARTITION_ALLOC)
18 void SetPartitionAllocOomCallback(PartitionAllocOomCallback callback);
19 
20 namespace internal {
21 PA_COMPONENT_EXPORT(PARTITION_ALLOC) void RunPartitionAllocOomCallback();
22 }  // namespace internal
23 
24 }  // namespace partition_alloc
25 
26 #endif  // PARTITION_ALLOC_OOM_CALLBACK_H_
27