#include "partition_alloc/partition_alloc_hooks.h"
#include <ostream>
#include "partition_alloc/partition_alloc_check.h"
#include "partition_alloc/partition_lock.h"
namespace partition_alloc {
namespace {
internal::Lock g_hook_lock;
internal::Lock& GetHooksLock() { … }
}
std::atomic<bool> PartitionAllocHooks::hooks_enabled_(false);
std::atomic<PartitionAllocHooks::AllocationObserverHook*>
PartitionAllocHooks::allocation_observer_hook_(nullptr);
std::atomic<PartitionAllocHooks::FreeObserverHook*>
PartitionAllocHooks::free_observer_hook_(nullptr);
std::atomic<PartitionAllocHooks::AllocationOverrideHook*>
PartitionAllocHooks::allocation_override_hook_(nullptr);
std::atomic<PartitionAllocHooks::FreeOverrideHook*>
PartitionAllocHooks::free_override_hook_(nullptr);
std::atomic<PartitionAllocHooks::ReallocOverrideHook*>
PartitionAllocHooks::realloc_override_hook_(nullptr);
std::atomic<PartitionAllocHooks::QuarantineOverrideHook*>
PartitionAllocHooks::quarantine_override_hook_(nullptr);
void PartitionAllocHooks::SetObserverHooks(AllocationObserverHook* alloc_hook,
FreeObserverHook* free_hook) { … }
void PartitionAllocHooks::SetOverrideHooks(AllocationOverrideHook* alloc_hook,
FreeOverrideHook* free_hook,
ReallocOverrideHook realloc_hook) { … }
void PartitionAllocHooks::AllocationObserverHookIfEnabled(
const partition_alloc::AllocationNotificationData& notification_data) { … }
bool PartitionAllocHooks::AllocationOverrideHookIfEnabled(
void** out,
AllocFlags flags,
size_t size,
const char* type_name) { … }
void PartitionAllocHooks::FreeObserverHookIfEnabled(
const FreeNotificationData& notification_data) { … }
bool PartitionAllocHooks::FreeOverrideHookIfEnabled(void* address) { … }
void PartitionAllocHooks::ReallocObserverHookIfEnabled(
const FreeNotificationData& free_notification_data,
const AllocationNotificationData& allocation_notification_data) { … }
bool PartitionAllocHooks::ReallocOverrideHookIfEnabled(size_t* out,
void* address) { … }
void PartitionAllocHooks::SetQuarantineOverrideHook(
QuarantineOverrideHook* hook) { … }
}