-
Notifications
You must be signed in to change notification settings - Fork 29.2k
macOS: port ResizeSynchronizer to Swift #168959
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
macOS: port ResizeSynchronizer to Swift #168959
Conversation
3ce6b81
to
56272d5
Compare
6a64d0f
to
1c42cfd
Compare
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
1c42cfd
to
cc456ce
Compare
There was a problem hiding this 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. |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"
There was a problem hiding this comment.
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.
engine/src/flutter/shell/platform/darwin/macos/framework/Source/ResizeSynchronizer.swift
Show resolved
Hide resolved
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 I tried generating compile_commands.json through 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. |
engine/src/flutter/shell/platform/darwin/macos/framework/Source/ResizeSynchronizer.swift
Show resolved
Hide resolved
engine/src/flutter/shell/platform/darwin/macos/framework/Source/ResizeSynchronizer.swift
Show resolved
Hide resolved
There was a problem hiding this 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 :)
Roll Flutter from 9a78af5eb067 to 33cdd8ef31dc (60 revisions) flutter/flutter@9a78af5...33cdd8e 2025-05-21 34465683+rkishan516@users.noreply.github.com Feat: Add persistentFooterDecoration for scaffold (flutter/flutter#167524) 2025-05-21 34270884+ferraridamiano@users.noreply.github.com Removed repeated entry in `CHANGELOG.md` (flutter/flutter#165273) 2025-05-21 dacoharkes@google.com [native assets] Graduate to preview (flutter/flutter#169194) 2025-05-21 jonahwilliams@google.com [Impeller] disable gl ext render to texture on vivante. (flutter/flutter#169153) 2025-05-21 mu7ammadkamel@hotmail.com fix(widget_inspector): add null check for flex factor property to prevent exception (flutter/flutter#167890) 2025-05-21 polinach@google.com Unpin leak_tracker. (flutter/flutter#169079) 2025-05-21 69134234+sutes-work@users.noreply.github.com runtime/dart: fuchsia::io::MODE_TYPE_FILE -> V_TYPE_FILE (flutter/flutter#168952) 2025-05-21 matanlurey@users.noreply.github.com Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter/flutter#169156) 2025-05-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#169181) 2025-05-20 ybz975218925@gmail.com Fix the issue with Tooltip (flutter/flutter#168546) 2025-05-20 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#169073) 2025-05-20 matanlurey@users.noreply.github.com Add documentation for experimental branches, update artifacts. (flutter/flutter#169109) 2025-05-20 kevmoo@users.noreply.github.com [flutter_tool] Remove unused environment flags in JS compiler (flutter/flutter#169097) 2025-05-20 bkonyi@google.com Add support for hiding widget subtrees from the widget inspector (flutter/flutter#169007) 2025-05-20 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from jsZSHIOmQAs3URvWU... to _tkqOQZ2qB5CxDe57... (flutter/flutter#169113) 2025-05-20 matanlurey@users.noreply.github.com Skip running `Linux fuchsia_test` on non-master channel. (flutter/flutter#169106) 2025-05-19 engine-flutter-autoroll@skia.org Roll Skia from c97451da059f to 13a299964c9f (61 revisions) (flutter/flutter#169099) 2025-05-19 maRci002@users.noreply.github.com Shared element transition for predictive back (flutter/flutter#154718) 2025-05-19 58529443+srujzs@users.noreply.github.com Fix DDC library bundle format test files to correctly pass flags (flutter/flutter#169095) 2025-05-19 8847263+littleGnAl@users.noreply.github.com Clean up redundant new line in the GPUSurfaceGLSkia constructor initializer list (flutter/flutter#169031) 2025-05-19 737941+loic-sharma@users.noreply.github.com Fix keyboard_hot_restart_ios flakes (flutter/flutter#168518) 2025-05-19 mohellebiabdessalem@gmail.com fix android studio lint about lambda argument (flutter/flutter#168901) 2025-05-19 8847263+littleGnAl@users.noreply.github.com Fix typo in gpu_surface_gl_impeller.cc (flutter/flutter#168395) 2025-05-19 emmanuelferdman@gmail.com Modernize system executable detection across components (flutter/flutter#169018) 2025-05-19 56335976+stuuupidcat@users.noreply.github.com Update documentation for `Size` and `Rect` classes (flutter/flutter#168031) 2025-05-19 48603081+TahaTesser@users.noreply.github.com Update the `RangeSlider` widget to the 2024 Material Design appearance (flutter/flutter#163736) 2025-05-19 engine-flutter-autoroll@skia.org Roll Packages from 58d4016 to af0b9a9 (5 revisions) (flutter/flutter#169075) 2025-05-19 sigurdm@google.com Only bundle assets and plugins from transitive closure of dependencies (flutter/flutter#160443) 2025-05-19 15619084+vashworth@users.noreply.github.com Make FlutterGeneratedPluginSwiftPackage an Xcode root package (flutter/flutter#168789) 2025-05-19 huy@nevercode.io docs: Update deprecation message for Slider.year2023 (flutter/flutter#169053) 2025-05-18 chris@bracken.jp macOS: port ResizeSynchronizer to Swift (flutter/flutter#168959) 2025-05-17 engine-flutter-autoroll@skia.org Roll Dart SDK from dc323ec0c1a3 to 7c40eba6bf77 (3 revisions) (flutter/flutter#169024) 2025-05-17 parlough@gmail.com [tool] Remove unused `reportNullSafety` getter (flutter/flutter#168484) 2025-05-17 jsimionato@google.com Add flag to skip bundling extension safe builds in frameworks for DDM (flutter/flutter#168955) 2025-05-16 47866232+chunhtai@users.noreply.github.com Fixes Navigator calls onPopInvokedWithResult when onPopPage return false (flutter/flutter#168567) 2025-05-16 34871572+gmackall@users.noreply.github.com [hcpp/hc] Fix talkback for HC and HCPP Android platform views (flutter/flutter#168939) 2025-05-16 jonahwilliams@google.com [Impeller] separate immutable sampler descriptors. (flutter/flutter#169011) 2025-05-16 51901607+O-Hannonen@users.noreply.github.com TextField magnifier stuck on long press cancel (flutter/flutter#167881) 2025-05-16 bruno.leroux@gmail.com Fix Chip delete button semantic bounds (flutter/flutter#168310) 2025-05-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Jj-iDG5uPOsFgY2_H... to XtPp9bBW49iDJ0wbA... (flutter/flutter#169009) 2025-05-16 bkonyi@google.com [ Widget Preview ] Refactor `@Preview()` detection and code generation (flutter/flutter#168307) 2025-05-16 engine-flutter-autoroll@skia.org Roll Packages from 2dff621 to 58d4016 (2 revisions) (flutter/flutter#168999) 2025-05-16 matanlurey@users.noreply.github.com Remove `unittests` from `windows_host_engine` GN targets. (flutter/flutter#168991) 2025-05-16 jessy.yameogo@gmail.com Fix bug with debugging support code not getting injected on edge devices (flutter/flutter#168073) 2025-05-16 engine-flutter-autoroll@skia.org Roll Dart SDK from a1db62a5dd14 to dc323ec0c1a3 (4 revisions) (flutter/flutter#168989) 2025-05-16 58190796+MitchellGoodwin@users.noreply.github.com Resolve Cupertino textstyle in MaterialBasedCupertinoThemeData (flutter/flutter#167597) ...
…r#9305) Roll Flutter from 9a78af5eb067 to 33cdd8ef31dc (60 revisions) flutter/flutter@9a78af5...33cdd8e 2025-05-21 34465683+rkishan516@users.noreply.github.com Feat: Add persistentFooterDecoration for scaffold (flutter/flutter#167524) 2025-05-21 34270884+ferraridamiano@users.noreply.github.com Removed repeated entry in `CHANGELOG.md` (flutter/flutter#165273) 2025-05-21 dacoharkes@google.com [native assets] Graduate to preview (flutter/flutter#169194) 2025-05-21 jonahwilliams@google.com [Impeller] disable gl ext render to texture on vivante. (flutter/flutter#169153) 2025-05-21 mu7ammadkamel@hotmail.com fix(widget_inspector): add null check for flex factor property to prevent exception (flutter/flutter#167890) 2025-05-21 polinach@google.com Unpin leak_tracker. (flutter/flutter#169079) 2025-05-21 69134234+sutes-work@users.noreply.github.com runtime/dart: fuchsia::io::MODE_TYPE_FILE -> V_TYPE_FILE (flutter/flutter#168952) 2025-05-21 matanlurey@users.noreply.github.com Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter/flutter#169156) 2025-05-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#169181) 2025-05-20 ybz975218925@gmail.com Fix the issue with Tooltip (flutter/flutter#168546) 2025-05-20 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#169073) 2025-05-20 matanlurey@users.noreply.github.com Add documentation for experimental branches, update artifacts. (flutter/flutter#169109) 2025-05-20 kevmoo@users.noreply.github.com [flutter_tool] Remove unused environment flags in JS compiler (flutter/flutter#169097) 2025-05-20 bkonyi@google.com Add support for hiding widget subtrees from the widget inspector (flutter/flutter#169007) 2025-05-20 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from jsZSHIOmQAs3URvWU... to _tkqOQZ2qB5CxDe57... (flutter/flutter#169113) 2025-05-20 matanlurey@users.noreply.github.com Skip running `Linux fuchsia_test` on non-master channel. (flutter/flutter#169106) 2025-05-19 engine-flutter-autoroll@skia.org Roll Skia from c97451da059f to 13a299964c9f (61 revisions) (flutter/flutter#169099) 2025-05-19 maRci002@users.noreply.github.com Shared element transition for predictive back (flutter/flutter#154718) 2025-05-19 58529443+srujzs@users.noreply.github.com Fix DDC library bundle format test files to correctly pass flags (flutter/flutter#169095) 2025-05-19 8847263+littleGnAl@users.noreply.github.com Clean up redundant new line in the GPUSurfaceGLSkia constructor initializer list (flutter/flutter#169031) 2025-05-19 737941+loic-sharma@users.noreply.github.com Fix keyboard_hot_restart_ios flakes (flutter/flutter#168518) 2025-05-19 mohellebiabdessalem@gmail.com fix android studio lint about lambda argument (flutter/flutter#168901) 2025-05-19 8847263+littleGnAl@users.noreply.github.com Fix typo in gpu_surface_gl_impeller.cc (flutter/flutter#168395) 2025-05-19 emmanuelferdman@gmail.com Modernize system executable detection across components (flutter/flutter#169018) 2025-05-19 56335976+stuuupidcat@users.noreply.github.com Update documentation for `Size` and `Rect` classes (flutter/flutter#168031) 2025-05-19 48603081+TahaTesser@users.noreply.github.com Update the `RangeSlider` widget to the 2024 Material Design appearance (flutter/flutter#163736) 2025-05-19 engine-flutter-autoroll@skia.org Roll Packages from 58d4016 to af0b9a9 (5 revisions) (flutter/flutter#169075) 2025-05-19 sigurdm@google.com Only bundle assets and plugins from transitive closure of dependencies (flutter/flutter#160443) 2025-05-19 15619084+vashworth@users.noreply.github.com Make FlutterGeneratedPluginSwiftPackage an Xcode root package (flutter/flutter#168789) 2025-05-19 huy@nevercode.io docs: Update deprecation message for Slider.year2023 (flutter/flutter#169053) 2025-05-18 chris@bracken.jp macOS: port ResizeSynchronizer to Swift (flutter/flutter#168959) 2025-05-17 engine-flutter-autoroll@skia.org Roll Dart SDK from dc323ec0c1a3 to 7c40eba6bf77 (3 revisions) (flutter/flutter#169024) 2025-05-17 parlough@gmail.com [tool] Remove unused `reportNullSafety` getter (flutter/flutter#168484) 2025-05-17 jsimionato@google.com Add flag to skip bundling extension safe builds in frameworks for DDM (flutter/flutter#168955) 2025-05-16 47866232+chunhtai@users.noreply.github.com Fixes Navigator calls onPopInvokedWithResult when onPopPage return false (flutter/flutter#168567) 2025-05-16 34871572+gmackall@users.noreply.github.com [hcpp/hc] Fix talkback for HC and HCPP Android platform views (flutter/flutter#168939) 2025-05-16 jonahwilliams@google.com [Impeller] separate immutable sampler descriptors. (flutter/flutter#169011) 2025-05-16 51901607+O-Hannonen@users.noreply.github.com TextField magnifier stuck on long press cancel (flutter/flutter#167881) 2025-05-16 bruno.leroux@gmail.com Fix Chip delete button semantic bounds (flutter/flutter#168310) 2025-05-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Jj-iDG5uPOsFgY2_H... to XtPp9bBW49iDJ0wbA... (flutter/flutter#169009) 2025-05-16 bkonyi@google.com [ Widget Preview ] Refactor `@Preview()` detection and code generation (flutter/flutter#168307) 2025-05-16 engine-flutter-autoroll@skia.org Roll Packages from 2dff621 to 58d4016 (2 revisions) (flutter/flutter#168999) 2025-05-16 matanlurey@users.noreply.github.com Remove `unittests` from `windows_host_engine` GN targets. (flutter/flutter#168991) 2025-05-16 jessy.yameogo@gmail.com Fix bug with debugging support code not getting injected on edge devices (flutter/flutter#168073) 2025-05-16 engine-flutter-autoroll@skia.org Roll Dart SDK from a1db62a5dd14 to dc323ec0c1a3 (4 revisions) (flutter/flutter#168989) 2025-05-16 58190796+MitchellGoodwin@users.noreply.github.com Resolve Cupertino textstyle in MaterialBasedCupertinoThemeData (flutter/flutter#167597) ...
…r#9305) Roll Flutter from 9a78af5eb067 to 33cdd8ef31dc (60 revisions) flutter/flutter@9a78af5...33cdd8e 2025-05-21 34465683+rkishan516@users.noreply.github.com Feat: Add persistentFooterDecoration for scaffold (flutter/flutter#167524) 2025-05-21 34270884+ferraridamiano@users.noreply.github.com Removed repeated entry in `CHANGELOG.md` (flutter/flutter#165273) 2025-05-21 dacoharkes@google.com [native assets] Graduate to preview (flutter/flutter#169194) 2025-05-21 jonahwilliams@google.com [Impeller] disable gl ext render to texture on vivante. (flutter/flutter#169153) 2025-05-21 mu7ammadkamel@hotmail.com fix(widget_inspector): add null check for flex factor property to prevent exception (flutter/flutter#167890) 2025-05-21 polinach@google.com Unpin leak_tracker. (flutter/flutter#169079) 2025-05-21 69134234+sutes-work@users.noreply.github.com runtime/dart: fuchsia::io::MODE_TYPE_FILE -> V_TYPE_FILE (flutter/flutter#168952) 2025-05-21 matanlurey@users.noreply.github.com Remove `isExplicitPackageDependenciesEnabled: true`, it is the default. (flutter/flutter#169156) 2025-05-21 137456488+flutter-pub-roller-bot@users.noreply.github.com Roll pub packages (flutter/flutter#169181) 2025-05-20 ybz975218925@gmail.com Fix the issue with Tooltip (flutter/flutter#168546) 2025-05-20 dacoharkes@google.com [native assets] Roll dependencies (flutter/flutter#169073) 2025-05-20 matanlurey@users.noreply.github.com Add documentation for experimental branches, update artifacts. (flutter/flutter#169109) 2025-05-20 kevmoo@users.noreply.github.com [flutter_tool] Remove unused environment flags in JS compiler (flutter/flutter#169097) 2025-05-20 bkonyi@google.com Add support for hiding widget subtrees from the widget inspector (flutter/flutter#169007) 2025-05-20 engine-flutter-autoroll@skia.org Roll Fuchsia GN SDK from jsZSHIOmQAs3URvWU... to _tkqOQZ2qB5CxDe57... (flutter/flutter#169113) 2025-05-20 matanlurey@users.noreply.github.com Skip running `Linux fuchsia_test` on non-master channel. (flutter/flutter#169106) 2025-05-19 engine-flutter-autoroll@skia.org Roll Skia from c97451da059f to 13a299964c9f (61 revisions) (flutter/flutter#169099) 2025-05-19 maRci002@users.noreply.github.com Shared element transition for predictive back (flutter/flutter#154718) 2025-05-19 58529443+srujzs@users.noreply.github.com Fix DDC library bundle format test files to correctly pass flags (flutter/flutter#169095) 2025-05-19 8847263+littleGnAl@users.noreply.github.com Clean up redundant new line in the GPUSurfaceGLSkia constructor initializer list (flutter/flutter#169031) 2025-05-19 737941+loic-sharma@users.noreply.github.com Fix keyboard_hot_restart_ios flakes (flutter/flutter#168518) 2025-05-19 mohellebiabdessalem@gmail.com fix android studio lint about lambda argument (flutter/flutter#168901) 2025-05-19 8847263+littleGnAl@users.noreply.github.com Fix typo in gpu_surface_gl_impeller.cc (flutter/flutter#168395) 2025-05-19 emmanuelferdman@gmail.com Modernize system executable detection across components (flutter/flutter#169018) 2025-05-19 56335976+stuuupidcat@users.noreply.github.com Update documentation for `Size` and `Rect` classes (flutter/flutter#168031) 2025-05-19 48603081+TahaTesser@users.noreply.github.com Update the `RangeSlider` widget to the 2024 Material Design appearance (flutter/flutter#163736) 2025-05-19 engine-flutter-autoroll@skia.org Roll Packages from 58d4016 to af0b9a9 (5 revisions) (flutter/flutter#169075) 2025-05-19 sigurdm@google.com Only bundle assets and plugins from transitive closure of dependencies (flutter/flutter#160443) 2025-05-19 15619084+vashworth@users.noreply.github.com Make FlutterGeneratedPluginSwiftPackage an Xcode root package (flutter/flutter#168789) 2025-05-19 huy@nevercode.io docs: Update deprecation message for Slider.year2023 (flutter/flutter#169053) 2025-05-18 chris@bracken.jp macOS: port ResizeSynchronizer to Swift (flutter/flutter#168959) 2025-05-17 engine-flutter-autoroll@skia.org Roll Dart SDK from dc323ec0c1a3 to 7c40eba6bf77 (3 revisions) (flutter/flutter#169024) 2025-05-17 parlough@gmail.com [tool] Remove unused `reportNullSafety` getter (flutter/flutter#168484) 2025-05-17 jsimionato@google.com Add flag to skip bundling extension safe builds in frameworks for DDM (flutter/flutter#168955) 2025-05-16 47866232+chunhtai@users.noreply.github.com Fixes Navigator calls onPopInvokedWithResult when onPopPage return false (flutter/flutter#168567) 2025-05-16 34871572+gmackall@users.noreply.github.com [hcpp/hc] Fix talkback for HC and HCPP Android platform views (flutter/flutter#168939) 2025-05-16 jonahwilliams@google.com [Impeller] separate immutable sampler descriptors. (flutter/flutter#169011) 2025-05-16 51901607+O-Hannonen@users.noreply.github.com TextField magnifier stuck on long press cancel (flutter/flutter#167881) 2025-05-16 bruno.leroux@gmail.com Fix Chip delete button semantic bounds (flutter/flutter#168310) 2025-05-16 engine-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from Jj-iDG5uPOsFgY2_H... to XtPp9bBW49iDJ0wbA... (flutter/flutter#169009) 2025-05-16 bkonyi@google.com [ Widget Preview ] Refactor `@Preview()` detection and code generation (flutter/flutter#168307) 2025-05-16 engine-flutter-autoroll@skia.org Roll Packages from 2dff621 to 58d4016 (2 revisions) (flutter/flutter#168999) 2025-05-16 matanlurey@users.noreply.github.com Remove `unittests` from `windows_host_engine` GN targets. (flutter/flutter#168991) 2025-05-16 jessy.yameogo@gmail.com Fix bug with debugging support code not getting injected on edge devices (flutter/flutter#168073) 2025-05-16 engine-flutter-autoroll@skia.org Roll Dart SDK from a1db62a5dd14 to dc323ec0c1a3 (4 revisions) (flutter/flutter#168989) 2025-05-16 58190796+MitchellGoodwin@users.noreply.github.com Resolve Cupertino textstyle in MaterialBasedCupertinoThemeData (flutter/flutter#167597) ...
This patch:
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.