-
Notifications
You must be signed in to change notification settings - Fork 6k
iOS,macOS: Refactor TestMetalContext for ARC #56510
Conversation
`TestMetalContext` cannot include any Objective-C types in its header file since that header is included in pure C++ translation units. Previously, we declared these fields as `void*`, which then requires manual `__bridge_retained` and `__bridge_transfer` casts to perform the necessary retain/relase manipulation while opting the object in and out of ARC management. Instead, we extract these to a struct in the implementation file and allow the fields to be managed by ARC. This is an interim measure consistent with the approach we've taken [elsewhere][1] until we implement the proper long-term solution. The proper long-term solution is to refactor `EmbedderTest` and other related code to split out backends into separate translation units, with the Metal backend code in Objective-C++ implementation files, which would then mean the headers could include Objective-C ivars. No changes to tests, since this change introduces no behaviour changes. [1]: https://github.com/flutter/engine/blob/950e240eb7a6bd52124d8efda6806a9eb3a18a83/shell/common/shell_test_platform_view_metal.mm#L21-L27 Issue: flutter/flutter#157942
It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption, contact "@test-exemption-reviewer" in the #hackers channel in Discord (don't just cc them here, they won't see it!). If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. The test exemption team is a small volunteer group, so all reviewers should feel empowered to ask for tests, without delegating that responsibility entirely to the test exemption group. |
test-exempt: code refactor with no semantic change |
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
…158485) flutter/engine@7b3eacd...35041f1 2024-11-11 skia-flutter-autoroll@skia.org Roll Dart SDK from a393f3ed040a to 69170fac244c (1 revision) (flutter/engine#56513) 2024-11-11 chris@bracken.jp iOS,macOS: Refactor TestMetalContext for ARC (flutter/engine#56510) 2024-11-11 jonahwilliams@google.com [Impeller] geometry changes to support line/point style. (flutter/engine#56340) 2024-11-11 skia-flutter-autoroll@skia.org Roll Skia from af6a4f9a85ee to 11046fd10394 (9 revisions) (flutter/engine#56508) 2024-11-11 jonahwilliams@google.com [Impeller] dont unnecessarily copy point data out of display list. (flutter/engine#56492) 2024-11-11 jonahwilliams@google.com [Impeller] fix line/polygon depth and GLES scissor state. (flutter/engine#56494) 2024-11-11 jason-simmons@users.noreply.github.com Do not stop flutter_tester if microtasks are still pending (flutter/engine#56432) 2024-11-11 skia-flutter-autoroll@skia.org Roll Skia from 261316c10484 to af6a4f9a85ee (5 revisions) (flutter/engine#56505) 2024-11-11 skia-flutter-autoroll@skia.org Roll Dart SDK from 4ea43aa234a4 to a393f3ed040a (1 revision) (flutter/engine#56506) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC jsimmons@google.com,zra@google.com on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
`TestMetalContext` cannot include any Objective-C types in its header file since that header is included in pure C++ translation units. Previously, we declared these fields as `void*`, which then requires manual `__bridge_retained` and `__bridge_transfer` casts to perform the necessary retain/relase manipulation while opting the object in and out of ARC management. Instead, we extract these to a struct in the implementation file and allow the fields to be managed by ARC. This is an interim measure consistent with the approach we've taken [elsewhere][1] until we implement the proper long-term solution. The proper long-term solution is to refactor `EmbedderTest` (see: flutter#157942) and other related code to split out backends into separate translation units, with the Metal backend code in Objective-C++ implementation files, which would then mean the headers could include Objective-C ivars. No changes to tests, since this change introduces no behaviour changes. Issue: flutter#157942 [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
TestMetalContext
cannot include any Objective-C types in its header file since that header is included in pure C++ translation units. Previously, we declared these fields asvoid*
, which then requires manual__bridge_retained
and__bridge_transfer
casts to perform the necessary retain/relase manipulation while opting the object in and out of ARC management.Instead, we extract these to a struct in the implementation file and allow the fields to be managed by ARC. This is an interim measure consistent with the approach we've taken elsewhere until we implement the proper long-term solution.
The proper long-term solution is to refactor
EmbedderTest
(see: flutter/flutter#157942) and other related code to split out backends into separate translation units, with the Metal backend code in Objective-C++ implementation files, which would then mean the headers could include Objective-C ivars.No changes to tests, since this change introduces no behaviour changes.
Issue: flutter/flutter#157942
Issue: flutter/flutter#158998
Pre-launch Checklist
///
).If you need help, consider asking for advice on the #hackers-new channel on Discord.