#include "components/viz/service/frame_sinks/compositor_frame_sink_impl.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/containers/flat_set.h"
#include "base/functional/bind.h"
#include "base/functional/callback_helpers.h"
#include "base/memory/raw_ref.h"
#include "base/threading/platform_thread.h"
#include "build/build_config.h"
#include "components/viz/service/frame_sinks/frame_sink_bundle_impl.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "services/viz/public/mojom/compositing/layer_context.mojom.h"
#include "ui/gfx/overlay_transform.h"
namespace viz {
namespace {
class BundleClientProxy : public mojom::CompositorFrameSinkClient { … };
}
CompositorFrameSinkImpl::CompositorFrameSinkImpl(
FrameSinkManagerImpl* frame_sink_manager,
const FrameSinkId& frame_sink_id,
std::optional<FrameSinkBundleId> bundle_id,
mojo::PendingReceiver<mojom::CompositorFrameSink> receiver,
mojo::PendingRemote<mojom::CompositorFrameSinkClient> client)
: … { … }
CompositorFrameSinkImpl::~CompositorFrameSinkImpl() = default;
void CompositorFrameSinkImpl::SetNeedsBeginFrame(bool needs_begin_frame) { … }
void CompositorFrameSinkImpl::SetWantsAnimateOnlyBeginFrames() { … }
void CompositorFrameSinkImpl::SetWantsBeginFrameAcks() { … }
void CompositorFrameSinkImpl::SetAutoNeedsBeginFrame() { … }
void CompositorFrameSinkImpl::SubmitCompositorFrame(
const LocalSurfaceId& local_surface_id,
CompositorFrame frame,
std::optional<HitTestRegionList> hit_test_region_list,
uint64_t submit_time) { … }
void CompositorFrameSinkImpl::SubmitCompositorFrameSync(
const LocalSurfaceId& local_surface_id,
CompositorFrame frame,
std::optional<HitTestRegionList> hit_test_region_list,
uint64_t submit_time,
SubmitCompositorFrameSyncCallback callback) { … }
void CompositorFrameSinkImpl::SubmitCompositorFrameInternal(
const LocalSurfaceId& local_surface_id,
CompositorFrame frame,
std::optional<HitTestRegionList> hit_test_region_list,
uint64_t submit_time,
mojom::CompositorFrameSink::SubmitCompositorFrameSyncCallback callback) { … }
void CompositorFrameSinkImpl::DidNotProduceFrame(
const BeginFrameAck& begin_frame_ack) { … }
void CompositorFrameSinkImpl::DidAllocateSharedBitmap(
base::ReadOnlySharedMemoryRegion region,
const SharedBitmapId& id) { … }
void CompositorFrameSinkImpl::DidDeleteSharedBitmap(const SharedBitmapId& id) { … }
void CompositorFrameSinkImpl::InitializeCompositorFrameSinkType(
mojom::CompositorFrameSinkType type) { … }
void CompositorFrameSinkImpl::BindLayerContext(
mojom::PendingLayerContextPtr context) { … }
#if BUILDFLAG(IS_ANDROID)
void CompositorFrameSinkImpl::SetThreadIds(
const std::vector<int32_t>& thread_ids) {
support_->SetThreadIds(true,
base::MakeFlatSet<base::PlatformThreadId>(thread_ids));
}
#endif
void CompositorFrameSinkImpl::OnClientConnectionLost() { … }
}