| Flutter macOS Embedder |

Instance Methods | List of all members
FlutterResizeSynchronizer Class Reference

`#import <FlutterResizeSynchronizer.h>`

Inheritance diagram for FlutterResizeSynchronizer:

## Instance Methods
(void) | - beginResizeForSize:notify:
(void) | - performCommitForSize:notify:delay:
(void) | - shutDown

## Detailed Description

Class responsible for coordinating window resize with content update.

Definition at line 16 of file FlutterResizeSynchronizer.h.

## Method Documentation

## ◆ beginResizeForSize:notify:

- (void) beginResizeForSize: |  | (CGSize) | size
notify: |  | (nonnull dispatch_block_t) | notify

Begins a resize operation for the given size. Block the thread until performCommitForSize: with the same size is called. While the thread is blocked Flutter messages are being pumped. See [FlutterRunLoop pollFlutterMessagesOnce].

Definition at line 14 of file FlutterResizeSynchronizer.mm.

17 :(CGSize)size notify:(nonnull dispatch_block_t)notify {
18 if (!_didReceiveFrame || _shuttingDown) {
19 notify();
20 return;
21 }
22
23 _inResize = true;
24 _contentSize = CGSizeMake(-1, -1);
25 notify();
26 CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
27 while (true) {
28 if (CGSizeEqualToSize(_contentSize, size) || _shuttingDown) {
29 break;
30 }
31 if (CFAbsoluteTimeGetCurrent() - start > 1.0) {
32 FML_LOG(ERROR) << "Resize timed out.";
33 break;
34 }
35 [FlutterRunLoop.mainRunLoop pollFlutterMessagesOnce];
36 }
37 _inResize = false;
38 }
_shuttingDown
BOOL _shuttingDown
Definition: FlutterResizeSynchronizer.mm:10
_contentSize
CGSize _contentSize
Definition: FlutterResizeSynchronizer.mm:14
_didReceiveFrame
BOOL _didReceiveFrame
Definition: FlutterResizeSynchronizer.mm:13
FlutterRunLoop
Definition: FlutterRunLoop.h:16
-[FlutterRunLoop pollFlutterMessagesOnce]
void pollFlutterMessagesOnce()
Definition: FlutterRunLoop.mm:123

## ◆ performCommitForSize:notify:delay:

- (void) performCommitForSize: |  | (CGSize) | size
notify: |  | (nonnull dispatch_block_t) | notify
delay: |  | (NSTimeInterval) | delay

Called from raster thread. Schedules the given block on platform thread at given delay and unblocks the platform thread if waiting for the surface during resize.

Definition at line 14 of file FlutterResizeSynchronizer.mm.

40 :(CGSize)size
41 notify:(nonnull dispatch_block_t)notify
42 delay:(NSTimeInterval)delay {
43 if (_inResize) {
44 delay = 0;
45 }
46 [FlutterRunLoop.mainRunLoop
47 performBlock:^{
48 _didReceiveFrame = YES;
49 _contentSize = size;
50 notify();
51 }
52 afterDelay:delay];
53 }
-[FlutterRunLoop performBlock:afterDelay:]
void performBlock:afterDelay:(void(^ block)(void),[afterDelay] NSTimeInterval delay)
Definition: FlutterRunLoop.mm:95

Referenced by flutter::testing::TEST_F().

## ◆ shutDown

- (void) shutDown |  |  |

Called when the view is shut down. Unblocks platform thread if blocked during resize.

Definition at line 14 of file FlutterResizeSynchronizer.mm.

55 {
56 [FlutterRunLoop.mainRunLoop performBlock:^{
57 _shuttingDown = YES;
58 }];
59 }
-[FlutterRunLoop performBlock:]
void performBlock:(void(^ block)(void))
Definition: FlutterRunLoop.mm:107

Referenced by flutter::testing::TEST_F().

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

- shell/platform/darwin/macos/framework/Source/FlutterResizeSynchronizer.h
- shell/platform/darwin/macos/framework/Source/FlutterResizeSynchronizer.mm