xref: /aosp_15_r20/external/cronet/base/allocator/partition_allocator/src/partition_alloc/partition_oom.cc (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 #include "partition_alloc/partition_oom.h"
6 
7 #include "build/build_config.h"
8 #include "partition_alloc/oom.h"
9 #include "partition_alloc/partition_alloc_base/compiler_specific.h"
10 #include "partition_alloc/partition_alloc_base/debug/alias.h"
11 
12 namespace partition_alloc::internal {
13 
14 OomFunction g_oom_handling_function = nullptr;
15 
PartitionExcessiveAllocationSize(size_t size)16 PA_NOINLINE PA_NOT_TAIL_CALLED void PartitionExcessiveAllocationSize(
17     size_t size) {
18   PA_NO_CODE_FOLDING();
19   OOM_CRASH(size);
20 }
21 
22 #if !defined(ARCH_CPU_64_BITS)
23 PA_NOINLINE PA_NOT_TAIL_CALLED void
PartitionOutOfMemoryWithLotsOfUncommitedPages(size_t size)24 PartitionOutOfMemoryWithLotsOfUncommitedPages(size_t size) {
25   PA_NO_CODE_FOLDING();
26   OOM_CRASH(size);
27 }
28 
29 [[noreturn]] PA_NOT_TAIL_CALLED PA_NOINLINE void
PartitionOutOfMemoryWithLargeVirtualSize(size_t virtual_size)30 PartitionOutOfMemoryWithLargeVirtualSize(size_t virtual_size) {
31   PA_NO_CODE_FOLDING();
32   OOM_CRASH(virtual_size);
33 }
34 
35 #endif  // !defined(ARCH_CPU_64_BITS)
36 
37 }  // namespace partition_alloc::internal
38