#include "gpu/command_buffer/client/mapped_memory.h"
#include <stddef.h>
#include <stdint.h>
#include <algorithm>
#include <functional>
#include "base/atomic_sequence_num.h"
#include "base/check.h"
#include "base/memory/ptr_util.h"
#include "base/notreached.h"
#include "base/numerics/checked_math.h"
#include "base/numerics/safe_conversions.h"
#include "base/strings/stringprintf.h"
#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_event.h"
#include "gpu/command_buffer/client/cmd_buffer_helper.h"
#include "gpu/command_buffer/client/shared_memory_limits.h"
#include "gpu/command_buffer/common/buffer.h"
namespace gpu {
namespace {
base::AtomicSequenceNumber g_next_mapped_memory_manager_tracing_id;
}
MemoryChunk::MemoryChunk(int32_t shm_id,
scoped_refptr<gpu::Buffer> shm,
CommandBufferHelper* helper)
: … { … }
MemoryChunk::~MemoryChunk() = default;
MappedMemoryManager::MappedMemoryManager(CommandBufferHelper* helper,
size_t unused_memory_reclaim_limit)
: … { … }
MappedMemoryManager::~MappedMemoryManager() { … }
void* MappedMemoryManager::Alloc(unsigned int size,
int32_t* shm_id,
unsigned int* shm_offset,
TransferBufferAllocationOption option) { … }
void MappedMemoryManager::Free(void* pointer) { … }
void MappedMemoryManager::FreePendingToken(void* pointer, int32_t token) { … }
void MappedMemoryManager::FreeUnused() { … }
bool MappedMemoryManager::OnMemoryDump(
const base::trace_event::MemoryDumpArgs& args,
base::trace_event::ProcessMemoryDump* pmd) { … }
FencedAllocator::State MappedMemoryManager::GetPointerStatusForTest(
void* pointer,
int32_t* token_if_pending) { … }
void ScopedMappedMemoryPtr::Release() { … }
void ScopedMappedMemoryPtr::Reset(uint32_t new_size) { … }
}