#include "components/viz/service/display/display_scheduler.h"
#include <algorithm>
#include <utility>
#include "base/auto_reset.h"
#include "base/memory/raw_ptr.h"
#include "base/metrics/histogram_macros.h"
#include "base/task/delay_policy.h"
#include "base/task/single_thread_task_runner.h"
#include "base/trace_event/trace_event.h"
#include "components/viz/common/features.h"
#include "components/viz/service/performance_hint/hint_session.h"
namespace viz {
namespace {
base::TimeDelta ComputeAdpfTarget(const BeginFrameArgs& args) { … }
bool DrawImmediatelyWhenInteractive() { … }
}
class DisplayScheduler::BeginFrameObserver : public BeginFrameObserverBase { … };
DisplayScheduler::DisplayScheduler(BeginFrameSource* begin_frame_source,
base::SingleThreadTaskRunner* task_runner,
PendingSwapParams pending_swap_params,
HintSessionFactory* hint_session_factory,
bool wait_for_all_surfaces_before_draw)
: … { … }
DisplayScheduler::~DisplayScheduler() { … }
void DisplayScheduler::SetDamageTracker(DisplayDamageTracker* damage_tracker) { … }
void DisplayScheduler::SetVisible(bool visible) { … }
void DisplayScheduler::OnRootFrameMissing(bool missing) { … }
void DisplayScheduler::OnDisplayDamaged(SurfaceId surface_id) { … }
void DisplayScheduler::OnPendingSurfacesChanged() { … }
base::TimeDelta DisplayScheduler::GetDeadlineOffset(
base::TimeDelta interval) const { … }
void DisplayScheduler::ForceImmediateSwapIfPossible() { … }
bool DisplayScheduler::UpdateHasPendingSurfaces() { … }
void DisplayScheduler::OutputSurfaceLost() { … }
void DisplayScheduler::MaybeCreateHintSession(
base::flat_set<base::PlatformThreadId> thread_ids) { … }
void DisplayScheduler::ReportFrameTime(
base::TimeDelta frame_time,
base::flat_set<base::PlatformThreadId> thread_ids,
base::TimeTicks draw_start,
HintSession::BoostType boost_type) { … }
bool DisplayScheduler::DrawAndSwap() { … }
bool DisplayScheduler::OnBeginFrame(const BeginFrameArgs& args) { … }
void DisplayScheduler::OnBeginFrameContinuation(const BeginFrameArgs& args) { … }
int DisplayScheduler::MaxPendingSwaps() const { … }
void DisplayScheduler::SetNeedsOneBeginFrame(bool needs_draw) { … }
void DisplayScheduler::MaybeStartObservingBeginFrames() { … }
void DisplayScheduler::StartObservingBeginFrames() { … }
void DisplayScheduler::StopObservingBeginFrames() { … }
bool DisplayScheduler::ShouldDraw() const { … }
base::TimeTicks DisplayScheduler::DesiredBeginFrameDeadlineTime(
BeginFrameDeadlineMode deadline_mode,
BeginFrameArgs begin_frame_args) { … }
DisplayScheduler::BeginFrameDeadlineMode
DisplayScheduler::AdjustedBeginFrameDeadlineMode() const { … }
DisplayScheduler::BeginFrameDeadlineMode
DisplayScheduler::DesiredBeginFrameDeadlineMode() const { … }
void DisplayScheduler::ScheduleBeginFrameDeadline() { … }
bool DisplayScheduler::AttemptDrawAndSwap() { … }
void DisplayScheduler::OnBeginFrameDeadline() { … }
void DisplayScheduler::DidFinishFrame(bool did_draw) { … }
void DisplayScheduler::DidSwapBuffers() { … }
void DisplayScheduler::DidReceiveSwapBuffersAck() { … }
}