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

[macOS] Group per-view information in FlutterCompositor into a class #51738

Merged
merged 5 commits into from
Mar 28, 2024

Conversation

dkwingsmt
Copy link
Contributor

@dkwingsmt dkwingsmt commented Mar 28, 2024

This PR groups per-view information in FlutterCompositor into a private class, ViewPresenter. This makes it easier to manage per-view data and write view operations.

Part of flutter/flutter#145874.

Currently, view presenters are never removed once created, since the macOS runner doesn't support removing views. This will be added in the future.

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

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

@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact "@test-exemption-reviewer" in the #hackers channel in Chat (don't just cc them here, they won't see it! Use Discord!).

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.

@dkwingsmt
Copy link
Contributor Author

@knopp Can you take a look? In addition to the change itself, how do you think I can test it (and further changes to the composition code)? Because macOS FlutterCompositor currently doesn't have any test harness.

@dkwingsmt dkwingsmt requested a review from knopp March 28, 2024 20:22
FML_DCHECK([[NSThread currentThread] isMainThread])
<< "Must be on the main thread to present platform views";

// Active mutator views for this frame.
NSMutableArray<FlutterMutatorView*>* present_mutators = [NSMutableArray array];

for (const auto& platform_view : platform_views) {
[present_mutators addObject:PresentPlatformView(default_base_view, platform_view.first,
Copy link
Member

Choose a reason for hiding this comment

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

Just a nit - The formatting looks bit weird after adding additional argument. Maybe use a temporary variable for the result of PresentPlatformView?

@knopp
Copy link
Member

knopp commented Mar 28, 2024

Looks good, left couple of nits, is this still a draft?

@dkwingsmt
Copy link
Contributor Author

dkwingsmt commented Mar 28, 2024

@knopp I'm mostly wondering if there's any unit tests you'd like me to add. I'm also ok with skipping this one and testing the macOS engine as a whole in a later patch. The change itself is finished. I've marked it as ready to review.

@dkwingsmt dkwingsmt marked this pull request as ready for review March 28, 2024 22:58
@knopp
Copy link
Member

knopp commented Mar 28, 2024

Right. It is currently only tested in TEST_F(FlutterEngineTest, Compositor). There were tests before but they were kinda useless so @cbracken has removed them. flutter/flutter#137648

I think this is a fairly minor refactor I'd be okay with this landing without tests.

@dkwingsmt dkwingsmt added the autosubmit Merge PR when tree becomes green via auto submit App label Mar 28, 2024
@auto-submit auto-submit bot merged commit c1d6a8e into flutter:main Mar 28, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Mar 29, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Mar 29, 2024
…145990)

flutter/engine@68aa9ba...b16c0f1

2024-03-29 skia-flutter-autoroll@skia.org Roll Skia from 94c0af1297ae to a12e40efacea (3 revisions) (flutter/engine#51776)
2024-03-29 skia-flutter-autoroll@skia.org Roll Skia from b2a01ae03cdf to 94c0af1297ae (1 revision) (flutter/engine#51773)
2024-03-29 skia-flutter-autoroll@skia.org Roll Skia from 6042ad386bcf to b2a01ae03cdf (4 revisions) (flutter/engine#51772)
2024-03-29 skia-flutter-autoroll@skia.org Roll Fuchsia Linux SDK from uzI3wnbEGlZ_dtO0Z... to 3vgfbp1vjXkdMZ09m... (flutter/engine#51767)
2024-03-29 jacksongardner@google.com [skwasm] Fix `toString` methods on Paint and ImageFilter/ColorFilter (flutter/engine#51766)
2024-03-29 john@johnmccutchan.com Reland flutter/engine#51391 (flutter/engine#51764)
2024-03-29 737941+loic-sharma@users.noreply.github.com Add completion callback to `Shell::AddView` (flutter/engine#51659)
2024-03-29 737941+loic-sharma@users.noreply.github.com [Windows] Move keyboard initialization (flutter/engine#51758)
2024-03-29 737941+loic-sharma@users.noreply.github.com [Windows] Don't always stop engine on view destruction (flutter/engine#51681)
2024-03-28 dkwingsmt@users.noreply.github.com [macOS] Group per-view information in `FlutterCompositor` into a class (flutter/engine#51738)

Also rolling transitive DEPS:
  fuchsia/sdk/core/linux-amd64 from uzI3wnbEGlZ_ to 3vgfbp1vjXkd

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 jacksongardner@google.com,rmistry@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
auto-submit bot pushed a commit that referenced this pull request Apr 2, 2024
This PR removes the view ID check added in #51738, which has been causing a test `FlutterEngineTest.CompositorIgnoresUnknownView`, added in #51436, to fail.

This problem was missed by the CI because the test and the view ID check were added in two PRs recently and they were not using the latest engine to check.

The view ID check is not needed anyway, and is only a temporary check until the multiview support is landed.

[C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects: desktop autosubmit Merge PR when tree becomes green via auto submit App platform-macos
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants