#import <FlutterVSyncWaiter.h>
Definition at line 12 of file FlutterVSyncWaiter.h.
◆ initWithDisplayLink:block:
- (instancetype) initWithDisplayLink: |
|
(FlutterDisplayLink*) |
displayLink |
block: |
|
(void(^)(CFTimeInterval timestamp,
CFTimeInterval targetTimestamp,
uintptr_t baton)) |
block |
|
|
| |
Creates new waiter instance tied to provided NSView. This function must be called on the main thread.
Provided |block| will be invoked on main thread.
Definition at line 46 of file FlutterVSyncWaiter.mm.
50 block:(
void (^)(CFTimeInterval timestamp,
51 CFTimeInterval targetTimestamp,
52 uintptr_t baton))block {
53 FML_DCHECK([NSThread isMainThread]);
54 if (
self = [super init]) {
FlutterDisplayLink * _displayLink
void(^ _block)(CFTimeInterval, CFTimeInterval, uintptr_t)
BOOL paused
Pauses and resumes the display link.
id< FlutterDisplayLinkDelegate > delegate
◆ invalidate
Invalidates the waiter. This must be called on the main thread before the instance is deallocated.
Definition at line 46 of file FlutterVSyncWaiter.mm.
161 if (_pendingBaton.has_value()) {
162 CFTimeInterval now = CACurrentMediaTime();
163 _block(now, now, _pendingBaton.value());
164 _pendingBaton = std::nullopt;
167 [_displayLink invalidate];
Referenced by TEST_F().
◆ waitForVSync:
- (void) waitForVSync: |
|
(uintptr_t) |
baton |
|
Schedules |baton| to be signaled on next display refresh. This function must be called on the main thread.
Definition at line 46 of file FlutterVSyncWaiter.mm.
101 FML_DCHECK([NSThread isMainThread]);
107 CFTimeInterval now = CACurrentMediaTime();
112 if (_pendingBaton.has_value()) {
113 [FlutterLogger logWarning:@"Engine requested vsync while another was pending"];
114 _block(0, 0, *_pendingBaton);
115 _pendingBaton = std::nullopt;
118 TRACE_VSYNC(
"VSyncRequest", _pendingBaton.value_or(0));
130 CFTimeInterval start = CACurrentMediaTime();
133 CFTimeInterval delay = 0;
137 CFTimeInterval now = start;
138 start = now - (fmod(now, tick_interval)) + phase;
140 start += tick_interval;
145 [FlutterRunLoop.mainRunLoop performAfterDelay:delay
147 CFTimeInterval targetTime = start + tick_interval;
148 TRACE_VSYNC("SynthesizedInitialVSync", baton);
149 _block(start, targetTime, baton);
153 _pendingBaton = baton;
static const CFTimeInterval kTimerLatencyCompensation
#define TRACE_VSYNC(event_type, baton)
CFTimeInterval _lastTargetTimestamp
CFTimeInterval nominalOutputRefreshPeriod
Referenced by TEST_F().
The documentation for this class was generated from the following files: