| Flutter iOS Embedder |

Instance Methods | Properties | List of all members
VSyncClient Class Reference

`#import <vsync_waiter_ios.h>`

Inheritance diagram for VSyncClient:

## Instance Methods
(instancetype) | - initWithTaskRunner:callback:
(void) | - await
(void) | - pause
(void) | - invalidate
| Call invalidate before releasing this object to remove from runloops. More...
(void) | - setMaxRefreshRate:

## Properties
BOOL | allowPauseAfterVsync
| Default value is YES. Vsync client will pause vsync callback after receiving a vsync signal. Setting this property to NO can avoid this and vsync client will trigger vsync callback continuously. More...

## Detailed Description

Definition at line 47 of file vsync_waiter_ios.h.

## Method Documentation

## ◆ await

- (void) await |  |  |

Definition at line 68 of file vsync_waiter_ios.mm.

108 {
109 _displayLink.paused = NO;
110 }
_displayLink
CADisplayLink * _displayLink
Definition: vsync_waiter_ios.mm:66

Referenced by flutter::VsyncWaiterIOS::AwaitVSync.

## ◆ initWithTaskRunner:callback:

- (instancetype) initWithTaskRunner: |  | (fml::RefPtr<fml::TaskRunner>) | task_runner
callback: |  | (flutter::VsyncWaiter::Callback) | callback

Definition at line 68 of file vsync_waiter_ios.mm.

71 :(fml::RefPtr<fml::TaskRunner>)task_runner
72 callback:(flutter::VsyncWaiter::Callback)callback {
73 FML_DCHECK(task_runner);
74
75 if (self = [super init]) {
76 _refreshRate = DisplayLinkManager.displayRefreshRate;
77 _allowPauseAfterVsync = YES;
78 _callback = std::move(callback);
79 _displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(onDisplayLink:)];
80 _displayLink.paused = YES;
81
82 [self setMaxRefreshRate:DisplayLinkManager.displayRefreshRate];
83
84 // Strongly retain the the captured link until it is added to the runloop.
85 CADisplayLink* localDisplayLink = _displayLink;
86 task_runner->PostTask([localDisplayLink]() {
87 [localDisplayLink addToRunLoop:NSRunLoop.currentRunLoop forMode:NSRunLoopCommonModes];
88 });
89 }
90
91 return self;
92 }
DisplayLinkManager
Definition: FlutterMetalLayer.mm:18
DisplayLinkManager::displayRefreshRate
double displayRefreshRate
The display refresh rate used for reporting purposes. The engine does not care about this for frame s...
Definition: vsync_waiter_ios.h:43

## ◆ invalidate

- (void) invalidate |  |  |

Call invalidate before releasing this object to remove from runloops.

Definition at line 68 of file vsync_waiter_ios.mm.

139 {
140 [_displayLink invalidate];
141 _displayLink = nil; // Break retain cycle.
142 }

Referenced by flutter::VsyncWaiterIOS::~VsyncWaiterIOS.

## ◆ pause

- (void) pause |  |  |

Definition at line 68 of file vsync_waiter_ios.mm.

112 {
113 _displayLink.paused = YES;
114 }

## ◆ setMaxRefreshRate:

- (void) setMaxRefreshRate: |  | (double) | refreshRate |

Definition at line 68 of file vsync_waiter_ios.mm.

94 :(double)refreshRate {
95 if (!DisplayLinkManager.maxRefreshRateEnabledOnIPhone) {
96 return;
97 }
98 double maxFrameRate = fmax(refreshRate, 60);
99 double minFrameRate = fmax(maxFrameRate / 2, 60);
100 if (@available(iOS 15.0, *)) {
101 _displayLink.preferredFrameRateRange =
102 CAFrameRateRangeMake(minFrameRate, maxFrameRate, maxFrameRate);
103 } else {
104 _displayLink.preferredFramesPerSecond = maxFrameRate;
105 }
106 }
DisplayLinkManager::maxRefreshRateEnabledOnIPhone
BOOL maxRefreshRateEnabledOnIPhone
Whether the max refresh rate on iPhone ProMotion devices are enabled. This reflects the value of CADi...
Definition: FlutterMetalLayer.mm:18

Referenced by flutter::VsyncWaiterIOS::AwaitVSync.

## Property Documentation

## ◆ allowPauseAfterVsync

- (BOOL) allowPauseAfterVsync
| read write nonatomic assign

Default value is YES. Vsync client will pause vsync callback after receiving a vsync signal. Setting this property to NO can avoid this and vsync client will trigger vsync callback continuously.

Parameters

  allowPauseAfterVsync | Allow vsync client to pause after receiving a vsync signal.

Definition at line 57 of file vsync_waiter_ios.h.

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

- shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.h
- shell/platform/darwin/ios/framework/Source/vsync_waiter_ios.mm