Skip to content
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

[Windows] Prepare to add/remove views #51908

Merged
merged 2 commits into from
Apr 4, 2024

Conversation

loic-sharma
Copy link
Member

This is a refactoring with no semantic changes.

Prepare the Windows embedder to add/remove views. In a multi-view world, the platform thread can remove a view while the raster thread presenting to the same view. A lock will be introduced to ensure this does not happen. This shuffles the code around so that the engine can acquire the lock before the compositor presents to the view.

Prepares for flutter/flutter#138179
Part of flutter/flutter#142845

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.

EXPECT_TRUE(compositor.Present(view()->view_id(), nullptr, 0));
}

TEST_F(CompositorOpenGLTest, HeadlessPresentIgnored) {
Copy link
Member Author

Choose a reason for hiding this comment

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

The following tests were all replaced by WindowsTest.PresentHeadless:

  1. CompositorOpenGLTest.HeadlessPresentIgnored
  2. CompositorOpenGLTest.UnknownViewIgnored
  3. CompositorSoftwareTest.HeadlessPresentIgnored
  4. CompositorSoftwareTest.UnknownViewIgnored

(Presenting to the implicit view while in headless mode is effectively the same thing as presenting to an unknown view)

@@ -315,9 +315,49 @@ void drawHelloWorld() {
..addPicture(ui.Offset.zero, picture)
..pop();

ui.window.render(sceneBuilder.build());
ui.PlatformDispatcher.instance.implicitView?.render(sceneBuilder.build());
Copy link
Member Author

Choose a reason for hiding this comment

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

The window global is deprecated and replaced by PlatformDispatcher.instance.implicitView. This isn't necessary for this PR, but removes a usage of a deprecated member :)


ViewControllerPtr controller{builder.Run()};
ASSERT_NE(controller, nullptr);
auto& context = GetContext();
Copy link
Member Author

Choose a reason for hiding this comment

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

The extra thread was unnecessary for this test. Consider reviewing this with whitespace changes disabled: https://github.com/flutter/engine/pull/51908/files?w=1#diff-f0b8369989e179cde8da71010c79f2c542f16c55f91e9d9aeae1a3fe769cf83dR548

Copy link
Member

@cbracken cbracken left a comment

Choose a reason for hiding this comment

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

LGTM stamp from a Japanese personal seal

@loic-sharma loic-sharma added the autosubmit Merge PR when tree becomes green via auto submit App label Apr 4, 2024
@auto-submit auto-submit bot merged commit d44462a into flutter:main Apr 4, 2024
28 checks passed
@loic-sharma loic-sharma deleted the windows_prepare_multi_view branch April 4, 2024 21:46
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 4, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Apr 4, 2024
…146311)

flutter/engine@dcc99d6...d44462a

2024-04-04 [email protected] [Windows] Prepare to add/remove views (flutter/engine#51908)

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 [email protected],[email protected],[email protected] 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
gilnobrega pushed a commit to gilnobrega/flutter that referenced this pull request Apr 22, 2024
…lutter#146311)

flutter/engine@dcc99d6...d44462a

2024-04-04 [email protected] [Windows] Prepare to add/remove views (flutter/engine#51908)

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 [email protected],[email protected],[email protected] 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects: desktop autosubmit Merge PR when tree becomes green via auto submit App platform-windows
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants