partition_oom.cc 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. // Copyright (c) 2018 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "base/allocator/partition_allocator/partition_oom.h"
  5. #include "base/allocator/partition_allocator/oom.h"
  6. #include "base/allocator/partition_allocator/partition_alloc_base/compiler_specific.h"
  7. #include "base/allocator/partition_allocator/partition_alloc_base/debug/alias.h"
  8. #include "build/build_config.h"
  9. namespace partition_alloc::internal {
  10. OomFunction g_oom_handling_function = nullptr;
  11. PA_NOINLINE void PA_NOT_TAIL_CALLED
  12. PartitionExcessiveAllocationSize(size_t size) {
  13. PA_NO_CODE_FOLDING();
  14. OOM_CRASH(size);
  15. }
  16. #if !defined(ARCH_CPU_64_BITS)
  17. PA_NOINLINE void PA_NOT_TAIL_CALLED
  18. PartitionOutOfMemoryWithLotsOfUncommitedPages(size_t size) {
  19. PA_NO_CODE_FOLDING();
  20. OOM_CRASH(size);
  21. }
  22. [[noreturn]] PA_NOINLINE void PA_NOT_TAIL_CALLED
  23. PartitionOutOfMemoryWithLargeVirtualSize(size_t virtual_size) {
  24. PA_NO_CODE_FOLDING();
  25. OOM_CRASH(virtual_size);
  26. }
  27. #endif // !defined(ARCH_CPU_64_BITS)
  28. } // namespace partition_alloc::internal