chromium/cc/slim/layer_tree_impl.cc

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

#include "cc/slim/layer_tree_impl.h"

#include <algorithm>
#include <memory>
#include <vector>

#include "base/auto_reset.h"
#include "base/containers/adapters.h"
#include "base/metrics/histogram.h"
#include "base/ranges/algorithm.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/typed_macros.h"
#include "cc/base/histograms.h"
#include "cc/base/region.h"
#include "cc/slim/frame_data.h"
#include "cc/slim/frame_sink_impl.h"
#include "cc/slim/layer.h"
#include "cc/slim/layer_tree_client.h"
#include "cc/slim/surface_layer.h"
#include "components/viz/common/frame_sinks/begin_frame_args.h"
#include "components/viz/common/hit_test/hit_test_region_list.h"
#include "components/viz/common/quads/compositor_frame.h"
#include "components/viz/common/quads/compositor_frame_metadata.h"
#include "components/viz/common/quads/compositor_render_pass.h"
#include "components/viz/common/quads/compositor_render_pass_draw_quad.h"
#include "components/viz/common/quads/draw_quad.h"
#include "components/viz/common/quads/frame_deadline.h"
#include "components/viz/common/quads/offset_tag.h"
#include "components/viz/common/quads/solid_color_draw_quad.h"
#include "third_party/skia/include/core/SkColor.h"
#include "ui/gfx/geometry/rect.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/rect_f.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gfx/geometry/transform.h"
#include "ui/gfx/geometry/transform_util.h"
#include "ui/gfx/geometry/vector2d_f.h"

namespace cc::slim {

namespace {

class LayerTreeImplScopedKeepSurfaceAlive
    : public LayerTree::ScopedKeepSurfaceAlive {};

}  // namespace

LayerTreeImpl::PresentationCallbackInfo::PresentationCallbackInfo(
    uint32_t frame_token,
    std::vector<PresentationCallback> presentation_callbacks,
    std::vector<SuccessfulCallback> success_callbacks)
    :{}
LayerTreeImpl::PresentationCallbackInfo::~PresentationCallbackInfo() = default;
LayerTreeImpl::PresentationCallbackInfo::PresentationCallbackInfo(
    PresentationCallbackInfo&&) = default;
LayerTreeImpl::PresentationCallbackInfo&
LayerTreeImpl::PresentationCallbackInfo::operator=(PresentationCallbackInfo&&) =
    default;

LayerTreeImpl::LayerTreeImpl(LayerTreeClient* client,
                             uint32_t num_unneeded_begin_frame_before_stop,
                             int min_occlusion_tracking_dimension)
    :{}

LayerTreeImpl::~LayerTreeImpl() {}

cc::UIResourceManager* LayerTreeImpl::GetUIResourceManager() {}

void LayerTreeImpl::SetViewportRectAndScale(
    const gfx::Rect& device_viewport_rect,
    float device_scale_factor,
    const viz::LocalSurfaceId& local_surface_id) {}

void LayerTreeImpl::set_background_color(SkColor4f color) {}

void LayerTreeImpl::SetVisible(bool visible) {}

bool LayerTreeImpl::IsVisible() const {}

void LayerTreeImpl::RequestPresentationTimeForNextFrame(
    PresentationCallback callback) {}

void LayerTreeImpl::RequestSuccessfulPresentationTimeForNextFrame(
    SuccessfulCallback callback) {}

void LayerTreeImpl::set_display_transform_hint(gfx::OverlayTransform hint) {}

void LayerTreeImpl::RequestCopyOfOutput(
    std::unique_ptr<viz::CopyOutputRequest> request) {}

base::OnceClosure LayerTreeImpl::DeferBeginFrame() {}

void LayerTreeImpl::ReleaseDeferBeginFrame() {}

void LayerTreeImpl::SetNeedsAnimate() {}

void LayerTreeImpl::MaybeCompositeNow() {}

const scoped_refptr<Layer>& LayerTreeImpl::root() const {}

void LayerTreeImpl::SetRoot(scoped_refptr<Layer> root) {}

void LayerTreeImpl::SetFrameSink(std::unique_ptr<FrameSink> sink) {}

void LayerTreeImpl::ReleaseLayerTreeFrameSink() {}

std::unique_ptr<LayerTree::ScopedKeepSurfaceAlive>
LayerTreeImpl::CreateScopedKeepSurfaceAlive(const viz::SurfaceId& surface_id) {}

const LayerTree::SurfaceRangesAndCounts&
LayerTreeImpl::GetSurfaceRangesForTesting() const {}

void LayerTreeImpl::SetNeedsRedrawForTesting() {}

bool LayerTreeImpl::BeginFrame(
    const viz::BeginFrameArgs& args,
    viz::CompositorFrame& out_frame,
    base::flat_set<viz::ResourceId>& out_resource_ids,
    viz::HitTestRegionList& out_hit_test_region_list) {}

void LayerTreeImpl::DidReceiveCompositorFrameAck() {}

void LayerTreeImpl::DidSubmitCompositorFrame() {}

void LayerTreeImpl::DidPresentCompositorFrame(
    uint32_t frame_token,
    const viz::FrameTimingDetails& details) {}

void LayerTreeImpl::DidLoseLayerTreeFrameSink() {}

void LayerTreeImpl::NotifyTreeChanged() {}

viz::ClientResourceProvider* LayerTreeImpl::GetClientResourceProvider() {}

viz::ResourceId LayerTreeImpl::GetVizResourceId(cc::UIResourceId id) {}

bool LayerTreeImpl::IsUIResourceOpaque(int resource_id) {}

gfx::Size LayerTreeImpl::GetUIResourceSize(int resource_id) {}

void LayerTreeImpl::AddSurfaceRange(const viz::SurfaceRange& range) {}

void LayerTreeImpl::RemoveSurfaceRange(const viz::SurfaceRange& range) {}

void LayerTreeImpl::RegisterOffsetTag(const viz::OffsetTag& tag,
                                      SurfaceLayer* owner) {}

void LayerTreeImpl::UnregisterOffsetTag(const viz::OffsetTag& tag,
                                        SurfaceLayer* owner) {}

void LayerTreeImpl::MaybeRequestFrameSink() {}

void LayerTreeImpl::UpdateNeedsBeginFrame() {}

void LayerTreeImpl::SetClientNeedsOneBeginFrame() {}

void LayerTreeImpl::SetNeedsDraw() {}

bool LayerTreeImpl::NeedsDraw() const {}

bool LayerTreeImpl::NeedsBeginFrames() const {}

void LayerTreeImpl::GenerateCompositorFrame(
    const viz::BeginFrameArgs& args,
    viz::CompositorFrame& out_frame,
    base::flat_set<viz::ResourceId>& out_resource_ids,
    viz::HitTestRegionList& out_hit_test_region_list) {}

void LayerTreeImpl::Draw(Layer& layer,
                         viz::CompositorRenderPass& parent_pass,
                         FrameData& data,
                         const gfx::Transform& parent_transform_to_root,
                         const gfx::Transform& parent_transform_to_target,
                         const gfx::RectF* parent_clip_in_target,
                         const gfx::RectF& clip_in_parent,
                         float parent_opacity) {}

void LayerTreeImpl::DrawChildrenAndAppendQuads(
    Layer& layer,
    viz::CompositorRenderPass& render_pass,
    FrameData& data,
    const gfx::Transform& transform_to_root,
    const gfx::Transform& transform_to_target,
    const gfx::RectF* clip_in_target,
    const gfx::RectF& clip_in_layer,
    float opacity) {}

bool LayerTreeImpl::UpdateOcclusionRect(
    Layer& layer,
    FrameData& data,
    const gfx::Transform& transform_to_target,
    float opacity,
    const gfx::RectF& visible_rectf_in_target,
    gfx::RectF& visible_rect) {}

void LayerTreeImpl::ProcessDamageForRenderPass(
    viz::CompositorRenderPass& render_pass,
    FrameData& data) {}

}  // namespace cc::slim