#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gpu/command_buffer/common/buffer.h"
#include <stddef.h>
#include <stdint.h>
#include <ostream>
#include "base/atomic_sequence_num.h"
#include "base/bits.h"
#include "base/check_op.h"
#include "base/format_macros.h"
#include "base/no_destructor.h"
#include "base/numerics/safe_math.h"
#include "base/strings/stringprintf.h"
namespace gpu {
namespace {
base::AtomicSequenceNumber g_next_buffer_id;
}
const base::UnsafeSharedMemoryRegion& BufferBacking::shared_memory_region()
const { … }
base::UnguessableToken BufferBacking::GetGUID() const { … }
MemoryBufferBacking::MemoryBufferBacking(uint32_t size, uint32_t alignment)
: … { … }
MemoryBufferBacking::~MemoryBufferBacking() = default;
void* MemoryBufferBacking::GetMemory() const { … }
uint32_t MemoryBufferBacking::GetSize() const { … }
SharedMemoryBufferBacking::SharedMemoryBufferBacking(
base::UnsafeSharedMemoryRegion shared_memory_region,
base::WritableSharedMemoryMapping shared_memory_mapping)
: … { … }
SharedMemoryBufferBacking::~SharedMemoryBufferBacking() = default;
const base::UnsafeSharedMemoryRegion&
SharedMemoryBufferBacking::shared_memory_region() const { … }
base::UnguessableToken SharedMemoryBufferBacking::GetGUID() const { … }
void* SharedMemoryBufferBacking::GetMemory() const { … }
uint32_t SharedMemoryBufferBacking::GetSize() const { … }
Buffer::Buffer(std::unique_ptr<BufferBacking> backing)
: … { … }
Buffer::~Buffer() = default;
void* Buffer::GetDataAddress(uint32_t data_offset, uint32_t data_size) const { … }
void* Buffer::GetDataAddressAndSize(uint32_t data_offset,
uint32_t* data_size) const { … }
uint32_t Buffer::GetRemainingSize(uint32_t data_offset) const { … }
int32_t GetNextBufferId() { … }
base::trace_event::MemoryAllocatorDumpGuid GetBufferGUIDForTracing(
uint64_t tracing_process_id,
int32_t buffer_id) { … }
}