1 // Copyright 2022 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 "base/allocator/dispatcher/internal/dispatch_data.h" 6 #include "partition_alloc/partition_alloc_buildflags.h" 7 8 namespace base::allocator::dispatcher::internal { 9 10 #if BUILDFLAG(USE_PARTITION_ALLOC) 11 SetAllocationObserverHooks(AllocationObserverHook * allocation_observer_hook,FreeObserverHook * free_observer_hook)12DispatchData& DispatchData::SetAllocationObserverHooks( 13 AllocationObserverHook* allocation_observer_hook, 14 FreeObserverHook* free_observer_hook) { 15 allocation_observer_hook_ = allocation_observer_hook; 16 free_observer_hook_ = free_observer_hook; 17 18 return *this; 19 } 20 GetAllocationObserverHook() const21DispatchData::AllocationObserverHook* DispatchData::GetAllocationObserverHook() 22 const { 23 return allocation_observer_hook_; 24 } 25 GetFreeObserverHook() const26DispatchData::FreeObserverHook* DispatchData::GetFreeObserverHook() const { 27 return free_observer_hook_; 28 } 29 #endif 30 31 #if BUILDFLAG(USE_ALLOCATOR_SHIM) SetAllocatorDispatch(AllocatorDispatch * allocator_dispatch)32DispatchData& DispatchData::SetAllocatorDispatch( 33 AllocatorDispatch* allocator_dispatch) { 34 allocator_dispatch_ = allocator_dispatch; 35 return *this; 36 } 37 GetAllocatorDispatch() const38AllocatorDispatch* DispatchData::GetAllocatorDispatch() const { 39 return allocator_dispatch_; 40 } 41 #endif 42 } // namespace base::allocator::dispatcher::internal 43