#include "cc/raster/zero_copy_raster_buffer_provider.h"
#include <stdint.h>
#include <algorithm>
#include <utility>
#include "base/memory/raw_ptr.h"
#include "base/trace_event/process_memory_dump.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "cc/resources/resource_pool.h"
#include "components/viz/client/client_resource_provider.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "components/viz/common/resources/platform_color.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "gpu/command_buffer/client/client_shared_image.h"
#include "gpu/command_buffer/client/shared_image_interface.h"
#include "gpu/command_buffer/common/shared_image_trace_utils.h"
#include "gpu/command_buffer/common/shared_image_usage.h"
#include "ui/gfx/buffer_format_util.h"
namespace cc {
namespace {
constexpr static auto kBufferUsage = …;
class ZeroCopyGpuBacking : public ResourcePool::GpuBacking { … };
class ZeroCopyRasterBufferImpl : public RasterBuffer { … };
}
ZeroCopyRasterBufferProvider::ZeroCopyRasterBufferProvider(
viz::RasterContextProvider* compositor_context_provider,
const RasterCapabilities& raster_caps)
: … { … }
ZeroCopyRasterBufferProvider::~ZeroCopyRasterBufferProvider() = default;
std::unique_ptr<RasterBuffer>
ZeroCopyRasterBufferProvider::AcquireBufferForRaster(
const ResourcePool::InUsePoolResource& resource,
uint64_t resource_content_id,
uint64_t previous_content_id,
bool depends_on_at_raster_decodes,
bool depends_on_hardware_accelerated_jpeg_candidates,
bool depends_on_hardware_accelerated_webp_candidates) { … }
void ZeroCopyRasterBufferProvider::Flush() { … }
viz::SharedImageFormat ZeroCopyRasterBufferProvider::GetFormat() const { … }
bool ZeroCopyRasterBufferProvider::IsResourcePremultiplied() const { … }
bool ZeroCopyRasterBufferProvider::CanPartialRasterIntoProvidedResource()
const { … }
bool ZeroCopyRasterBufferProvider::IsResourceReadyToDraw(
const ResourcePool::InUsePoolResource& resource) { … }
uint64_t ZeroCopyRasterBufferProvider::SetReadyToDrawCallback(
const std::vector<const ResourcePool::InUsePoolResource*>& resources,
base::OnceClosure callback,
uint64_t pending_callback_id) { … }
void ZeroCopyRasterBufferProvider::SetShutdownEvent(
base::WaitableEvent* shutdown_event) { … }
void ZeroCopyRasterBufferProvider::Shutdown() { … }
}