chromium/components/viz/service/frame_sinks/frame_sink_bundle_impl.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "components/viz/service/frame_sinks/frame_sink_bundle_impl.h"

#include <map>
#include <utility>
#include <vector>

#include "base/check.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/memory/raw_ref.h"
#include "base/memory/weak_ptr.h"
#include "build/build_config.h"
#include "components/viz/service/frame_sinks/compositor_frame_sink_impl.h"
#include "components/viz/service/frame_sinks/frame_sink_manager_impl.h"
#include "mojo/public/cpp/bindings/receiver.h"
#include "mojo/public/cpp/bindings/remote.h"
#include "services/viz/public/mojom/compositing/compositor_frame_sink.mojom.h"
#include "services/viz/public/mojom/compositing/frame_sink_bundle.mojom.h"

namespace viz {

// A SinkGroup is responsible for batching messages out to a group of
// bundled CompositorFrameSink clients who all share a common BeginFrameSource.
// FrameSinkBundleImpls may own any number of SinkGroups, and groups are created
// or destroyed as needed when a sink is added to or removed from the bundle.
//
// Note that the BeginFrameSource is only observed by this SinkGroup while there
// are active FrameSinks present who have explicitly indicated a need for
// BeginFrame notifications. This avoids generation and processing of unused
// frame events which might otherwise incur substantial overhead.
class FrameSinkBundleImpl::SinkGroup : public BeginFrameObserver {};

FrameSinkBundleImpl::FrameSinkBundleImpl(
    FrameSinkManagerImpl& manager,
    const FrameSinkBundleId& id,
    mojo::PendingReceiver<mojom::FrameSinkBundle> receiver,
    mojo::PendingRemote<mojom::FrameSinkBundleClient> client)
    :{}

FrameSinkBundleImpl::~FrameSinkBundleImpl() = default;

void FrameSinkBundleImpl::SetSinkNeedsBeginFrame(uint32_t sink_id,
                                                 bool needs_begin_frame) {}

void FrameSinkBundleImpl::AddFrameSink(CompositorFrameSinkSupport* support) {}

void FrameSinkBundleImpl::UpdateFrameSink(CompositorFrameSinkSupport* support,
                                          BeginFrameSource* old_source) {}

void FrameSinkBundleImpl::RemoveFrameSink(CompositorFrameSinkSupport* support) {}

void FrameSinkBundleImpl::InitializeCompositorFrameSinkType(
    uint32_t sink_id,
    mojom::CompositorFrameSinkType type) {}

void FrameSinkBundleImpl::SetNeedsBeginFrame(uint32_t sink_id,
                                             bool needs_begin_frame) {}

void FrameSinkBundleImpl::SetWantsBeginFrameAcks(uint32_t sink_id) {}

void FrameSinkBundleImpl::Submit(
    std::vector<mojom::BundledFrameSubmissionPtr> submissions) {}

void FrameSinkBundleImpl::DidAllocateSharedBitmap(
    uint32_t sink_id,
    base::ReadOnlySharedMemoryRegion region,
    const SharedBitmapId& id) {}

#if BUILDFLAG(IS_ANDROID)
void FrameSinkBundleImpl::SetThreadIds(uint32_t sink_id,
                                       const std::vector<int32_t>& thread_ids) {
  if (auto* sink = GetFrameSink(sink_id)) {
    sink->SetThreadIds(thread_ids);
  }
}
#endif

void FrameSinkBundleImpl::EnqueueDidReceiveCompositorFrameAck(
    uint32_t sink_id,
    std::vector<ReturnedResource> resources) {}

void FrameSinkBundleImpl::EnqueueOnBeginFrame(
    uint32_t sink_id,
    const BeginFrameArgs& args,
    const base::flat_map<uint32_t, FrameTimingDetails>& details,
    bool frame_ack,
    std::vector<ReturnedResource> resources) {}

void FrameSinkBundleImpl::EnqueueReclaimResources(
    uint32_t sink_id,
    std::vector<ReturnedResource> resources) {}

void FrameSinkBundleImpl::SendOnBeginFramePausedChanged(uint32_t sink_id,
                                                        bool paused) {}

void FrameSinkBundleImpl::SendOnCompositorFrameTransitionDirectiveProcessed(
    uint32_t sink_id,
    uint32_t sequence_id) {}

void FrameSinkBundleImpl::RemoveFrameSinkImpl(BeginFrameSource* source,
                                              uint32_t sink_id) {}

CompositorFrameSinkImpl* FrameSinkBundleImpl::GetFrameSink(
    uint32_t sink_id) const {}

CompositorFrameSinkSupport* FrameSinkBundleImpl::GetFrameSinkSupport(
    uint32_t sink_id) const {}

FrameSinkBundleImpl::SinkGroup* FrameSinkBundleImpl::GetSinkGroup(
    uint32_t sink_id) const {}

void FrameSinkBundleImpl::OnDisconnect() {}

}  // namespace viz