#include "third_party/blink/renderer/platform/graphics/video_frame_sink_bundle.h"
#include <memory>
#include <tuple>
#include <utility>
#include "base/check.h"
#include "build/build_config.h"
#include "services/viz/public/mojom/compositing/compositor_frame_sink.mojom-blink.h"
#include "third_party/blink/public/common/thread_safe_browser_interface_broker_proxy.h"
#include "third_party/blink/public/mojom/frame_sinks/embedded_frame_sink.mojom-blink.h"
#include "third_party/blink/public/platform/platform.h"
#include "third_party/blink/renderer/platform/graphics/viz_util.h"
#include "third_party/blink/renderer/platform/wtf/thread_specific.h"
namespace blink {
namespace {
mojom::blink::EmbeddedFrameSinkProvider* g_frame_sink_provider_override = …;
std::unique_ptr<VideoFrameSinkBundle>& GetThreadFrameSinkBundlePtr() { … }
}
VideoFrameSinkBundle::VideoFrameSinkBundle(base::PassKey<VideoFrameSinkBundle>,
uint32_t client_id)
: … { … }
VideoFrameSinkBundle::~VideoFrameSinkBundle() = default;
VideoFrameSinkBundle& VideoFrameSinkBundle::GetOrCreateSharedInstance(
uint32_t client_id) { … }
VideoFrameSinkBundle* VideoFrameSinkBundle::GetSharedInstanceForTesting() { … }
void VideoFrameSinkBundle::DestroySharedInstanceForTesting() { … }
void VideoFrameSinkBundle::SetFrameSinkProviderForTesting(
mojom::blink::EmbeddedFrameSinkProvider* provider) { … }
void VideoFrameSinkBundle::SetBeginFrameObserver(
std::unique_ptr<BeginFrameObserver> observer) { … }
base::WeakPtr<VideoFrameSinkBundle> VideoFrameSinkBundle::AddClient(
const viz::FrameSinkId& frame_sink_id,
viz::mojom::blink::CompositorFrameSinkClient* client,
mojo::Remote<mojom::blink::EmbeddedFrameSinkProvider>& frame_sink_provider,
mojo::Receiver<viz::mojom::blink::CompositorFrameSinkClient>& receiver,
mojo::Remote<viz::mojom::blink::CompositorFrameSink>& remote) { … }
void VideoFrameSinkBundle::RemoveClient(const viz::FrameSinkId& frame_sink_id) { … }
void VideoFrameSinkBundle::InitializeCompositorFrameSinkType(
uint32_t sink_id,
viz::mojom::blink::CompositorFrameSinkType type) { … }
void VideoFrameSinkBundle::SetNeedsBeginFrame(uint32_t sink_id,
bool needs_begin_frame) { … }
void VideoFrameSinkBundle::SetWantsBeginFrameAcks(uint32_t sink_id) { … }
void VideoFrameSinkBundle::SubmitCompositorFrame(
uint32_t sink_id,
const viz::LocalSurfaceId& local_surface_id,
viz::CompositorFrame frame,
std::optional<viz::HitTestRegionList> hit_test_region_list,
uint64_t submit_time) { … }
void VideoFrameSinkBundle::DidNotProduceFrame(uint32_t sink_id,
const viz::BeginFrameAck& ack) { … }
void VideoFrameSinkBundle::DidAllocateSharedBitmap(
uint32_t sink_id,
base::ReadOnlySharedMemoryRegion region,
const viz::SharedBitmapId& id) { … }
void VideoFrameSinkBundle::DidDeleteSharedBitmap(
uint32_t sink_id,
const viz::SharedBitmapId& id) { … }
#if BUILDFLAG(IS_ANDROID)
void VideoFrameSinkBundle::SetThreadIds(
uint32_t sink_id,
const WTF::Vector<int32_t>& thread_ids) {
bundle_->SetThreadIds(sink_id, thread_ids);
}
#endif
void VideoFrameSinkBundle::FlushNotifications(
WTF::Vector<viz::mojom::blink::BundledReturnedResourcesPtr> acks,
WTF::Vector<viz::mojom::blink::BeginFrameInfoPtr> begin_frames,
WTF::Vector<viz::mojom::blink::BundledReturnedResourcesPtr>
reclaimed_resources) { … }
void VideoFrameSinkBundle::OnBeginFramePausedChanged(uint32_t sink_id,
bool paused) { … }
void VideoFrameSinkBundle::OnCompositorFrameTransitionDirectiveProcessed(
uint32_t sink_id,
uint32_t sequence_id) { … }
void VideoFrameSinkBundle::OnDisconnected() { … }
void VideoFrameSinkBundle::FlushMessages() { … }
}