chromium/base/allocator/partition_allocator/src/partition_alloc/partition_alloc_hooks.cc

// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#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() {}

}  // namespace

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) {}

// Do not unset the hook if there are remaining quarantined slots
// not to break checks on unquarantining.
void PartitionAllocHooks::SetQuarantineOverrideHook(
    QuarantineOverrideHook* hook) {}

}  // namespace partition_alloc