chromium/cc/trees/proxy_impl.cc

// Copyright 2015 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/trees/proxy_impl.h"

#include <string.h>

#include <algorithm>
#include <memory>
#include <string>
#include <utility>
#include <vector>

#include "base/auto_reset.h"
#include "base/functional/bind.h"
#include "base/memory/raw_ptr.h"
#include "base/notreached.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "base/trace_event/traced_value.h"
#include "base/trace_event/typed_macros.h"
#include "base/types/optional_ref.h"
#include "cc/base/devtools_instrumentation.h"
#include "cc/base/features.h"
#include "cc/benchmarks/benchmark_instrumentation.h"
#include "cc/input/browser_controls_offset_manager.h"
#include "cc/input/browser_controls_offset_tags_info.h"
#include "cc/metrics/compositor_timing_history.h"
#include "cc/paint/paint_worklet_layer_painter.h"
#include "cc/trees/compositor_commit_data.h"
#include "cc/trees/layer_tree_frame_sink.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/mutator_host.h"
#include "cc/trees/proxy_main.h"
#include "cc/trees/render_frame_metadata_observer.h"
#include "cc/trees/task_runner_provider.h"
#include "components/viz/common/frame_sinks/delay_based_time_source.h"
#include "components/viz/common/frame_timing_details.h"
#include "components/viz/common/gpu/raster_context_provider.h"
#include "services/metrics/public/cpp/ukm_recorder.h"

namespace cc {

namespace {

// Measured in seconds.
constexpr auto kSmoothnessTakesPriorityExpirationDelay =;

}  // namespace

// Ensures that a CompletionEvent for commit is always signaled.
class ScopedCommitCompletionEvent {};

ProxyImpl::ProxyImpl(
    base::WeakPtr<ProxyMain> proxy_main_weak_ptr,
    LayerTreeHost* layer_tree_host,
    int id,
    const LayerTreeSettings* settings,
    RenderingStatsInstrumentation* rendering_stats_instrumentation,
    TaskRunnerProvider* task_runner_provider)
    :{}

ProxyImpl::~ProxyImpl() {}

void ProxyImpl::InitializeMutatorOnImpl(
    std::unique_ptr<LayerTreeMutator> mutator) {}

void ProxyImpl::InitializePaintWorkletLayerPainterOnImpl(
    std::unique_ptr<PaintWorkletLayerPainter> painter) {}

void ProxyImpl::UpdateBrowserControlsStateOnImpl(
    BrowserControlsState constraints,
    BrowserControlsState current,
    bool animate,
    base::optional_ref<const BrowserControlsOffsetTagsInfo> offset_tags_info) {}

void ProxyImpl::InitializeLayerTreeFrameSinkOnImpl(
    LayerTreeFrameSink* layer_tree_frame_sink,
    base::WeakPtr<ProxyMain> proxy_main_frame_sink_bound_weak_ptr) {}

bool ProxyImpl::ShouldDeferBeginMainFrame() const {}

void ProxyImpl::SetDeferBeginMainFrameFromMain(bool defer_begin_main_frame) {}

void ProxyImpl::SetPauseRendering(bool pause_rendering) {}

void ProxyImpl::SetDeferBeginMainFrameFromImpl(bool defer_begin_main_frame) {}

void ProxyImpl::SetNeedsRedrawOnImpl(const gfx::Rect& damage_rect) {}

void ProxyImpl::SetNeedsCommitOnImpl() {}

void ProxyImpl::SetTargetLocalSurfaceIdOnImpl(
    const viz::LocalSurfaceId& target_local_surface_id) {}

void ProxyImpl::BeginMainFrameAbortedOnImpl(
    CommitEarlyOutReason reason,
    base::TimeTicks main_thread_start_time,
    std::vector<std::unique_ptr<SwapPromise>> swap_promises,
    bool scroll_and_viewport_changes_synced) {}

void ProxyImpl::SetVisibleOnImpl(bool visible) {}

void ProxyImpl::SetShouldWarmUpOnImpl() {}

void ProxyImpl::ReleaseLayerTreeFrameSinkOnImpl(CompletionEvent* completion) {}

void ProxyImpl::FinishGLOnImpl(CompletionEvent* completion) {}

void ProxyImpl::MainFrameWillHappenOnImplForTesting(
    CompletionEvent* completion,
    bool* main_frame_will_happen) {}

void ProxyImpl::RequestBeginMainFrameNotExpectedOnImpl(bool new_state) {}

bool ProxyImpl::IsInSynchronousComposite() const {}

void ProxyImpl::FrameSinksToThrottleUpdated(
    const base::flat_set<viz::FrameSinkId>& ids) {}

void ProxyImpl::SetHasActiveThreadedScroll(bool is_scrolling) {}

void ProxyImpl::SetWaitingForScrollEvent(bool waiting_for_scroll_event) {}

void ProxyImpl::NotifyReadyToCommitOnImpl(
    CompletionEvent* completion_event,
    std::unique_ptr<CommitState> commit_state,
    const ThreadUnsafeCommitState* unsafe_state,
    base::TimeTicks main_thread_start_time,
    const viz::BeginFrameArgs& commit_args,
    bool scroll_and_viewport_changes_synced,
    CommitTimestamps* commit_timestamps,
    bool commit_timeout) {}

void ProxyImpl::DidLoseLayerTreeFrameSinkOnImplThread() {}

void ProxyImpl::SetBeginFrameSource(viz::BeginFrameSource* source) {}

void ProxyImpl::DidReceiveCompositorFrameAckOnImplThread() {}

void ProxyImpl::OnCanDrawStateChanged(bool can_draw) {}

void ProxyImpl::NotifyReadyToActivate() {}

bool ProxyImpl::IsReadyToActivate() {}

void ProxyImpl::NotifyReadyToDraw() {}

void ProxyImpl::SetNeedsRedrawOnImplThread() {}

void ProxyImpl::SetNeedsOneBeginImplFrameOnImplThread() {}

void ProxyImpl::SetNeedsUpdateDisplayTreeOnImplThread() {}

void ProxyImpl::SetNeedsPrepareTilesOnImplThread() {}

void ProxyImpl::SetNeedsCommitOnImplThread() {}

void ProxyImpl::SetVideoNeedsBeginFrames(bool needs_begin_frames) {}

bool ProxyImpl::IsInsideDraw() {}

void ProxyImpl::RenewTreePriority() {}

void ProxyImpl::PostDelayedAnimationTaskOnImplThread(base::OnceClosure task,
                                                     base::TimeDelta delay) {}

void ProxyImpl::DidActivateSyncTree() {}

void ProxyImpl::DidPrepareTiles() {}

void ProxyImpl::DidCompletePageScaleAnimationOnImplThread() {}

void ProxyImpl::OnDrawForLayerTreeFrameSink(bool resourceless_software_draw,
                                            bool skip_draw) {}

void ProxyImpl::SetNeedsImplSideInvalidation(
    bool needs_first_draw_on_activation) {}

void ProxyImpl::NotifyImageDecodeRequestFinished(int request_id,
                                                 bool decode_succeeded) {}

void ProxyImpl::NotifyTransitionRequestFinished(uint32_t sequence_id) {}

void ProxyImpl::DidPresentCompositorFrameOnImplThread(
    uint32_t frame_token,
    PresentationTimeCallbackBuffer::PendingCallbacks activated,
    const viz::FrameTimingDetails& details) {}

void ProxyImpl::NotifyAnimationWorkletStateChange(
    AnimationWorkletMutationState state,
    ElementListType element_list_type) {}

void ProxyImpl::NotifyPaintWorkletStateChange(
    Scheduler::PaintWorkletState state) {}

void ProxyImpl::NotifyThroughputTrackerResults(CustomTrackerResults results) {}

void ProxyImpl::DidObserveFirstScrollDelay(
    int source_frame_number,
    base::TimeDelta first_scroll_delay,
    base::TimeTicks first_scroll_timestamp) {}

bool ProxyImpl::WillBeginImplFrame(const viz::BeginFrameArgs& args) {}

void ProxyImpl::DidFinishImplFrame(
    const viz::BeginFrameArgs& last_activated_args) {}

void ProxyImpl::DidNotProduceFrame(const viz::BeginFrameAck& ack,
                                   FrameSkippedReason reason) {}

void ProxyImpl::WillNotReceiveBeginFrame() {}

void ProxyImpl::ScheduledActionSendBeginMainFrame(
    const viz::BeginFrameArgs& args) {}

DrawResult ProxyImpl::ScheduledActionDrawIfPossible() {}

DrawResult ProxyImpl::ScheduledActionDrawForced() {}

void ProxyImpl::ScheduledActionUpdateDisplayTree() {}

void ProxyImpl::ScheduledActionCommit() {}

void ProxyImpl::ScheduledActionPostCommit() {}

void ProxyImpl::ScheduledActionActivateSyncTree() {}

void ProxyImpl::ScheduledActionBeginLayerTreeFrameSinkCreation() {}

void ProxyImpl::ScheduledActionPrepareTiles() {}

void ProxyImpl::ScheduledActionInvalidateLayerTreeFrameSink(bool needs_redraw) {}

void ProxyImpl::ScheduledActionPerformImplSideInvalidation() {}

void ProxyImpl::SendBeginMainFrameNotExpectedSoon() {}

void ProxyImpl::ScheduledActionBeginMainFrameNotExpectedUntil(
    base::TimeTicks time) {}

void ProxyImpl::OnBeginImplFrameDeadline() {}

DrawResult ProxyImpl::DrawInternal(bool forced_draw) {}

bool ProxyImpl::IsImplThread() const {}

bool ProxyImpl::IsMainThreadBlocked() const {}

base::SingleThreadTaskRunner* ProxyImpl::MainThreadTaskRunner() {}

void ProxyImpl::QueueImageDecodeOnImpl(int request_id,
                                       std::unique_ptr<PaintImage> image) {}

void ProxyImpl::SetSourceURL(ukm::SourceId source_id, const GURL& url) {}

void ProxyImpl::SetUkmSmoothnessDestination(
    base::WritableSharedMemoryMapping ukm_smoothness_data) {}

void ProxyImpl::ClearHistory() {}

size_t ProxyImpl::CommitDurationSampleCountForTesting() const {}

void ProxyImpl::SetRenderFrameObserver(
    std::unique_ptr<RenderFrameMetadataObserver> observer) {}

void ProxyImpl::DetachInputDelegateAndRenderFrameObserver(
    CompletionEvent* completion_event) {}

ProxyImpl::DataForCommit::DataForCommit(
    std::unique_ptr<ScopedCommitCompletionEvent> commit_completion_event,
    std::unique_ptr<CommitState> commit_state,
    const ThreadUnsafeCommitState* unsafe_state,
    CommitTimestamps* commit_timestamps)
    :{}

ProxyImpl::DataForCommit::~DataForCommit() = default;

bool ProxyImpl::DataForCommit::IsValid() const {}

}  // namespace cc