Skip to content

Conversation

@cbracken
Copy link
Member

@cbracken cbracken commented May 16, 2025

This patch:

  • migrates FlutterResizeSynchronizer from Objective-C to Swift.
  • reorders the performCommit parameters to support trailing closure syntax in Swift.
  • adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
  • adds test coverage for the timeout case.
  • significantly improves the class documentation.
  • adds the first Swift Testing tests for the macOS embedder.
  • adds the new tests to run_test.py.

Admittedly, the original purpose was just to add a class that we could write Swift tests for, but things got a bit out of hand.

Issue: #168564
Issue: #144791

Pre-launch Checklist

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@github-actions github-actions bot added engine flutter/engine related. See also e: labels. a: desktop Running on desktop platform-macos labels May 16, 2025
@cbracken cbracken force-pushed the swift-resize-synchronizer branch 3 times, most recently from 3ce6b81 to 56272d5 Compare May 16, 2025 04:38
@cbracken cbracken requested review from knopp and loic-sharma May 16, 2025 04:38
@cbracken cbracken force-pushed the swift-resize-synchronizer branch 6 times, most recently from 6a64d0f to 1c42cfd Compare May 16, 2025 17:57
This patch:
* migrates FlutterResizeSynchronizer from Objective-C to Swift.
* reorders the performCommit parameters to support trailing closure
  syntax in Swift.
* adds an optional onTimeout parameter to ResizeSynchronizer.beginResize.
* adds test coverage for the timeout case.
* significantly improves the class documentation.
* adds the first Swift Testing tests for the macOS embedder.
* adds the new tests to run_test.py.

Issue: flutter#168564
Issue: flutter#144791
@cbracken cbracken force-pushed the swift-resize-synchronizer branch from 1c42cfd to cc456ce Compare May 16, 2025 17:58
Copy link
Contributor

@vashworth vashworth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

/// provided to handle this event.
/// - Shutdown: The synchronization can be cleanly interrupted by calling `shutDown()`, which will
/// also unblock any pending `beginResize()` call. After shutdown, `beginResize()` will no
/// longer block.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to me after shutdown, we stop synchronizing since isShuttingDown never becomes false again. May be worth adding to this comment?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh or maybe that's what you meant by "will no longer block"

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yep that's exactly what I mean.

i.e. no need to block any longer since when shutting down, the app is going away so there's no more need to synchronise window updates with flutter content updates.

@knopp
Copy link
Member

knopp commented May 16, 2025

This seems to have negative impact on project navigation. SwiftLSP doesn't seem to be able to figure out the correct compilation options for swift files, so for example autocomplete for FlutterRunLoop inside ResizeSynchronizer.swift doesn't work, nor is it possible to jump to FlutterRunLoop from ResizeSynchronizer.swift.

I tried generating compile_commands.json through ninja -t compdb (the gn generated one doesn't contain swift files at all), but it didn't seem to help with the LSP.

This would be an unfortunate regression, given that autocomplete and code navigation currently works pretty much 100% with objc/clangd, and especially for people unfamiliar with parts of codebase being able to quickly navigate through the code can be very helpful.

Copy link
Member

@loic-sharma loic-sharma left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Desktop resizing logic looks good to me, but I don't know Swift :)

@cbracken cbracken added the autosubmit Merge PR when tree becomes green via auto submit App label May 18, 2025
@auto-submit auto-submit bot added this pull request to the merge queue May 18, 2025
Merged via the queue into flutter:master with commit e27377e May 18, 2025
181 checks passed
@flutter-dashboard flutter-dashboard bot removed the autosubmit Merge PR when tree becomes green via auto submit App label May 18, 2025
@cbracken cbracken deleted the swift-resize-synchronizer branch May 18, 2025 22:32
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 19, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 20, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request May 21, 2025
auto-submit bot pushed a commit to flutter/packages that referenced this pull request May 21, 2025
Roll Flutter from 9a78af5eb067 to 33cdd8ef31dc (60 revisions)

flutter/flutter@9a78af5...33cdd8e

2025-05-21 [email protected] Feat: Add persistentFooterDecoration for scaffold (flutter/flutter#167524)
2025-05-21 [email protected] Removed repeated entry in `CHANGELOG.md` (flutter/flutter#165273)
2025-05-21 [email protected] [native assets] Graduate to preview (flutter/flutter#169194)
2025-05-21 [email protected] [Impeller] disable gl ext render to texture on vivante. (flutter/flutter#169153)
2025-05-21 [email protected] fix(widget_inspector): add null check for flex factor property to prevent exception (flutter/flutter#167890)
2025-05-21 [email protected] Unpin leak_tracker. (flutter/flutter#169079)
2025-05-21 [email protected] runtime/dart: fuchsia::io::MODE_TYPE_FILE -> V_TYPE_FILE (flutter/flutter#168952)
2025-05-21 [email protected] Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter/flutter#169156)
2025-05-21 [email protected] Roll pub packages (flutter/flutter#169181)
2025-05-20 [email protected] Fix the issue with Tooltip (flutter/flutter#168546)
2025-05-20 [email protected] [native assets] Roll dependencies (flutter/flutter#169073)
2025-05-20 [email protected] Add documentation for experimental branches, update artifacts. (flutter/flutter#169109)
2025-05-20 [email protected] [flutter_tool] Remove unused environment flags in JS compiler (flutter/flutter#169097)
2025-05-20 [email protected] Add support for hiding widget subtrees from the widget inspector (flutter/flutter#169007)
2025-05-20 [email protected] Roll Fuchsia GN SDK from jsZSHIOmQAs3URvWU... to _tkqOQZ2qB5CxDe57... (flutter/flutter#169113)
2025-05-20 [email protected] Skip running `Linux fuchsia_test` on non-master channel. (flutter/flutter#169106)
2025-05-19 [email protected] Roll Skia from c97451da059f to 13a299964c9f (61 revisions) (flutter/flutter#169099)
2025-05-19 [email protected] Shared element transition for predictive back (flutter/flutter#154718)
2025-05-19 [email protected] Fix DDC library bundle format test files to correctly pass flags (flutter/flutter#169095)
2025-05-19 [email protected] Clean up redundant new line in the GPUSurfaceGLSkia constructor initializer list (flutter/flutter#169031)
2025-05-19 [email protected] Fix keyboard_hot_restart_ios flakes (flutter/flutter#168518)
2025-05-19 [email protected] fix android studio lint about lambda argument (flutter/flutter#168901)
2025-05-19 [email protected] Fix typo in gpu_surface_gl_impeller.cc (flutter/flutter#168395)
2025-05-19 [email protected] Modernize system executable detection across components (flutter/flutter#169018)
2025-05-19 [email protected] Update documentation for `Size` and `Rect` classes (flutter/flutter#168031)
2025-05-19 [email protected] Update the `RangeSlider` widget to the 2024 Material Design appearance (flutter/flutter#163736)
2025-05-19 [email protected] Roll Packages from 58d4016 to af0b9a9 (5 revisions) (flutter/flutter#169075)
2025-05-19 [email protected] Only bundle assets and plugins from transitive closure of dependencies (flutter/flutter#160443)
2025-05-19 [email protected] Make FlutterGeneratedPluginSwiftPackage an Xcode root package (flutter/flutter#168789)
2025-05-19 [email protected] docs: Update deprecation message for Slider.year2023 (flutter/flutter#169053)
2025-05-18 [email protected] macOS: port ResizeSynchronizer to Swift (flutter/flutter#168959)
2025-05-17 [email protected] Roll Dart SDK from dc323ec0c1a3 to 7c40eba6bf77 (3 revisions) (flutter/flutter#169024)
2025-05-17 [email protected] [tool] Remove unused `reportNullSafety` getter (flutter/flutter#168484)
2025-05-17 [email protected] Add flag to skip bundling extension safe builds in frameworks for DDM (flutter/flutter#168955)
2025-05-16 [email protected] Fixes Navigator calls onPopInvokedWithResult when onPopPage return false (flutter/flutter#168567)
2025-05-16 [email protected] [hcpp/hc] Fix talkback for HC and HCPP Android platform views (flutter/flutter#168939)
2025-05-16 [email protected] [Impeller] separate immutable sampler descriptors. (flutter/flutter#169011)
2025-05-16 [email protected] TextField magnifier stuck on long press cancel (flutter/flutter#167881)
2025-05-16 [email protected] Fix Chip delete button semantic bounds (flutter/flutter#168310)
2025-05-16 [email protected] Roll Fuchsia Linux SDK from Jj-iDG5uPOsFgY2_H... to XtPp9bBW49iDJ0wbA... (flutter/flutter#169009)
2025-05-16 [email protected] [ Widget Preview ] Refactor `@Preview()` detection and code generation (flutter/flutter#168307)
2025-05-16 [email protected] Roll Packages from 2dff621 to 58d4016 (2 revisions) (flutter/flutter#168999)
2025-05-16 [email protected] Remove `unittests` from `windows_host_engine` GN targets. (flutter/flutter#168991)
2025-05-16 [email protected] Fix bug with debugging support code not getting injected on edge devices (flutter/flutter#168073)
2025-05-16 [email protected] Roll Dart SDK from a1db62a5dd14 to dc323ec0c1a3 (4 revisions) (flutter/flutter#168989)
2025-05-16 [email protected] Resolve Cupertino textstyle in MaterialBasedCupertinoThemeData (flutter/flutter#167597)
...
FMorschel pushed a commit to FMorschel/packages that referenced this pull request Jun 9, 2025
…r#9305)

Roll Flutter from 9a78af5eb067 to 33cdd8ef31dc (60 revisions)

flutter/flutter@9a78af5...33cdd8e

2025-05-21 [email protected] Feat: Add persistentFooterDecoration for scaffold (flutter/flutter#167524)
2025-05-21 [email protected] Removed repeated entry in `CHANGELOG.md` (flutter/flutter#165273)
2025-05-21 [email protected] [native assets] Graduate to preview (flutter/flutter#169194)
2025-05-21 [email protected] [Impeller] disable gl ext render to texture on vivante. (flutter/flutter#169153)
2025-05-21 [email protected] fix(widget_inspector): add null check for flex factor property to prevent exception (flutter/flutter#167890)
2025-05-21 [email protected] Unpin leak_tracker. (flutter/flutter#169079)
2025-05-21 [email protected] runtime/dart: fuchsia::io::MODE_TYPE_FILE -> V_TYPE_FILE (flutter/flutter#168952)
2025-05-21 [email protected] Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter/flutter#169156)
2025-05-21 [email protected] Roll pub packages (flutter/flutter#169181)
2025-05-20 [email protected] Fix the issue with Tooltip (flutter/flutter#168546)
2025-05-20 [email protected] [native assets] Roll dependencies (flutter/flutter#169073)
2025-05-20 [email protected] Add documentation for experimental branches, update artifacts. (flutter/flutter#169109)
2025-05-20 [email protected] [flutter_tool] Remove unused environment flags in JS compiler (flutter/flutter#169097)
2025-05-20 [email protected] Add support for hiding widget subtrees from the widget inspector (flutter/flutter#169007)
2025-05-20 [email protected] Roll Fuchsia GN SDK from jsZSHIOmQAs3URvWU... to _tkqOQZ2qB5CxDe57... (flutter/flutter#169113)
2025-05-20 [email protected] Skip running `Linux fuchsia_test` on non-master channel. (flutter/flutter#169106)
2025-05-19 [email protected] Roll Skia from c97451da059f to 13a299964c9f (61 revisions) (flutter/flutter#169099)
2025-05-19 [email protected] Shared element transition for predictive back (flutter/flutter#154718)
2025-05-19 [email protected] Fix DDC library bundle format test files to correctly pass flags (flutter/flutter#169095)
2025-05-19 [email protected] Clean up redundant new line in the GPUSurfaceGLSkia constructor initializer list (flutter/flutter#169031)
2025-05-19 [email protected] Fix keyboard_hot_restart_ios flakes (flutter/flutter#168518)
2025-05-19 [email protected] fix android studio lint about lambda argument (flutter/flutter#168901)
2025-05-19 [email protected] Fix typo in gpu_surface_gl_impeller.cc (flutter/flutter#168395)
2025-05-19 [email protected] Modernize system executable detection across components (flutter/flutter#169018)
2025-05-19 [email protected] Update documentation for `Size` and `Rect` classes (flutter/flutter#168031)
2025-05-19 [email protected] Update the `RangeSlider` widget to the 2024 Material Design appearance (flutter/flutter#163736)
2025-05-19 [email protected] Roll Packages from 58d4016 to af0b9a9 (5 revisions) (flutter/flutter#169075)
2025-05-19 [email protected] Only bundle assets and plugins from transitive closure of dependencies (flutter/flutter#160443)
2025-05-19 [email protected] Make FlutterGeneratedPluginSwiftPackage an Xcode root package (flutter/flutter#168789)
2025-05-19 [email protected] docs: Update deprecation message for Slider.year2023 (flutter/flutter#169053)
2025-05-18 [email protected] macOS: port ResizeSynchronizer to Swift (flutter/flutter#168959)
2025-05-17 [email protected] Roll Dart SDK from dc323ec0c1a3 to 7c40eba6bf77 (3 revisions) (flutter/flutter#169024)
2025-05-17 [email protected] [tool] Remove unused `reportNullSafety` getter (flutter/flutter#168484)
2025-05-17 [email protected] Add flag to skip bundling extension safe builds in frameworks for DDM (flutter/flutter#168955)
2025-05-16 [email protected] Fixes Navigator calls onPopInvokedWithResult when onPopPage return false (flutter/flutter#168567)
2025-05-16 [email protected] [hcpp/hc] Fix talkback for HC and HCPP Android platform views (flutter/flutter#168939)
2025-05-16 [email protected] [Impeller] separate immutable sampler descriptors. (flutter/flutter#169011)
2025-05-16 [email protected] TextField magnifier stuck on long press cancel (flutter/flutter#167881)
2025-05-16 [email protected] Fix Chip delete button semantic bounds (flutter/flutter#168310)
2025-05-16 [email protected] Roll Fuchsia Linux SDK from Jj-iDG5uPOsFgY2_H... to XtPp9bBW49iDJ0wbA... (flutter/flutter#169009)
2025-05-16 [email protected] [ Widget Preview ] Refactor `@Preview()` detection and code generation (flutter/flutter#168307)
2025-05-16 [email protected] Roll Packages from 2dff621 to 58d4016 (2 revisions) (flutter/flutter#168999)
2025-05-16 [email protected] Remove `unittests` from `windows_host_engine` GN targets. (flutter/flutter#168991)
2025-05-16 [email protected] Fix bug with debugging support code not getting injected on edge devices (flutter/flutter#168073)
2025-05-16 [email protected] Roll Dart SDK from a1db62a5dd14 to dc323ec0c1a3 (4 revisions) (flutter/flutter#168989)
2025-05-16 [email protected] Resolve Cupertino textstyle in MaterialBasedCupertinoThemeData (flutter/flutter#167597)
...
Ortes pushed a commit to Ortes/packages that referenced this pull request Jun 25, 2025
…r#9305)

Roll Flutter from 9a78af5eb067 to 33cdd8ef31dc (60 revisions)

flutter/flutter@9a78af5...33cdd8e

2025-05-21 [email protected] Feat: Add persistentFooterDecoration for scaffold (flutter/flutter#167524)
2025-05-21 [email protected] Removed repeated entry in `CHANGELOG.md` (flutter/flutter#165273)
2025-05-21 [email protected] [native assets] Graduate to preview (flutter/flutter#169194)
2025-05-21 [email protected] [Impeller] disable gl ext render to texture on vivante. (flutter/flutter#169153)
2025-05-21 [email protected] fix(widget_inspector): add null check for flex factor property to prevent exception (flutter/flutter#167890)
2025-05-21 [email protected] Unpin leak_tracker. (flutter/flutter#169079)
2025-05-21 [email protected] runtime/dart: fuchsia::io::MODE_TYPE_FILE -> V_TYPE_FILE (flutter/flutter#168952)
2025-05-21 [email protected] Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter/flutter#169156)
2025-05-21 [email protected] Roll pub packages (flutter/flutter#169181)
2025-05-20 [email protected] Fix the issue with Tooltip (flutter/flutter#168546)
2025-05-20 [email protected] [native assets] Roll dependencies (flutter/flutter#169073)
2025-05-20 [email protected] Add documentation for experimental branches, update artifacts. (flutter/flutter#169109)
2025-05-20 [email protected] [flutter_tool] Remove unused environment flags in JS compiler (flutter/flutter#169097)
2025-05-20 [email protected] Add support for hiding widget subtrees from the widget inspector (flutter/flutter#169007)
2025-05-20 [email protected] Roll Fuchsia GN SDK from jsZSHIOmQAs3URvWU... to _tkqOQZ2qB5CxDe57... (flutter/flutter#169113)
2025-05-20 [email protected] Skip running `Linux fuchsia_test` on non-master channel. (flutter/flutter#169106)
2025-05-19 [email protected] Roll Skia from c97451da059f to 13a299964c9f (61 revisions) (flutter/flutter#169099)
2025-05-19 [email protected] Shared element transition for predictive back (flutter/flutter#154718)
2025-05-19 [email protected] Fix DDC library bundle format test files to correctly pass flags (flutter/flutter#169095)
2025-05-19 [email protected] Clean up redundant new line in the GPUSurfaceGLSkia constructor initializer list (flutter/flutter#169031)
2025-05-19 [email protected] Fix keyboard_hot_restart_ios flakes (flutter/flutter#168518)
2025-05-19 [email protected] fix android studio lint about lambda argument (flutter/flutter#168901)
2025-05-19 [email protected] Fix typo in gpu_surface_gl_impeller.cc (flutter/flutter#168395)
2025-05-19 [email protected] Modernize system executable detection across components (flutter/flutter#169018)
2025-05-19 [email protected] Update documentation for `Size` and `Rect` classes (flutter/flutter#168031)
2025-05-19 [email protected] Update the `RangeSlider` widget to the 2024 Material Design appearance (flutter/flutter#163736)
2025-05-19 [email protected] Roll Packages from 58d4016 to af0b9a9 (5 revisions) (flutter/flutter#169075)
2025-05-19 [email protected] Only bundle assets and plugins from transitive closure of dependencies (flutter/flutter#160443)
2025-05-19 [email protected] Make FlutterGeneratedPluginSwiftPackage an Xcode root package (flutter/flutter#168789)
2025-05-19 [email protected] docs: Update deprecation message for Slider.year2023 (flutter/flutter#169053)
2025-05-18 [email protected] macOS: port ResizeSynchronizer to Swift (flutter/flutter#168959)
2025-05-17 [email protected] Roll Dart SDK from dc323ec0c1a3 to 7c40eba6bf77 (3 revisions) (flutter/flutter#169024)
2025-05-17 [email protected] [tool] Remove unused `reportNullSafety` getter (flutter/flutter#168484)
2025-05-17 [email protected] Add flag to skip bundling extension safe builds in frameworks for DDM (flutter/flutter#168955)
2025-05-16 [email protected] Fixes Navigator calls onPopInvokedWithResult when onPopPage return false (flutter/flutter#168567)
2025-05-16 [email protected] [hcpp/hc] Fix talkback for HC and HCPP Android platform views (flutter/flutter#168939)
2025-05-16 [email protected] [Impeller] separate immutable sampler descriptors. (flutter/flutter#169011)
2025-05-16 [email protected] TextField magnifier stuck on long press cancel (flutter/flutter#167881)
2025-05-16 [email protected] Fix Chip delete button semantic bounds (flutter/flutter#168310)
2025-05-16 [email protected] Roll Fuchsia Linux SDK from Jj-iDG5uPOsFgY2_H... to XtPp9bBW49iDJ0wbA... (flutter/flutter#169009)
2025-05-16 [email protected] [ Widget Preview ] Refactor `@Preview()` detection and code generation (flutter/flutter#168307)
2025-05-16 [email protected] Roll Packages from 2dff621 to 58d4016 (2 revisions) (flutter/flutter#168999)
2025-05-16 [email protected] Remove `unittests` from `windows_host_engine` GN targets. (flutter/flutter#168991)
2025-05-16 [email protected] Fix bug with debugging support code not getting injected on edge devices (flutter/flutter#168073)
2025-05-16 [email protected] Roll Dart SDK from a1db62a5dd14 to dc323ec0c1a3 (4 revisions) (flutter/flutter#168989)
2025-05-16 [email protected] Resolve Cupertino textstyle in MaterialBasedCupertinoThemeData (flutter/flutter#167597)
...
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 14, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 15, 2025
engine-flutter-autoroll added a commit to engine-flutter-autoroll/packages that referenced this pull request Aug 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

a: desktop Running on desktop engine flutter/engine related. See also e: labels. platform-macos

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants