#ifndef BASE_MEMORY_SAFETY_CHECKS_H_
#define BASE_MEMORY_SAFETY_CHECKS_H_
#include <cstdint>
#include "base/base_export.h"
#include "base/compiler_specific.h"
#include "base/memory/advanced_memory_safety_checks.h"
#include "base/memory/stack_allocated.h"
#include "partition_alloc/buildflags.h"
#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
#include "base/allocator/scheduler_loop_quarantine_support.h"
#endif
namespace base {
BASE_EXPORT void CheckHeapIntegrity(const void* ptr);
void SetDoubleFreeOrCorruptionDetectedFn(void (*fn)(uintptr_t));
class BASE_EXPORT ScopedSafetyChecksExclusion {
STACK_ALLOCATED();
public:
~ScopedSafetyChecksExclusion() {}
private:
#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
base::allocator::ScopedSchedulerLoopQuarantineExclusion
opt_out_scheduler_loop_quarantine_;
#endif
};
#if PA_BUILDFLAG(USE_PARTITION_ALLOC_AS_MALLOC)
using base::allocator::SchedulerLoopQuarantineScanPolicyUpdater;
using base::allocator::ScopedSchedulerLoopQuarantineDisallowScanlessPurge;
#else
class SchedulerLoopQuarantineScanPolicyUpdater {
public:
ALWAYS_INLINE void DisallowScanlessPurge() {}
ALWAYS_INLINE void AllowScanlessPurge() {}
};
class ScopedSchedulerLoopQuarantineDisallowScanlessPurge {};
#endif
}
#endif