Skip to content

Commit 9b9198a

Browse files
[macOS] Address review: tighten back buffer cache comment wording
The doc comment claimed all cached surfaces have the size of the last request. That is not strictly true right after a size change: the first surface returned into an empty cache can be one frame behind. State the invariant that actually holds (all cached surfaces share one size) and fix subject-verb agreement in the returnSurfaces: comment.
1 parent a8073db commit 9b9198a

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@
9393

9494
/**
9595
* Removes surface with given size from cache (if available) and returns it.
96-
* All cached surfaces have the size of the last request; a request for a
97-
* different size purges the cache first.
96+
* All cached surfaces are the same size; a request for a different size
97+
* purges the cache first.
9898
*/
9999
- (nullable FlutterSurface*)removeSurfaceForSize:(CGSize)size;
100100

‎engine/src/flutter/shell/platform/darwin/macos/framework/Source/FlutterSurfaceManager.mm‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -346,7 +346,7 @@ - (void)returnSurfaces:(nonnull NSArray<FlutterSurface*>*)returnedSurfaces {
346346
if (_surfaces.count > 0 && returnedSurfaces.count > 0 &&
347347
!CGSizeEqualToSize(returnedSurfaces.firstObject.size, _surfaces.firstObject.size)) {
348348
// Any cached surface size will match last requested size (see removeSurfaceForSize:). If the
349-
// size of incoming surfaces don't match cached surface size it means they are stale and
349+
// size of incoming surfaces doesn't match cached surface size it means they are stale and
350350
// should be discarded. Keeping them would let removeSurfaceForSize: hand out a surface of
351351
// the wrong size (https://github.com/flutter/flutter/issues/185394).
352352
return;

0 commit comments

Comments
 (0)