#include "services/viz/public/cpp/gpu/client_gpu_memory_buffer_manager.h"
#include <utility>
#include "base/check_op.h"
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/synchronization/waitable_event.h"
#include "base/task/bind_post_task.h"
#include "base/task/single_thread_task_runner.h"
#include "base/threading/thread_restrictions.h"
#include "gpu/config/gpu_finch_features.h"
#include "gpu/ipc/common/gpu_memory_buffer_impl.h"
#include "gpu/ipc/common/gpu_memory_buffer_impl_shared_memory.h"
#include "gpu/ipc/common/gpu_memory_buffer_support.h"
#include "mojo/public/cpp/bindings/callback_helpers.h"
#include "mojo/public/cpp/system/buffer.h"
#include "mojo/public/cpp/system/platform_handle.h"
#include "ui/gfx/buffer_format_util.h"
namespace viz {
ClientGpuMemoryBufferManager::ClientGpuMemoryBufferManager(
mojo::PendingRemote<gpu::mojom::ClientGmbInterface> gpu_direct)
: … { … }
ClientGpuMemoryBufferManager::~ClientGpuMemoryBufferManager() { … }
void ClientGpuMemoryBufferManager::InitThread(
mojo::PendingRemote<gpu::mojom::ClientGmbInterface> gpu_direct_remote) { … }
void ClientGpuMemoryBufferManager::TearDownThread() { … }
void ClientGpuMemoryBufferManager::DisconnectGpuOnThread() { … }
void ClientGpuMemoryBufferManager::AllocateGpuMemoryBufferOnThread(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
gfx::GpuMemoryBufferHandle* handle,
base::WaitableEvent* wait) { … }
void ClientGpuMemoryBufferManager::OnGpuMemoryBufferAllocatedOnThread(
gfx::GpuMemoryBufferHandle* ret_handle,
base::WaitableEvent* wait,
gfx::GpuMemoryBufferHandle handle) { … }
void ClientGpuMemoryBufferManager::DeletedGpuMemoryBuffer(
gfx::GpuMemoryBufferId id) { … }
std::unique_ptr<gfx::GpuMemoryBuffer>
ClientGpuMemoryBufferManager::CreateGpuMemoryBuffer(
const gfx::Size& size,
gfx::BufferFormat format,
gfx::BufferUsage usage,
gpu::SurfaceHandle surface_handle,
base::WaitableEvent* shutdown_event) { … }
void ClientGpuMemoryBufferManager::CopyGpuMemoryBufferAsync(
gfx::GpuMemoryBufferHandle buffer_handle,
base::UnsafeSharedMemoryRegion memory_region,
base::OnceCallback<void(bool)> callback) { … }
bool ClientGpuMemoryBufferManager::CopyGpuMemoryBufferSync(
gfx::GpuMemoryBufferHandle buffer_handle,
base::UnsafeSharedMemoryRegion memory_region) { … }
}