#import <FlutterVSyncWaiter.h>
Definition at line 8 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 42 of file FlutterVSyncWaiter.mm.
46 block:(
void (^)(CFTimeInterval timestamp,
47 CFTimeInterval targetTimestamp,
48 uintptr_t baton))block {
49 FML_DCHECK([NSThread isMainThread]);
50 if (
self = [super init]) {
FlutterDisplayLink * _displayLink
void(^ _block)(CFTimeInterval, CFTimeInterval, uintptr_t)
BOOL paused
Pauses and resumes the display link.
id< FlutterDisplayLinkDelegate > delegate
◆ 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 42 of file FlutterVSyncWaiter.mm.
97 FML_DCHECK([NSThread isMainThread]);
103 CFTimeInterval now = CACurrentMediaTime();
108 if (_pendingBaton.has_value()) {
109 FML_LOG(WARNING) <<
"Engine requested vsync while another was pending";
110 _block(0, 0, *_pendingBaton);
111 _pendingBaton = std::nullopt;
114 TRACE_VSYNC(
"VSyncRequest", _pendingBaton.value_or(0));
126 CFTimeInterval start = CACurrentMediaTime();
129 CFTimeInterval delay = 0;
133 CFTimeInterval now = start;
134 start = now - (fmod(now, tick_interval)) + phase;
136 start += tick_interval;
143 CFTimeInterval targetTimestamp = start + tick_interval;
144 TRACE_VSYNC("SynthesizedInitialVSync", baton);
145 _block(start, targetTimestamp, baton);
150 _pendingBaton = baton;
static const CFTimeInterval kTimerLatencyCompensation
#define TRACE_VSYNC(event_type, baton)
CFTimeInterval _lastTargetTimestamp
CFTimeInterval nominalOutputRefreshPeriod
void performBlock:afterDelay:(void(^ block)(void),[afterDelay] NSTimeInterval delay)
Referenced by TEST_F().
The documentation for this class was generated from the following files: