Flutter macOS Embedder
FlutterSurfaceManager Class Reference

#import <FlutterSurfaceManager.h>

Inheritance diagram for FlutterSurfaceManager:

Instance Methods

(nullable instancetype) - initWithDevice:commandQueue:layer:delegate:
 
(nonnull FlutterSurface *) - surfaceForSize:
 
(void) - presentSurfaces:atTime:notify:
 

Properties

FlutterBackBufferCachebackBufferCache
 
NSArray< FlutterSurface * > * frontSurfaces
 
NSArray< CALayer * > * layers
 

Detailed Description

FlutterSurfaceManager is responsible for providing and presenting Core Animation render surfaces and managing sublayers.

Owned by FlutterView.

Definition at line 44 of file FlutterSurfaceManager.h.

Method Documentation

◆ initWithDevice:commandQueue:layer:delegate:

- (nullable instancetype) initWithDevice: (nonnull id< MTLDevice >)  device
commandQueue: (nonnull id< MTLCommandQueue >)  commandQueue
layer: (nonnull CALayer *)  containingLayer
delegate: (nonnull id< FlutterSurfaceManagerDelegate >)  delegate 

Initializes and returns a surface manager that renders to a child layer (referred to as the content layer) of the containing layer.

◆ presentSurfaces:atTime:notify:

- (void) presentSurfaces: (nonnull NSArray< FlutterSurfacePresentInfo * > *)  surfaces
atTime: (CFTimeInterval)  presentationTime
notify: (nullable dispatch_block_t)  notify 

Sets the provided surfaces as contents of FlutterView. Will create, update and remove sublayers as needed.

Must be called on raster thread. This will schedule a commit on the platform thread and block the raster thread until the commit is done. The notify block will be invoked on the platform thread and can be used to perform additional work, such as mutating platform views. It is guaranteed be called in the same CATransaction.

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

◆ surfaceForSize:

- (FlutterSurface *) surfaceForSize: (CGSize)  size

Returns a back buffer surface of the given size to which Flutter can render content. A cached surface will be returned if available; otherwise a new one will be created.

Must be called on raster thread.

Definition at line 133 of file FlutterSurfaceManager.mm.

133  :(CGSize)size {
134  FlutterSurface* surface = [_backBufferCache removeSurfaceForSize:size];
135  if (surface == nil) {
136  surface = [[FlutterSurface alloc] initWithSize:size device:_device];
137  }
138  return surface;
139 }

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

Property Documentation

◆ backBufferCache

- (FlutterBackBufferCache*) backBufferCache
readnonatomicassign

Provided by category FlutterSurfaceManager(Private).

Definition at line 105 of file FlutterSurfaceManager.h.

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

◆ frontSurfaces

- (NSArray<FlutterSurface*>*) frontSurfaces
readnonatomicassign

Provided by category FlutterSurfaceManager(Private).

Definition at line 106 of file FlutterSurfaceManager.h.

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

◆ layers

- (NSArray<CALayer*>*) layers
readnonatomicassign

Provided by category FlutterSurfaceManager(Private).

Definition at line 107 of file FlutterSurfaceManager.h.


The documentation for this class was generated from the following files:
FlutterSurface
Definition: FlutterSurface.h:16