Flutter iOS Embedder
flutter::VsyncWaiterIOS Class Referencefinal

#import <vsync_waiter_ios.h>

Inheritance diagram for flutter::VsyncWaiterIOS:

Instance Methods

() - VsyncWaiterIOS
 
() - ~VsyncWaiterIOS
 
(double) - GetRefreshRate
 
(fml::scoped_nsobject< VSyncClient >) - GetVsyncClient
 
(void) - AwaitVSync
 

Detailed Description

Definition at line 67 of file vsync_waiter_ios.h.

Constructor & Destructor Documentation

◆ VsyncWaiterIOS

- VsyncWaiterIOS: (const flutter::TaskRunners &)  task_runners

Definition at line 23 of file vsync_waiter_ios.mm.

24  : VsyncWaiter(task_runners) {
25  auto callback = [this](std::unique_ptr<flutter::FrameTimingsRecorder> recorder) {
26  const fml::TimePoint start_time = recorder->GetVsyncStartTime();
27  const fml::TimePoint target_time = recorder->GetVsyncTargetTime();
28  FireCallback(start_time, target_time, true);
29  };
30  client_ =
31  fml::scoped_nsobject{[[VSyncClient alloc] initWithTaskRunner:task_runners_.GetUITaskRunner()
32  callback:callback]};
33  max_refresh_rate_ = [DisplayLinkManager displayRefreshRate];
34 }

◆ ~VsyncWaiterIOS

- VsyncWaiterIOS:

Definition at line 36 of file vsync_waiter_ios.mm.

36  {
37  // This way, we will get no more callbacks from the display link that holds a weak (non-nilling)
38  // reference to this C++ object.
39  [client_.get() invalidate];
40 }

Method Documentation

◆ AwaitVSync

- (void) VsyncWaiterIOS:

Definition at line 42 of file vsync_waiter_ios.mm.

42  {
43  double new_max_refresh_rate = [DisplayLinkManager displayRefreshRate];
44  if (fabs(new_max_refresh_rate - max_refresh_rate_) > kRefreshRateDiffToIgnore) {
45  max_refresh_rate_ = new_max_refresh_rate;
46  [client_.get() setMaxRefreshRate:max_refresh_rate_];
47  }
48  [client_.get() await];
49 }

References kRefreshRateDiffToIgnore.

◆ GetRefreshRate

- (double) VsyncWaiterIOS: const

Definition at line 52 of file vsync_waiter_ios.mm.

52  {
53  return [client_.get() getRefreshRate];
54 }

◆ GetVsyncClient

- (scoped_nsobject< VSyncClient >) flutter: const

Definition at line 56 of file vsync_waiter_ios.mm.

56  {
57  return client_;
58 }

The documentation for this class was generated from the following files:
kRefreshRateDiffToIgnore
const static double kRefreshRateDiffToIgnore
Definition: vsync_waiter_ios.mm:19
VSyncClient
Definition: vsync_waiter_ios.h:38