#ifdef UNSAFE_BUFFERS_BUILD
#pragma allow_unsafe_buffers
#endif
#include "cc/metrics/compositor_frame_reporting_controller.h"
#include <utility>
#include "base/debug/dump_without_crashing.h"
#include "base/metrics/histogram_macros.h"
#include "cc/metrics/compositor_frame_reporter.h"
#include "cc/metrics/dropped_frame_counter.h"
#include "cc/metrics/event_latency_tracing_recorder.h"
#include "cc/metrics/frame_sequence_tracker_collection.h"
#include "cc/metrics/latency_ukm_reporter.h"
#include "cc/metrics/scroll_jank_dropped_frame_tracker.h"
#include "components/viz/common/frame_timing_details.h"
#include "components/viz/common/quads/compositor_frame_metadata.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "services/tracing/public/cpp/perfetto/macros.h"
namespace cc {
namespace {
SmoothThread;
StageType;
FrameTerminationStatus;
constexpr int kNumOfCompositorStages = …;
constexpr int kNumDispatchStages = …;
constexpr base::TimeDelta kDefaultLatencyPredictionDeviationThreshold = …;
}
CompositorFrameReportingController::CompositorFrameReportingController(
bool should_report_histograms,
bool should_report_ukm,
int layer_tree_host_id)
: … { … }
CompositorFrameReportingController::~CompositorFrameReportingController() { … }
void CompositorFrameReportingController::SetVisible(bool visible) { … }
CompositorFrameReportingController::SubmittedCompositorFrame::
SubmittedCompositorFrame() = default;
CompositorFrameReportingController::SubmittedCompositorFrame::
SubmittedCompositorFrame(uint32_t frame_token,
std::unique_ptr<CompositorFrameReporter> reporter)
: … { … }
CompositorFrameReportingController::SubmittedCompositorFrame::
~SubmittedCompositorFrame() = default;
CompositorFrameReportingController::SubmittedCompositorFrame::
SubmittedCompositorFrame(SubmittedCompositorFrame&& other) = default;
base::TimeTicks CompositorFrameReportingController::Now() const { … }
bool CompositorFrameReportingController::HasReporterAt(
PipelineStage stage) const { … }
void CompositorFrameReportingController::ProcessSkippedFramesIfNecessary(
const viz::BeginFrameArgs& args) { … }
void CompositorFrameReportingController::WillBeginImplFrame(
const viz::BeginFrameArgs& args) { … }
void CompositorFrameReportingController::WillBeginMainFrame(
const viz::BeginFrameArgs& args) { … }
void CompositorFrameReportingController::BeginMainFrameAborted(
const viz::BeginFrameId& id,
CommitEarlyOutReason reason) { … }
void CompositorFrameReportingController::WillCommit() { … }
void CompositorFrameReportingController::DidCommit() { … }
void CompositorFrameReportingController::WillInvalidateOnImplSide() { … }
void CompositorFrameReportingController::WillActivate() { … }
void CompositorFrameReportingController::DidActivate() { … }
void CompositorFrameReportingController::DidSubmitCompositorFrame(
SubmitInfo& submit_info,
const viz::BeginFrameId& current_frame_id,
const viz::BeginFrameId& last_activated_frame_id) { … }
void CompositorFrameReportingController::DidNotProduceFrame(
const viz::BeginFrameId& id,
FrameSkippedReason skip_reason) { … }
void CompositorFrameReportingController::
SetPartialUpdateDeciderWhenWaitingOnMain(
std::unique_ptr<CompositorFrameReporter>& stage_reporter) { … }
void CompositorFrameReportingController::OnFinishImplFrame(
const viz::BeginFrameId& id) { … }
void CompositorFrameReportingController::MaybePassEventMetricsFromDroppedFrames(
CompositorFrameReporter& reporter,
uint32_t frame_token,
bool next_reporter_from_same_frame) { … }
void CompositorFrameReportingController::StoreEventMetricsFromDroppedFrames(
CompositorFrameReporter& reporter,
uint32_t frame_token) { … }
void CompositorFrameReportingController::DidPresentCompositorFrame(
uint32_t frame_token,
const viz::FrameTimingDetails& details) { … }
void CompositorFrameReportingController::OnStoppedRequestingBeginFrames() { … }
void CompositorFrameReportingController::NotifyReadyToCommit(
std::unique_ptr<BeginMainFrameMetrics> details) { … }
void CompositorFrameReportingController::AddActiveTracker(
FrameSequenceTrackerType type) { … }
void CompositorFrameReportingController::RemoveActiveTracker(
FrameSequenceTrackerType type) { … }
void CompositorFrameReportingController::SetScrollingThread(
FrameInfo::SmoothEffectDrivingThread thread) { … }
void CompositorFrameReportingController::SetThreadAffectsSmoothness(
FrameInfo::SmoothEffectDrivingThread thread_type,
bool affects_smoothness) { … }
void CompositorFrameReportingController::AdvanceReporterStage(
PipelineStage start,
PipelineStage target) { … }
bool CompositorFrameReportingController::CanSubmitImplFrame(
const viz::BeginFrameId& id) const { … }
bool CompositorFrameReportingController::CanSubmitMainFrame(
const viz::BeginFrameId& id) const { … }
std::unique_ptr<CompositorFrameReporter>
CompositorFrameReportingController::RestoreReporterAtBeginImpl(
const viz::BeginFrameId& id) { … }
void CompositorFrameReportingController::InitializeUkmManager(
std::unique_ptr<ukm::UkmRecorder> recorder) { … }
void CompositorFrameReportingController::SetSourceId(ukm::SourceId source_id) { … }
CompositorFrameReporter::SmoothThread
CompositorFrameReportingController::GetSmoothThread() const { … }
CompositorFrameReporter::SmoothThread
CompositorFrameReportingController::GetSmoothThreadAtTime(
base::TimeTicks timestamp) const { … }
CompositorFrameReporter*
CompositorFrameReportingController::GetOutstandingUpdatesFromMain(
const viz::BeginFrameId& id) const { … }
void CompositorFrameReportingController::CreateReportersForDroppedFrames(
const viz::BeginFrameArgs& old_args,
const viz::BeginFrameArgs& new_args) const { … }
void CompositorFrameReportingController::AddSortedFrame(
const viz::BeginFrameArgs& args,
const FrameInfo& frame_info) { … }
void CompositorFrameReportingController::SetDroppedFrameCounter(
DroppedFrameCounter* counter) { … }
}