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

[linux] Wait for binding to be ready before requesting exits from framework #41782

Merged
merged 7 commits into from
May 16, 2023

Conversation

gspencergoog
Copy link
Contributor

@gspencergoog gspencergoog commented May 5, 2023

Description

Similar to #41733 and #41753 this causes the linux embedding to wait until it hears that the scheduler binding has registered itself before proceeding to send termination requests to the framework.

This allows applications that don't use the framework (just use dart:ui directly) to exit automatically when the last window is closed. Without this change, the app does not exit when the window is closed.

Depends on framework PR flutter/flutter#126075 landing first.

Related PRs

Related Issues

Tests

  • Added a test to make sure that it doesn't send a termination request if the binding hasn't notified that it is ready yet.

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!

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.

Nice!


g_autoptr(FlValue) requestArgs = fl_value_new_map();
fl_value_set_string_take(requestArgs, "type",
ON_CALL(messenger, fl_binary_messenger_send_response(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@robert-ancell In order to respond with a null argument, I had to add this ON_CALL to the test so that the mock would return a success response. Otherwise, because the error information isn't set, and it returns false by default, the test SEGVs when trying to access the error information. Is that expected? It doesn't seem to have any issues in production, but I want to make sure I'm not just putting duct tape on it.

Copy link
Contributor

Choose a reason for hiding this comment

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

I don't fully understand the gtest mock code but I do notice this has ::testing::_ as the second last argument and not SuccessResponse(null) as cases in other tests? So I think it's going to be returning an empty response, not a dart null if that's what you expect.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The ::testing::_ is a wildcard, so it just means it will return a true result for a call with anything in that position. It doesn't affect what is returned (which is just a bool).

I added it, but it doesn't really change anything.

Copy link
Contributor

@robert-ancell robert-ancell left a comment

Choose a reason for hiding this comment

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

lgtm

@gspencergoog gspencergoog force-pushed the fix_linux_exit branch 2 times, most recently from 8100ef1 to 6ccbdc5 Compare May 16, 2023 19:42
@gspencergoog gspencergoog added the autosubmit Merge PR when tree becomes green via auto submit App label May 16, 2023
@auto-submit auto-submit bot merged commit a49138e into flutter:main May 16, 2023
gspencergoog added a commit that referenced this pull request May 16, 2023
…mework (#41753)

Similar to #41733 and
#41782, this causes the macos
embedding to wait until it hears that the scheduler binding has
registered itself before proceeding to send termination requests to the
framework.

This allows applications that don't use the framework (just use
`dart:ui` directly) to exit automatically when the last window is
closed. Without this change, the last window closes, but the app does
not exit.

Depends on framework PR flutter/flutter#126075
landing first.
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request May 16, 2023
zanderso pushed a commit to flutter/flutter that referenced this pull request May 16, 2023
…sions) (#126961)

Manual roll requested by zra@google.com

flutter/engine@fe24767...1c775e3

2023-05-16 zanderso@users.noreply.github.com Revert "[ios_platform_view]
only recycle maskView when the view is applying mutators"
(flutter/engine#42080)
2023-05-16 gspencergoog@users.noreply.github.com [macOS] Wait for
binding to be ready before requesting exits from framework
(flutter/engine#41753)
2023-05-16 gspencergoog@users.noreply.github.com [linux] Wait for
binding to be ready before requesting exits from framework
(flutter/engine#41782)
2023-05-16 jacksongardner@google.com Initial support for images in
Skwasm (flutter/engine#42019)
2023-05-16 jacksongardner@google.com Use new `unresolvedCodePoints` API
from skia. (flutter/engine#41991)
2023-05-16 jason-simmons@users.noreply.github.com Convert public API
NativeFieldWrapper classes to abstract interfaces (flutter/engine#41945)
2023-05-16 737941+loic-sharma@users.noreply.github.com [Windows] Add
force redraw to the C++ client wrapper (flutter/engine#42061)
2023-05-16 godofredoc@google.com Fix drone_dimension
host_engine_builder. (flutter/engine#42068)
2023-05-16 godofredoc@google.com Add linux_clang_tidy builder.
(flutter/engine#41990)
2023-05-16 ychris@google.com [ios_platform_view] only recycle maskView
when the view is applying mutators (flutter/engine#41573)

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 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
CaseyHillers pushed a commit to CaseyHillers/flutter that referenced this pull request May 24, 2023
…sions) (flutter#126961)

Manual roll requested by zra@google.com

flutter/engine@fe24767...1c775e3

2023-05-16 zanderso@users.noreply.github.com Revert "[ios_platform_view]
only recycle maskView when the view is applying mutators"
(flutter/engine#42080)
2023-05-16 gspencergoog@users.noreply.github.com [macOS] Wait for
binding to be ready before requesting exits from framework
(flutter/engine#41753)
2023-05-16 gspencergoog@users.noreply.github.com [linux] Wait for
binding to be ready before requesting exits from framework
(flutter/engine#41782)
2023-05-16 jacksongardner@google.com Initial support for images in
Skwasm (flutter/engine#42019)
2023-05-16 jacksongardner@google.com Use new `unresolvedCodePoints` API
from skia. (flutter/engine#41991)
2023-05-16 jason-simmons@users.noreply.github.com Convert public API
NativeFieldWrapper classes to abstract interfaces (flutter/engine#41945)
2023-05-16 737941+loic-sharma@users.noreply.github.com [Windows] Add
force redraw to the C++ client wrapper (flutter/engine#42061)
2023-05-16 godofredoc@google.com Fix drone_dimension
host_engine_builder. (flutter/engine#42068)
2023-05-16 godofredoc@google.com Add linux_clang_tidy builder.
(flutter/engine#41990)
2023-05-16 ychris@google.com [ios_platform_view] only recycle maskView
when the view is applying mutators (flutter/engine#41573)

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 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://bugs.chromium.org/p/skia/issues/entry?template=Autoroller+Bug

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
autosubmit Merge PR when tree becomes green via auto submit App platform-linux
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants