#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "gpu/command_buffer/service/shared_memory_region_wrapper.h"
#include "base/logging.h"
#include "base/numerics/checked_math.h"
#include "base/system/sys_info.h"
#include "ui/gfx/buffer_format_util.h"
#include "ui/gfx/gpu_memory_buffer.h"
namespace gpu {
namespace {
bool ValidateStride(const gfx::Size size,
gfx::BufferFormat format,
uint32_t stride) { … }
}
SharedMemoryRegionWrapper::SharedMemoryRegionWrapper() = default;
SharedMemoryRegionWrapper::SharedMemoryRegionWrapper(
SharedMemoryRegionWrapper&& other) = default;
SharedMemoryRegionWrapper& SharedMemoryRegionWrapper::operator=(
SharedMemoryRegionWrapper&& other) = default;
SharedMemoryRegionWrapper::~SharedMemoryRegionWrapper() = default;
bool SharedMemoryRegionWrapper::Initialize(
const gfx::GpuMemoryBufferHandle& handle,
const gfx::Size& size,
gfx::BufferFormat format) { … }
bool SharedMemoryRegionWrapper::IsValid() const { … }
uint8_t* SharedMemoryRegionWrapper::GetMemory(int plane_index) const { … }
size_t SharedMemoryRegionWrapper::GetStride(int plane_index) const { … }
SkPixmap SharedMemoryRegionWrapper::MakePixmapForPlane(const SkImageInfo& info,
int plane_index) const { … }
const base::UnguessableToken& SharedMemoryRegionWrapper::GetMappingGuid()
const { … }
}