Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit d949242

Browse files
committed
small changes
1 parent 54b669a commit d949242

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,8 @@
3131

3232
/**
3333
* Owned by `FlutterView`.
34-
* Responsible for providing surfaces for Flutter to render into and
35-
* as well as subsequent presentation of these surfaces.
36-
* The Presentation of surfaces includes management of core animation sublayers.
34+
* Responsible for providing surfaces for Flutter to render into and subsequent
35+
* presentation of these surfaces. Manages core animation sublayers.
3736
*/
3837
@interface FlutterSurfaceManager : NSObject
3938

@@ -67,8 +66,8 @@
6766
* Must be called on raster thread. This will schedule a commit on platform
6867
* thread and block raster thread until the commit is done.
6968
* `notify` block will be invoked on platform thread and can be used to perform
70-
* additional work after commit is done, such as mutating platform views.
71-
* It is guaranteed be called in same CATransaction.
69+
* additional work, such as mutating platform views. It is guaranteed be called in
70+
* same CATransaction.
7271
*/
7372
- (void)present:(nonnull NSArray<FlutterSurfacePresentInfo*>*)surfaces
7473
notify:(nullable dispatch_block_t)notify;

shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.mm

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ - (instancetype)init {
2626
return self;
2727
}
2828

29-
- (nullable FlutterSurface*)getSurfaceForSize:(CGSize)size {
29+
- (nullable FlutterSurface*)removeSurfaceForSize:(CGSize)size {
3030
@synchronized(self) {
3131
for (FlutterSurface* surface in _surfaces) {
3232
if (CGSizeEqualToSize(surface.size, size)) {
33+
// By default ARC doesn't retain enumartion iteration variables.
3334
FlutterSurface* res = surface;
3435
[_surfaces removeObject:surface];
3536
return res;
@@ -138,7 +139,7 @@ - (FlutterSurface*)lookupSurface:(nonnull const FlutterMetalTexture*)texture {
138139
}
139140

140141
- (FlutterSurface*)backBufferForSize:(CGSize)size {
141-
FlutterSurface* res = [_backBufferCache getSurfaceForSize:size];
142+
FlutterSurface* res = [_backBufferCache removeSurfaceForSize:size];
142143
if (res == nil) {
143144
res = [[FlutterSurface alloc] initWithSize:size device:_device];
144145
}
@@ -173,7 +174,7 @@ - (void)commit:(NSArray<FlutterSurfacePresentInfo*>*)surfaces {
173174
[_layers addObject:layer];
174175
}
175176

176-
// Update contents of surface.
177+
// Update contents of surfaces.
177178
for (size_t i = 0; i < surfaces.count; ++i) {
178179
FlutterSurfacePresentInfo* info = surfaces[i];
179180
CALayer* layer = _layers[i];
@@ -190,7 +191,7 @@ - (void)present:(NSArray<FlutterSurfacePresentInfo*>*)surfaces notify:(dispatch_
190191
[commandBuffer commit];
191192
[commandBuffer waitUntilScheduled];
192193

193-
// Get the actual dimensions of the frame (relevant for resize synchronizer).
194+
// Get the actual dimensions of the frame (relevant for thread synchronizer).
194195
CGSize size = CGSizeZero;
195196
for (FlutterSurfacePresentInfo* info in surfaces) {
196197
size = CGSizeMake(std::max(size.width, info.offset.x + info.surface.size.width),

shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager_Internal.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
/**
1515
* Removes surface with given size from cache (if available) and returns it.
1616
*/
17-
- (nullable FlutterSurface*)getSurfaceForSize:(CGSize)size;
17+
- (nullable FlutterSurface*)removeSurfaceForSize:(CGSize)size;
1818

1919
/**
2020
* Removes all cached surface replacing them with new ones.

0 commit comments

Comments
 (0)