Flutter Engine
 
Loading...
Searching...
No Matches
flutter::VsyncWaiterIOS Class Referencefinal

#include <vsync_waiter_ios.h>

Inheritance diagram for flutter::VsyncWaiterIOS:
flutter::VsyncWaiter flutter::VariableRefreshRateReporter

Instance Methods

() - VsyncWaiterIOS
 
() - ~VsyncWaiterIOS
 
(double) - GetRefreshRate
 
(void) - AwaitVSync
 
- Instance Methods inherited from flutter::VsyncWaiter
virtual ~VsyncWaiter ()
 
void AsyncWaitForVsync (const Callback &callback)
 
void ScheduleSecondaryCallback (uintptr_t id, const fml::closure &callback)
 
- Instance Methods inherited from flutter::VariableRefreshRateReporter
 VariableRefreshRateReporter ()=default
 
 FML_DISALLOW_COPY_AND_ASSIGN (VariableRefreshRateReporter)
 

Additional Inherited Members

- Public Types inherited from flutter::VsyncWaiter
using Callback = std::function< void(std::unique_ptr< FrameTimingsRecorder >)>
 
- Protected Member Functions inherited from flutter::VsyncWaiter
 VsyncWaiter (const TaskRunners &task_runners)
 
virtual void AwaitVSyncForSecondaryCallback ()
 
void FireCallback (fml::TimePoint frame_start_time, fml::TimePoint frame_target_time, bool pause_secondary_tasks=true)
 
- Protected Attributes inherited from flutter::VsyncWaiter
const TaskRunners task_runners_
 

Detailed Description

Definition at line 77 of file vsync_waiter_ios.h.

Constructor & Destructor Documentation

◆ VsyncWaiterIOS

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

Definition at line 32 of file vsync_waiter_ios.mm.

33 : VsyncWaiter(task_runners) {
34 auto callback = [this](std::unique_ptr<flutter::FrameTimingsRecorder> recorder) {
35 const fml::TimePoint start_time = recorder->GetVsyncStartTime();
36 const fml::TimePoint target_time = recorder->GetVsyncTargetTime();
37 FireCallback(start_time, target_time, true);
38 };
39 client_ = [[VSyncClient alloc] initWithTaskRunner:task_runners_.GetUITaskRunner()
40 callback:callback];
41 max_refresh_rate_ = DisplayLinkManager.displayRefreshRate;
42}
VsyncWaiter(const TaskRunners &task_runners)
void FireCallback(fml::TimePoint frame_start_time, fml::TimePoint frame_target_time, bool pause_secondary_tasks=true)
FlutterDesktopBinaryReply callback

References callback, and flutter::VsyncWaiter::FireCallback().

◆ ~VsyncWaiterIOS

- VsyncWaiterIOS:

Definition at line 44 of file vsync_waiter_ios.mm.

44 {
45 // This way, we will get no more callbacks from the display link that holds a weak (non-nilling)
46 // reference to this C++ object.
47 [client_ invalidate];
48}

References VSyncClient::invalidate.

Method Documentation

◆ AwaitVSync

- (void) VsyncWaiterIOS:

Implements flutter::VsyncWaiter.

Definition at line 50 of file vsync_waiter_ios.mm.

50 {
51 double new_max_refresh_rate = DisplayLinkManager.displayRefreshRate;
52 if (fabs(new_max_refresh_rate - max_refresh_rate_) > kRefreshRateDiffToIgnore) {
53 max_refresh_rate_ = new_max_refresh_rate;
54 [client_ setMaxRefreshRate:max_refresh_rate_];
55 }
56 [client_ await];
57}
static const double kRefreshRateDiffToIgnore

References VSyncClient::await, kRefreshRateDiffToIgnore, and VSyncClient::setMaxRefreshRate:.

◆ GetRefreshRate

- (double) VsyncWaiterIOS: const

Implements flutter::VariableRefreshRateReporter.

Definition at line 60 of file vsync_waiter_ios.mm.

60 {
61 return client_.refreshRate;
62}

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