Flutter Engine
 
Loading...
Searching...
No Matches
FlutterVSyncWaiter.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVSYNCWAITER_H_
6#define FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVSYNCWAITER_H_
7
8#import <AppKit/AppKit.h>
9
11
12@interface FlutterVSyncWaiter : NSObject
13
14/// Creates new waiter instance tied to provided NSView.
15/// This function must be called on the main thread.
16///
17/// Provided |block| will be invoked on main thread.
18- (instancetype)initWithDisplayLink:(FlutterDisplayLink*)displayLink
19 block:(void (^)(CFTimeInterval timestamp,
20 CFTimeInterval targetTimestamp,
21 uintptr_t baton))block;
22
23/// Schedules |baton| to be signaled on next display refresh.
24/// This function must be called on the main thread.
25- (void)waitForVSync:(uintptr_t)baton;
26
27/// Invalidates the waiter. This must be called on the main thread
28/// before the instance is deallocated.
29- (void)invalidate;
30
31@end
32
33#endif // FLUTTER_SHELL_PLATFORM_DARWIN_MACOS_FRAMEWORK_SOURCE_FLUTTERVSYNCWAITER_H_