#include "cc/trees/single_thread_proxy.h"
#include <memory>
#include <utility>
#include <vector>
#include "base/auto_reset.h"
#include "base/functional/bind.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
#include "base/notreached.h"
#include "base/synchronization/waitable_event.h"
#include "base/trace_event/trace_event.h"
#include "base/types/optional_ref.h"
#include "build/chromeos_buildflags.h"
#include "cc/base/completion_event.h"
#include "cc/base/devtools_instrumentation.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/resources/ui_resource_manager.h"
#include "cc/scheduler/commit_earlyout_reason.h"
#include "cc/scheduler/scheduler.h"
#include "cc/trees/compositor_commit_data.h"
#include "cc/trees/latency_info_swap_promise.h"
#include "cc/trees/layer_tree_frame_sink.h"
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/layer_tree_host_single_thread_client.h"
#include "cc/trees/layer_tree_impl.h"
#include "cc/trees/mutator_host.h"
#include "cc/trees/paint_holding_reason.h"
#include "cc/trees/render_frame_metadata_observer.h"
#include "cc/trees/scoped_abort_remaining_swap_promises.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"
namespace cc {
std::unique_ptr<Proxy> SingleThreadProxy::Create(
LayerTreeHost* layer_tree_host,
LayerTreeHostSingleThreadClient* client,
TaskRunnerProvider* task_runner_provider) { … }
SingleThreadProxy::SingleThreadProxy(LayerTreeHost* layer_tree_host,
LayerTreeHostSingleThreadClient* client,
TaskRunnerProvider* task_runner_provider)
: … { … }
void SingleThreadProxy::Start() { … }
SingleThreadProxy::~SingleThreadProxy() { … }
bool SingleThreadProxy::IsStarted() const { … }
void SingleThreadProxy::SetVisible(bool visible) { … }
void SingleThreadProxy::SetShouldWarmUp() { … }
void SingleThreadProxy::RequestNewLayerTreeFrameSink() { … }
void SingleThreadProxy::DidObserveFirstScrollDelay(
int source_frame_number,
base::TimeDelta first_scroll_delay,
base::TimeTicks first_scroll_timestamp) { … }
void SingleThreadProxy::ReleaseLayerTreeFrameSink() { … }
void SingleThreadProxy::SetLayerTreeFrameSink(
LayerTreeFrameSink* layer_tree_frame_sink) { … }
void SingleThreadProxy::SetNeedsAnimate() { … }
void SingleThreadProxy::SetNeedsUpdateLayers() { … }
void SingleThreadProxy::DoCommit(const viz::BeginFrameArgs& commit_args) { … }
void SingleThreadProxy::DoPostCommit() { … }
void SingleThreadProxy::IssueImageDecodeFinishedCallbacks() { … }
void SingleThreadProxy::CommitComplete() { … }
void SingleThreadProxy::SetNeedsCommit() { … }
void SingleThreadProxy::SetNeedsRedraw(const gfx::Rect& damage_rect) { … }
void SingleThreadProxy::SetTargetLocalSurfaceId(
const viz::LocalSurfaceId& target_local_surface_id) { … }
void SingleThreadProxy::DetachInputDelegateAndRenderFrameObserver() { … }
bool SingleThreadProxy::RequestedAnimatePending() { … }
void SingleThreadProxy::SetDeferMainFrameUpdate(bool defer_main_frame_update) { … }
void SingleThreadProxy::SetPauseRendering(bool pause_rendering) { … }
void SingleThreadProxy::SetInputResponsePending() { … }
bool SingleThreadProxy::StartDeferringCommits(base::TimeDelta timeout,
PaintHoldingReason reason) { … }
void SingleThreadProxy::StopDeferringCommits(
PaintHoldingCommitTrigger trigger) { … }
bool SingleThreadProxy::IsDeferringCommits() const { … }
bool SingleThreadProxy::CommitRequested() const { … }
void SingleThreadProxy::Stop() { … }
void SingleThreadProxy::QueueImageDecode(int request_id,
const PaintImage& image) { … }
void SingleThreadProxy::SetMutator(std::unique_ptr<LayerTreeMutator> mutator) { … }
void SingleThreadProxy::SetPaintWorkletLayerPainter(
std::unique_ptr<PaintWorkletLayerPainter> painter) { … }
void SingleThreadProxy::OnCanDrawStateChanged(bool can_draw) { … }
void SingleThreadProxy::NotifyReadyToActivate() { … }
bool SingleThreadProxy::IsReadyToActivate() { … }
void SingleThreadProxy::NotifyReadyToDraw() { … }
void SingleThreadProxy::SetNeedsRedrawOnImplThread() { … }
void SingleThreadProxy::SetNeedsOneBeginImplFrameOnImplThread() { … }
void SingleThreadProxy::SetNeedsPrepareTilesOnImplThread() { … }
void SingleThreadProxy::SetNeedsCommitOnImplThread() { … }
void SingleThreadProxy::SetVideoNeedsBeginFrames(bool needs_begin_frames) { … }
bool SingleThreadProxy::IsInsideDraw() { … }
void SingleThreadProxy::RenewTreePriority() { … }
void SingleThreadProxy::PostDelayedAnimationTaskOnImplThread(
base::OnceClosure task,
base::TimeDelta delay) { … }
void SingleThreadProxy::DidActivateSyncTree() { … }
void SingleThreadProxy::DidPrepareTiles() { … }
void SingleThreadProxy::DidCompletePageScaleAnimationOnImplThread() { … }
void SingleThreadProxy::DidLoseLayerTreeFrameSinkOnImplThread() { … }
void SingleThreadProxy::SetBeginFrameSource(viz::BeginFrameSource* source) { … }
void SingleThreadProxy::DidReceiveCompositorFrameAckOnImplThread() { … }
void SingleThreadProxy::OnDrawForLayerTreeFrameSink(
bool resourceless_software_draw,
bool skip_draw) { … }
void SingleThreadProxy::SetNeedsImplSideInvalidation(
bool needs_first_draw_on_activation) { … }
void SingleThreadProxy::NotifyImageDecodeRequestFinished(
int request_id,
bool decode_succeeded) { … }
void SingleThreadProxy::NotifyTransitionRequestFinished(uint32_t sequence_id) { … }
void SingleThreadProxy::DidPresentCompositorFrameOnImplThread(
uint32_t frame_token,
PresentationTimeCallbackBuffer::PendingCallbacks callbacks,
const viz::FrameTimingDetails& details) { … }
void SingleThreadProxy::NotifyAnimationWorkletStateChange(
AnimationWorkletMutationState state,
ElementListType element_list_type) { … }
void SingleThreadProxy::NotifyPaintWorkletStateChange(
Scheduler::PaintWorkletState state) { … }
void SingleThreadProxy::NotifyThroughputTrackerResults(
CustomTrackerResults results) { … }
bool SingleThreadProxy::IsInSynchronousComposite() const { … }
void SingleThreadProxy::FrameSinksToThrottleUpdated(
const base::flat_set<viz::FrameSinkId>& ids) { … }
void SingleThreadProxy::RequestBeginMainFrameNotExpected(bool new_state) { … }
viz::BeginFrameArgs SingleThreadProxy::BeginImplFrameForTest(
base::TimeTicks frame_begin_time) { … }
void SingleThreadProxy::CompositeImmediatelyForTest(
base::TimeTicks frame_begin_time,
bool raster,
base::OnceClosure callback) { … }
bool SingleThreadProxy::ShouldComposite() const { … }
void SingleThreadProxy::ScheduleRequestNewLayerTreeFrameSink() { … }
DrawResult SingleThreadProxy::DoComposite(LayerTreeHostImpl::FrameData* frame) { … }
void SingleThreadProxy::DidCommitAndDrawFrame(int source_frame_number) { … }
bool SingleThreadProxy::MainFrameWillHappenForTesting() { … }
void SingleThreadProxy::SetSourceURL(ukm::SourceId source_id, const GURL& url) { … }
void SingleThreadProxy::SetUkmSmoothnessDestination(
base::WritableSharedMemoryMapping ukm_smoothness_data) { … }
void SingleThreadProxy::ClearHistory() { … }
void SingleThreadProxy::SetHasActiveThreadedScroll(bool is_scrolling) { … }
void SingleThreadProxy::SetWaitingForScrollEvent(
bool waiting_for_scroll_event) { … }
size_t SingleThreadProxy::CommitDurationSampleCountForTesting() const { … }
void SingleThreadProxy::SetRenderFrameObserver(
std::unique_ptr<RenderFrameMetadataObserver> observer) { … }
double SingleThreadProxy::GetPercentDroppedFrames() const { … }
void SingleThreadProxy::UpdateBrowserControlsState(
BrowserControlsState constraints,
BrowserControlsState current,
bool animate,
base::optional_ref<const BrowserControlsOffsetTagsInfo> offset_tags_info) { … }
bool SingleThreadProxy::WillBeginImplFrame(const viz::BeginFrameArgs& args) { … }
void SingleThreadProxy::ScheduledActionSendBeginMainFrame(
const viz::BeginFrameArgs& begin_frame_args) { … }
void SingleThreadProxy::FrameIntervalUpdated(base::TimeDelta interval) { … }
void SingleThreadProxy::OnBeginImplFrameDeadline() { … }
void SingleThreadProxy::SendBeginMainFrameNotExpectedSoon() { … }
void SingleThreadProxy::ScheduledActionBeginMainFrameNotExpectedUntil(
base::TimeTicks time) { … }
void SingleThreadProxy::BeginMainFrame(
const viz::BeginFrameArgs& begin_frame_args) { … }
void SingleThreadProxy::DoBeginMainFrame(
const viz::BeginFrameArgs& begin_frame_args) { … }
void SingleThreadProxy::DoPainting(const viz::BeginFrameArgs& commit_args) { … }
void SingleThreadProxy::BeginMainFrameAbortedOnImplThread(
CommitEarlyOutReason reason) { … }
DrawResult SingleThreadProxy::ScheduledActionDrawIfPossible() { … }
DrawResult SingleThreadProxy::ScheduledActionDrawForced() { … }
void SingleThreadProxy::ScheduledActionUpdateDisplayTree() { … }
void SingleThreadProxy::ScheduledActionCommit() { … }
void SingleThreadProxy::ScheduledActionPostCommit() { … }
void SingleThreadProxy::ScheduledActionActivateSyncTree() { … }
void SingleThreadProxy::ScheduledActionBeginLayerTreeFrameSinkCreation() { … }
void SingleThreadProxy::ScheduledActionPrepareTiles() { … }
void SingleThreadProxy::ScheduledActionInvalidateLayerTreeFrameSink(
bool needs_redraw) { … }
void SingleThreadProxy::ScheduledActionPerformImplSideInvalidation() { … }
void SingleThreadProxy::DidFinishImplFrame(
const viz::BeginFrameArgs& last_activated_args) { … }
void SingleThreadProxy::DidNotProduceFrame(const viz::BeginFrameAck& ack,
FrameSkippedReason reason) { … }
void SingleThreadProxy::WillNotReceiveBeginFrame() { … }
void SingleThreadProxy::DidReceiveCompositorFrameAck() { … }
}