Flutter Engine
The Flutter Engine
Instance Methods | List of all members
FlutterThreadSynchronizer(TestUtils) Category Reference

#import <FlutterThreadSynchronizer.h>

Instance Methods

(nullable instancetype) - initWithMainQueue:
 
(BOOL- isWaitingWhenMutexIsAvailable
 
(void) - blockUntilFrameAvailable
 

Detailed Description

Definition at line 78 of file FlutterThreadSynchronizer.h.

Method Documentation

◆ blockUntilFrameAvailable

- (void) blockUntilFrameAvailable

Blocks current thread until there is frame available. Used in FlutterEngineTest.

Extends class FlutterThreadSynchronizer.

Definition at line 26 of file FlutterThreadSynchronizer.mm.

89 {
90 std::unique_lock<std::mutex> lock(_mutex);
91 [self drain];
92
93 _beginResizeWaiting = YES;
94 while (![self someViewsHaveFrame] && !_shuttingDown) {
95 _condBlockBeginResize.wait(lock);
96 [self drain];
97 }
98
99 _beginResizeWaiting = NO;
100}

◆ initWithMainQueue:

- (nullable instancetype) initWithMainQueue: (nonnull dispatch_queue_t)  queue

Creates a FlutterThreadSynchronizer that uses the specified queue as the platform thread.

Extends class FlutterThreadSynchronizer.

◆ isWaitingWhenMutexIsAvailable

- (BOOL) isWaitingWhenMutexIsAvailable

Blocks current thread until the mutex is available, then return whether the synchronizer is waiting for a correct commit during resizing.

After calling an operation of the thread synchronizer, call this method, and when it returns, the thread synchronizer can be at one of the following 3 states:

  1. The operation has not started at all (with a return value FALSE.)
  2. The operation has ended (with a return value FALSE.)
  3. beginResizeForView: is in progress, waiting (with a return value TRUE.)

By eliminating the 1st case (such as using the notify callback), we can use this return value to decide whether the synchronizer is in case 2 or case 3, that is whether the resizing is blocked by a mismatching commit.

Extends class FlutterThreadSynchronizer.

Definition at line 26 of file FlutterThreadSynchronizer.mm.

200 {
201 std::unique_lock<std::mutex> lock(_mutex);
202 return _beginResizeWaiting;
203}

The documentation for this category was generated from the following file: