Flutter Engine
flutter_runner::VsyncRecorder Class Reference

#include <vsync_recorder.h>

Public Member Functions

VsyncInfo GetCurrentVsyncInfo () const
 
void UpdateNextPresentationInfo (fuchsia::scenic::scheduling::FuturePresentationTimes info)
 
void UpdateFramePresentedInfo (zx::time presentation_time)
 
fml::TimePoint GetLastPresentationTime () const
 

Static Public Member Functions

static VsyncRecorderGetInstance ()
 

Detailed Description

Definition at line 21 of file vsync_recorder.h.

Member Function Documentation

◆ GetCurrentVsyncInfo()

VsyncInfo flutter_runner::VsyncRecorder::GetCurrentVsyncInfo ( ) const

Definition at line 27 of file vsync_recorder.cc.

References fml::TimePoint::FromEpochDelta(), and fml::TimeDelta::FromNanoseconds().

Referenced by flutter_runner::SessionConnection::CalculateNextLatchPoint(), flutter_runner::VsyncWaiter::SnapToNextPhase(), and flutter_runner_test::TEST().

27  {
28  {
29  std::unique_lock<std::mutex> lock(g_mutex);
31  next_presentation_info_.presentation_time())),
32  kDefaultPresentationInterval};
33  }
34 }
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
Definition: time_delta.h:40
static constexpr TimePoint FromEpochDelta(TimeDelta ticks)
Definition: time_point.h:36

◆ GetInstance()

VsyncRecorder & flutter_runner::VsyncRecorder::GetInstance ( )
static

Definition at line 22 of file vsync_recorder.cc.

Referenced by flutter_runner::SessionConnection::CalculateNextLatchPoint(), flutter_runner::SessionConnection::SessionConnection(), flutter_runner::VsyncWaiter::SnapToNextPhase(), and flutter_runner_test::TEST().

22  {
23  static VsyncRecorder vsync_recorder;
24  return vsync_recorder;
25 }

◆ GetLastPresentationTime()

fml::TimePoint flutter_runner::VsyncRecorder::GetLastPresentationTime ( ) const

Definition at line 57 of file vsync_recorder.cc.

Referenced by flutter_runner::VsyncWaiter::SnapToNextPhase(), and flutter_runner_test::TEST().

57  {
58  return last_presentation_time_;
59 }

◆ UpdateFramePresentedInfo()

void flutter_runner::VsyncRecorder::UpdateFramePresentedInfo ( zx::time  presentation_time)

Definition at line 52 of file vsync_recorder.cc.

References fml::TimePoint::FromEpochDelta(), and fml::TimeDelta::FromNanoseconds().

Referenced by flutter_runner::SessionConnection::SessionConnection(), and flutter_runner_test::TEST().

52  {
53  last_presentation_time_ = fml::TimePoint::FromEpochDelta(
54  fml::TimeDelta::FromNanoseconds(presentation_time.get()));
55 }
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
Definition: time_delta.h:40
static constexpr TimePoint FromEpochDelta(TimeDelta ticks)
Definition: time_point.h:36

◆ UpdateNextPresentationInfo()

void flutter_runner::VsyncRecorder::UpdateNextPresentationInfo ( fuchsia::scenic::scheduling::FuturePresentationTimes  info)

Definition at line 36 of file vsync_recorder.cc.

Referenced by flutter_runner::SessionConnection::CalculateNextLatchPoint(), flutter_runner::SessionConnection::SessionConnection(), and flutter_runner_test::TEST().

37  {
38  std::unique_lock<std::mutex> lock(g_mutex);
39 
40  auto next_time = next_presentation_info_.presentation_time();
41  // Get the earliest vsync time that is after our recorded |presentation_time|.
42  for (auto& presentation_info : info.future_presentations) {
43  auto current_time = presentation_info.presentation_time();
44 
45  if (current_time > next_time) {
46  next_presentation_info_.set_presentation_time(current_time);
47  return;
48  }
49  }
50 }

The documentation for this class was generated from the following files: