#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/slim/frame_sink_impl.h"
#include <string>
#include <utility>
#include <vector>
#include "base/check.h"
#include "base/containers/flat_set.h"
#include "base/functional/bind.h"
#include "base/not_fatal_until.h"
#include "base/threading/platform_thread.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "build/build_config.h"
#include "cc/slim/constants.h"
#include "cc/slim/delayed_scheduler.h"
#include "cc/slim/frame_sink_impl_client.h"
#include "components/viz/common/features.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/resources/platform_color.h"
#include "components/viz/common/resources/resource_id.h"
#include "components/viz/common/resources/shared_image_format.h"
#include "components/viz/common/resources/shared_image_format_utils.h"
#include "components/viz/common/resources/transferable_resource.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_usage.h"
#include "third_party/skia/include/core/SkAlphaType.h"
#include "third_party/skia/include/gpu/GrTypes.h"
#include "ui/gfx/buffer_types.h"
#include "ui/gfx/color_space.h"
namespace cc::slim {
FrameSinkImpl::UploadedUIResource::UploadedUIResource() = default;
FrameSinkImpl::UploadedUIResource::~UploadedUIResource() = default;
FrameSinkImpl::UploadedUIResource::UploadedUIResource(
const UploadedUIResource&) = default;
FrameSinkImpl::UploadedUIResource& FrameSinkImpl::UploadedUIResource::operator=(
const UploadedUIResource&) = default;
FrameSinkImpl::FrameSinkImpl(
scoped_refptr<base::SingleThreadTaskRunner> task_runner,
mojo::PendingAssociatedRemote<viz::mojom::CompositorFrameSink>
compositor_frame_sink_associated_remote,
mojo::PendingReceiver<viz::mojom::CompositorFrameSinkClient>
client_receiver,
scoped_refptr<viz::RasterContextProvider> context_provider,
base::PlatformThreadId io_thread_id,
std::unique_ptr<Scheduler> scheduler)
: … { … }
FrameSinkImpl::~FrameSinkImpl() { … }
void FrameSinkImpl::SetLocalSurfaceId(
const viz::LocalSurfaceId& local_surface_id) { … }
bool FrameSinkImpl::BindToClient(FrameSinkImplClient* client) { … }
void FrameSinkImpl::OnContextLost() { … }
void FrameSinkImpl::SetNeedsBeginFrame(bool needs_begin_frame) { … }
void FrameSinkImpl::MaybeCompositeNow() { … }
void FrameSinkImpl::UploadUIResource(cc::UIResourceId resource_id,
cc::UIResourceBitmap resource_bitmap) { … }
void FrameSinkImpl::UIResourceReleased(cc::UIResourceId ui_resource_id,
const gpu::SyncToken& sync_token,
bool is_lost) { … }
void FrameSinkImpl::MarkUIResourceForDeletion(cc::UIResourceId resource_id) { … }
viz::ResourceId FrameSinkImpl::GetVizResourceId(cc::UIResourceId resource_id) { … }
bool FrameSinkImpl::IsUIResourceOpaque(cc::UIResourceId resource_id) { … }
gfx::Size FrameSinkImpl::GetUIResourceSize(cc::UIResourceId resource_id) { … }
int FrameSinkImpl::GetMaxTextureSize() const { … }
void FrameSinkImpl::DidReceiveCompositorFrameAck(
std::vector<viz::ReturnedResource> resources) { … }
void FrameSinkImpl::ReclaimResources(
std::vector<viz::ReturnedResource> resources) { … }
void FrameSinkImpl::OnBeginFrame(
const viz::BeginFrameArgs& begin_frame_args,
const viz::FrameTimingDetailsMap& timing_details,
bool frame_ack,
std::vector<viz::ReturnedResource> resources) { … }
bool FrameSinkImpl::DoBeginFrame(const viz::BeginFrameArgs& begin_frame_args) { … }
void FrameSinkImpl::SendDidNotProduceFrame(
const viz::BeginFrameArgs& begin_frame_args) { … }
}